| @@ 47-81 (lines=35) @@ | ||
| 44 | $this->callbackParams = $callbackParams; |
|
| 45 | } |
|
| 46 | ||
| 47 | public function send(ApiClient $apiClient): PaymentResponse |
|
| 48 | { |
|
| 49 | $requestData = [ |
|
| 50 | 'merchantId' => $this->merchantId, |
|
| 51 | 'payId' => $this->payId, |
|
| 52 | 'callbackParams' => $this->callbackParams, |
|
| 53 | ]; |
|
| 54 | ||
| 55 | $response = $apiClient->post( |
|
| 56 | 'masterpass/basic/finish', |
|
| 57 | $requestData, |
|
| 58 | new SignatureDataFormatter([ |
|
| 59 | 'merchantId' => null, |
|
| 60 | 'payId' => null, |
|
| 61 | 'callbackParams' => null, |
|
| 62 | ]), |
|
| 63 | new SignatureDataFormatter([ |
|
| 64 | 'payId' => null, |
|
| 65 | 'dttm' => null, |
|
| 66 | 'resultCode' => null, |
|
| 67 | 'resultMessage' => null, |
|
| 68 | 'paymentStatus' => null, |
|
| 69 | ]) |
|
| 70 | ); |
|
| 71 | ||
| 72 | $data = $response->getData(); |
|
| 73 | ||
| 74 | return new PaymentResponse( |
|
| 75 | $data['payId'], |
|
| 76 | DateTimeImmutable::createFromFormat('YmdHis', $data['dttm']), |
|
| 77 | ResultCode::get($data['resultCode']), |
|
| 78 | $data['resultMessage'], |
|
| 79 | isset($data['paymentStatus']) ? PaymentStatus::get($data['paymentStatus']) : null |
|
| 80 | ); |
|
| 81 | } |
|
| 82 | ||
| 83 | } |
|
| 84 | ||
| @@ 34-67 (lines=34) @@ | ||
| 31 | $this->payId = $payId; |
|
| 32 | } |
|
| 33 | ||
| 34 | public function send(ApiClient $apiClient): PaymentResponse |
|
| 35 | { |
|
| 36 | $requestData = [ |
|
| 37 | 'merchantId' => $this->merchantId, |
|
| 38 | 'payId' => $this->payId, |
|
| 39 | ]; |
|
| 40 | ||
| 41 | $response = $apiClient->post( |
|
| 42 | 'payment/oneclick/start', |
|
| 43 | $requestData, |
|
| 44 | new SignatureDataFormatter([ |
|
| 45 | 'merchantId' => null, |
|
| 46 | 'payId' => null, |
|
| 47 | 'dttm' => null, |
|
| 48 | ]), |
|
| 49 | new SignatureDataFormatter([ |
|
| 50 | 'payId' => null, |
|
| 51 | 'dttm' => null, |
|
| 52 | 'resultCode' => null, |
|
| 53 | 'resultMessage' => null, |
|
| 54 | 'paymentStatus' => null, |
|
| 55 | ]) |
|
| 56 | ); |
|
| 57 | ||
| 58 | $data = $response->getData(); |
|
| 59 | ||
| 60 | return new PaymentResponse( |
|
| 61 | $data['payId'], |
|
| 62 | DateTimeImmutable::createFromFormat('YmdHis', $data['dttm']), |
|
| 63 | ResultCode::get($data['resultCode']), |
|
| 64 | $data['resultMessage'], |
|
| 65 | isset($data['paymentStatus']) ? PaymentStatus::get($data['paymentStatus']) : null |
|
| 66 | ); |
|
| 67 | } |
|
| 68 | ||
| 69 | } |
|
| 70 | ||