関数
State::populate()
ChargePermission specific errors for a NonChargeable or Closed state説明 説明
Note that there are certain reasonCodes that do not necessarily indicate that an error occured (ie. MerchantCanceled, ChargeInProgress, etc.).
ファイル: src/Models/ChargePermission/State.php
public function populate() {
// NonChargeable
$this->addError(new GenericError(
NonChargeableReasonCodes::PAYMENT_METHOD_INVALID,
'PAYMENT_METHOD_INVALID',
422,
function ($message) {
return $message;
},
__('The previous charge was declined. Ask the buyer to update the payment method', 'wcexaap')
));
$this->addError(new GenericError(
NonChargeableReasonCodes::PAYMENT_METHOD_DELETED,
'PAYMENT_METHOD_DELETED',
404,
function ($message) {
return $message;
},
__('The buyer has deleted the selected payment method', 'wcexaap')
));
$this->addError(new GenericError(
NonChargeableReasonCodes::BILLING_ADDRESS_DELETED,
'BILLING_ADDRESS_DELETED',
404,
function ($message) {
return $message;
},
__('The buyer has deleted the billing address of the selected payment method', 'wcexaap')
));
$this->addError(new GenericError(
NonChargeableReasonCodes::PAYMENT_METHOD_EXPIRED,
'PAYMENT_METHOD_EXPIRED',
422,
function ($message) {
return $message;
},
__('The selected payment method has expired', 'wcexaap')
));
$this->addError(new GenericError(
NonChargeableReasonCodes::PAYMENT_METHOD_NOT_ALLOWED,
'PAYMENT_METHOD_NOT_ALLOWED',
403,
function ($message) {
return $message;
},
__('The payment method selected by the buyer is not allowed for this Charge Permission', 'wcexaap')
));
$this->addError(new GenericError(
NonChargeableReasonCodes::PAYMENT_METHOD_NOT_SET,
'PAYMENT_METHOD_NOT_SET',
403,
function ($message) {
return $message;
},
__('There is no payment method associated with this charge permission', 'wcexaap')
));
$this->addError(new GenericError(
NonChargeableReasonCodes::CHARGE_IN_PROGRESS,
'CHARGE_IN_PROGRESS',
409,
function ($message) {
return $message;
},
__('A charge is already in progress. You cannot initiate a new charge unless previous charge is canceled', 'wcexaap')
));
$this->addError(new GenericError(
NonChargeableReasonCodes::MFA_FAILED,
'MFA_FAILED',
422,
function ($message) {
return $message;
},
__('Buyer did not verify the transaction. Charge cannot be initiated unless buyer verifies the amount on the transaction', 'wcexaap')
));
// Declined
$this->addError(new GenericError(
ClosedReasonCodes::MERCHANT_CLOSED,
'MERCHANT_CLOSED',
400,
function ($message) {
return $message;
},
__('You closed the Charge Permission by calling Close Charge Permission operation', 'wcexaap')
));
$this->addError(new GenericError(
ClosedReasonCodes::BUYER_CANCELED,
'BUYER_CANCELED',
422,
function ($message) {
return $message;
},
__('The buyer closed the Charge Permission', 'wcexaap')
));
$this->addError(new GenericError(
ClosedReasonCodes::AMAZON_CANCELED,
'AMAZON_CANCELED',
422,
function ($message) {
return $message;
},
__('Amazon closed the Charge Permission', 'wcexaap')
));
$this->addError(new GenericError(
ClosedReasonCodes::AMAZON_CLOSED,
'AMAZON_CLOSED',
422,
function ($message) {
return $message;
},
__('Amazon closed the Charge Permission since the Charge was Completed', 'wcexaap')
));
$this->addError(new GenericError(
ClosedReasonCodes::EXPIRED,
'EXPIRED',
422,
function ($message) {
return $message;
},
__('The Charge Permission expired after 180 days', 'wcexaap')
));
}