| Conditions | 2 |
| Paths | 1 |
| Total Lines | 32 |
| Code Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 16 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types = 1); |
||
| 33 | 1 | public function send(ApiClient $apiClient): PaymentResponse |
|
| 34 | { |
||
| 35 | $requestData = [ |
||
| 36 | 1 | 'merchantId' => $this->merchantId, |
|
| 37 | 1 | 'payId' => $this->payId, |
|
| 38 | ]; |
||
| 39 | |||
| 40 | 1 | $response = $apiClient->post( |
|
| 41 | 1 | 'oneclick/start', |
|
| 42 | $requestData, |
||
| 43 | 1 | new SignatureDataFormatter([ |
|
| 44 | 1 | 'merchantId' => null, |
|
| 45 | 'payId' => null, |
||
| 46 | 'dttm' => null, |
||
| 47 | ]), |
||
| 48 | 1 | new SignatureDataFormatter([ |
|
| 49 | 1 | 'payId' => null, |
|
| 50 | 'dttm' => null, |
||
| 51 | 'resultCode' => null, |
||
| 52 | 'resultMessage' => null, |
||
| 53 | 'paymentStatus' => null, |
||
| 54 | ]) |
||
| 55 | ); |
||
| 56 | |||
| 57 | 1 | $data = $response->getData(); |
|
| 58 | |||
| 59 | 1 | return new PaymentResponse( |
|
| 60 | 1 | $data['payId'], |
|
| 61 | 1 | DateTimeImmutable::createFromFormat('YmdHis', $data['dttm']), |
|
|
|
|||
| 62 | 1 | ResultCode::get($data['resultCode']), |
|
| 63 | 1 | $data['resultMessage'], |
|
| 64 | 1 | isset($data['paymentStatus']) ? PaymentStatus::get($data['paymentStatus']) : null |
|
| 65 | ); |
||
| 69 |