関数
Complete::populate()
Populates error store
説明 説明
ファイル: src/API/CheckoutSession/Complete.php
public function populate() { $actingLogger = new ActingLogger($this->module); $defaultMessage = __('A processing error occured. Please try again.', 'wcexaap'); $this->addError((new GenericError( self::CHECKOUT_SESSION_CANCELED, $this->getConstantNameByValue(self::CHECKOUT_SESSION_CANCELED), 400, function ($message) { return $message; }, __('The payment method may have been declined. Please choose a different payment method and try again.', 'wcexaap'), __('Checkout was unsuccessful because the buyer cancelled the transaction or payment was declined', 'wcexaap') ))->setLogger($actingLogger)); $this->addError((new GenericError( self::CURRENCY_MISMATCH, $this->getConstantNameByValue(self::CURRENCY_MISMATCH), 400, function ($message) { return $message; }, $defaultMessage, __('The currency code provided in the request does not match the currency set during checkout', 'wcexaap') ))->setLogger($actingLogger)); $this->addError((new GenericError( self::TRANSACTION_AMOUNT_EXCEEDED, $this->getConstantNameByValue(self::TRANSACTION_AMOUNT_EXCEEDED), 400, function ($message) { return $message; }, __('Transaction amount exceeded. Please close all other tabs for this website and try again.', 'wcexaap'), __('Youve exceeded the maximum charge amount allowed for the Checkout Session', 'wcexaap') ))->setLogger($actingLogger)); $this->addError((new GenericError( self::RESOURCE_NOT_FOUND, $this->getConstantNameByValue(self::RESOURCE_NOT_FOUND), 404, function ($message) { return $message; }, __('The checkout session has expired. Please try again.'), __('Checkout Session details are permanently deleted after 30 days. Any request on the Checkout Session will return this error code', 'wcexaap') ))->setLogger($actingLogger)); $this->addError((new GenericError( self::AMOUNT_MISMATCH, $this->getConstantNameByValue(self::AMOUNT_MISMATCH), 409, function ($message) { return $message; }, __('The total price of your purchase has changed unexpectedly. Please close all other tabs for this website and try again.', 'wcexaap'), __('Mismatch between Checkout Session object chargeAmount and the request chargeAmount', 'wcexaap') ))->setLogger($actingLogger)); $this->addError((new GenericError( self::INVALID_CHECKOUT_SESSION_STATUS, $this->getConstantNameByValue(self::INVALID_CHECKOUT_SESSION_STATUS), 422, function ($message) { return $message; }, $defaultMessage, __('You tried to call an operation on a Checkout Session that is in a state where that operation is not allowed', 'wcexaap') ))->setLogger($actingLogger)); $this->addError((new GenericError( self::INVALID_CHARGE_STATUS, $this->getConstantNameByValue(self::INVALID_CHARGE_STATUS), 422, function ($message) { return $message; }, $defaultMessage, __('You tried to call an operation on a Charge that is in a state where that operation is not allowed or you tried to Complete Checkout Session on a Checkout Session with paymentIntent set to AuthorizeWithCapture and canHandlePendingAuthorization set to true', 'wcexaap') ))->setLogger($actingLogger)); $this->addError((new GenericError( self::SOFT_DECLINED, $this->getConstantNameByValue(self::SOFT_DECLINED), 422, function ($message) { return $message; }, __('Your payment method was declined. Please choose a different payment method and try again.', 'wcexaap'), __('Charge was soft declined. Retry attempts may or may not be successful. If repeated retry attempts are unsuccessful, contact the buyer and have them choose a different payment instrument', 'wcexaap') ))->setLogger($actingLogger)); $this->addError((new GenericError( self::HARD_DECLINED, $this->getConstantNameByValue(self::HARD_DECLINED), 422, function ($message) { return $message; }, __('Your payment method was declined. Please choose a different payment method and try again.', 'wcexaap'), __('Charge was hard declined. Retry attemps will not succeed. Please contact the buyer and have them choose a different payment instrument', 'wcexaap') ))->setLogger($actingLogger)); $this->addError((new GenericError( self::PAYMENT_METHOD_NOT_ALLOWED, $this->getConstantNameByValue(self::PAYMENT_METHOD_NOT_ALLOWED), 422, function ($message) { return $message; }, __('Your payment method was declined. Please choose a different payment method and try again.', 'wcexaap'), __('The payment method selected by the buyer is not allowed for this charge', 'wcexaap') ))->setLogger($actingLogger)); $this->addError((new GenericError( self::AMAZON_REJECTED, $this->getConstantNameByValue(self::AMAZON_REJECTED), 422, function ($message) { return $message; }, __('Your payment method was declined. Please choose a different payment method and try again.', 'wcexaap'), __('Charge was declined by Amazon. The associated Charge Permission will also be canceled', 'wcexaap') ))->setLogger($actingLogger)); $this->addError((new GenericError( self::MFA_NOT_COMPLETED, $this->getConstantNameByValue(self::MFA_NOT_COMPLETED), 422, function ($message) { return $message; }, $defaultMessage, __('Multi-factor authentication (MFA) is required to be complete by the buyer for this transaction to process', 'wcexaap') ))->setLogger($actingLogger)); $this->addError((new GenericError( self::TRANSACTION_TIMED_OUT, $this->getConstantNameByValue(self::TRANSACTION_TIMED_OUT), 422, function ($message) { return $message; }, __('The transaction timed-out. Please try again.', 'wcexaap'), __('The Charge was declined because Amazon did not have enough time to process the authorization.', 'wcexaap') ))->setLogger($actingLogger)); $this->addError((new GenericError( self::PROCESSING_FAILURE, $this->getConstantNameByValue(self::PROCESSING_FAILURE), 500, function ($message) { return $message; }, __('Amazon could not process the transaction.', 'wcexaap'), __('Amazon could not process the Charge because of an internal processing error. You should retry the charge only if the Charge Permission is in the Chargeable state', 'wcexaap') ))->setLogger($actingLogger)); }