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