1 | <?php |
||
15 | class Facade |
||
16 | { |
||
17 | /** |
||
18 | * @var CredentialsInterface |
||
19 | */ |
||
20 | private static $credentials; |
||
21 | /** |
||
22 | * @var TransportInterface |
||
23 | */ |
||
24 | private static $transport; |
||
25 | /** |
||
26 | * @var PublicAPIClient |
||
27 | */ |
||
28 | private static $client; |
||
29 | /** |
||
30 | * @var LoggerInterface|null |
||
31 | */ |
||
32 | private static $logger; |
||
33 | |||
34 | /** |
||
35 | * Set logger |
||
36 | * |
||
37 | * @param LoggerInterface $logger |
||
38 | */ |
||
39 | public static function setLogger(LoggerInterface $logger) |
||
43 | |||
44 | /** |
||
45 | * Sets (or replaces) credentials |
||
46 | * |
||
47 | * @param string $token |
||
48 | * @param string $secret |
||
49 | */ |
||
50 | public static function setCredentials($token, $secret) |
||
54 | |||
55 | /** |
||
56 | * Sets (or replaces) transport |
||
57 | * |
||
58 | * @param TransportInterface $transport |
||
59 | */ |
||
60 | public static function setTransport(TransportInterface $transport) |
||
64 | |||
65 | /** |
||
66 | * Utility method to take client |
||
67 | * |
||
68 | * @return PublicAPIClient |
||
69 | * @throws Exception |
||
70 | */ |
||
71 | private static function getClient() |
||
83 | |||
84 | /** |
||
85 | * Sends request to Covery and returns access level, associated with |
||
86 | * used credentials |
||
87 | * |
||
88 | * This method can be used for Covery health check and availability |
||
89 | * On any problem (network, credentials, server side) this method |
||
90 | * will throw an exception |
||
91 | * |
||
92 | * @return mixed |
||
93 | * @throws Exception |
||
94 | */ |
||
95 | public static function ping() |
||
99 | |||
100 | /** |
||
101 | * Sends envelope to Covery and returns it's ID on Covery side |
||
102 | * Before sending, validation is performed |
||
103 | * |
||
104 | * @param EnvelopeInterface $envelope |
||
105 | * @return int |
||
106 | * @throws Exception |
||
107 | */ |
||
108 | public static function sendEvent(EnvelopeInterface $envelope) |
||
112 | |||
113 | /** |
||
114 | * Sends postback envelope to Covery and returns it's ID on Covery side |
||
115 | * Before sending, validation is performed |
||
116 | * |
||
117 | * @param EnvelopeInterface $envelope |
||
118 | * @return int |
||
119 | * @throws Exception |
||
120 | */ |
||
121 | public static function sendPostback(EnvelopeInterface $envelope) |
||
125 | |||
126 | /** |
||
127 | * Sends envelope to Covery for analysis |
||
128 | * |
||
129 | * @param EnvelopeInterface $envelope |
||
130 | * @return Result |
||
131 | * @throws Exception |
||
132 | */ |
||
133 | public static function makeDecision(EnvelopeInterface $envelope) |
||
137 | |||
138 | /** |
||
139 | * Sends KycProof envelope to Covery and returns data on Covery side |
||
140 | * |
||
141 | * @param EnvelopeInterface $envelope |
||
142 | * @return KycProofResult |
||
143 | * @throws Exception |
||
144 | */ |
||
145 | public static function sendKycProof(EnvelopeInterface $envelope) |
||
149 | } |
||
150 |