関数
Get::get( string $refundId )
Gets a Refund
説明 説明
- $refundId
(文字列) (必須) Refund ID
ファイル: src/API/Refund/Get.php
public function get($refundId) { try { $client = $this->module->getAmazonClient(); $result = $client->getRefund($refundId); if ($this->module->errors->hasError($result)) { return $this->module->errors->getAmzErrorResponse($result); } } catch (\Exception $e) { return $this->module->errors->getErrorResponse( GenericErrorStore::AMAZON_PAY_SDK_CLIENT_EXCEPTION, [$e->getMessage()] ); } $oldRefundState = $this->order->getRefundState(); $response = json_decode($result['response'], true); $details = $response['statusDetails']; $this->order->updateRefundState( new State( $details['state'], $details['reasonCode'], $details['reasonDescription'] ) ); if ($details['state'] !== $oldRefundState->getState() && !empty(State::STATE_TO_LOG_ACTION[$details['state']])) { (new Logger())->logApiResponse(new Log( $this->order->getChargePermissionId(), State::STATE_TO_LOG_ACTION[$details['state']], Log::RESPONSE_OK, $details['state'] === State::REFUNDED ? $this->order->getMostRecentTransactionAmount() : null )); } return $result; }