関数
State::populate()
Charge
specific errors for a Canceled
or Declined
state
説明 説明
Note that there are certain reasonCodes
that do not necessarily indicate that an error occured (ie. MerchantCanceled
, ChargePermissionCanceled
, etc.).
ファイル: src/Models/Charge/State.php
public function populate() { // Canceled $this->addError(new GenericError( CanceledReasonCodes::EXPIRED_UNUSED, 'EXPIRED_UNUSED', 400, function ($message) { return $message; }, __('Funds have not been captured within 30 days. The charge has expired.', 'wcexaap') )); $this->addError(new GenericError( CanceledReasonCodes::AMAZON_CANCELED, 'AMAZON_CANCELED', 503, function ($message) { return $message; }, __('Amazon canceled the charge.', 'wcexaap') )); $this->addError(new GenericError( CanceledReasonCodes::MERCHANT_CANCELED, 'MERCHANT_CANCELED', 400, function ($message) { return $message; }, __('The charge has been canceled.', 'wcexaap') )); $this->addError(new GenericError( CanceledReasonCodes::CHARGE_PERMISSION_CANCELED, 'CHARGE_PERMISSION_CANCELED', 400, function ($message) { return $message; }, __('The charge has been canceled.', 'wcexaap') )); $this->addError(new GenericError( CanceledReasonCodes::BUYER_CANCELED, 'BUYER_CANCELED', 400, function ($message) { return $message; }, __('The charge was canceled', 'wcexaap') )); // Declined $this->addError(new GenericError( DeclinedReasonCodes::SOFT_DECLINED, 'SOFT_DECLINED', 403, function ($message) { return $message; }, __('The charge has been declined.', 'wcexaap') )); $this->addError(new GenericError( DeclinedReasonCodes::HARD_DECLINED, 'HARD_DECLINED', 403, function ($message) { return $message; }, __('The charge has been declined.', 'wcexaap') )); $this->addError(new GenericError( DeclinedReasonCodes::AMAZON_REJECTED, 'AMAZON_REJECTED', 403, function ($message) { return $message; }, __('The charge was declined by Amazon.', 'wcexaap') )); $this->addError(new GenericError( DeclinedReasonCodes::PROCESSING_FAILURE, 'PROCESSING_FAILURE', 500, function ($message) { return $message; }, __('Amazon was unable to process the charge due to an internal error.', 'wcexaap') )); $this->addError(new GenericError( DeclinedReasonCodes::TRANSACTION_TIMED_OUT, 'TRANSACTION_TIMED_OUT', 503, function ($message) { return $message; }, __('The transaction timed out.', 'wcexaap') )); }