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