クラス
AdminErrorStore
ソース ソース
ファイル: src/Errors/AdminErrorStore.php
class AdminErrorStore extends ErrorStore implements ErrorCodes
{
/**
* Populates (initializes) error store
*
* @author Evan D Shaw <evandanielshaw@gmail.com>
* @return void
*/
public function populate() {
$this->addError(new LinePayError(
self::MERCHANT_NOT_FOUND,
$this->getConstantNameByValue(self::MERCHANT_NOT_FOUND),
404,
function ($message) {
return $message;
},
__('You are not signed up to use LINE Pay.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::MERCHANT_NOT_ALLOWED,
$this->getConstantNameByValue(self::MERCHANT_NOT_ALLOWED),
401,
function ($message) {
return $message;
},
__('The Merchant cannot use LINE Pay.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::HEADER_INFO_ERROR,
$this->getConstantNameByValue(self::HEADER_INFO_ERROR),
500,
function ($message) {
return $message;
},
__('HTTP Header info error.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::NO_TRANSACTIONS_FOUND,
$this->getConstantNameByValue(self::NO_TRANSACTIONS_FOUND),
404,
function ($message) {
return $message;
},
__('No such transaction found.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::WRONG_TRANSACTION_NUMBER,
$this->getConstantNameByValue(self::WRONG_TRANSACTION_NUMBER),
400,
function ($message) {
return $message;
},
__('Wrong transaction number.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::ACCOUNT_BALANCE_CHANGED,
$this->getConstantNameByValue(self::ACCOUNT_BALANCE_CHANGED),
400,
function ($message) {
return $message;
},
__('Your account balance changed. Please check your balance and try again.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::ORDER_ID_ALREADY_EXISTS,
$this->getConstantNameByValue(self::ORDER_ID_ALREADY_EXISTS),
409,
function ($message) {
return $message;
},
__('A record of a transaction with the same order number already exists.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::CANNOT_PROCESS_TRANSACTION,
$this->getConstantNameByValue(self::CANNOT_PROCESS_TRANSACTION),
500,
function ($message) {
return $message;
},
__('Unable to process transaction.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::AMOUNT_IS_ZERO,
$this->getConstantNameByValue(self::AMOUNT_IS_ZERO),
400,
function ($message) {
return $message;
},
__('The payment amount must be greater than 0.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::PAYMENT_AMOUNT_EXCEEDS_REQUESTED_AMOUNT,
$this->getConstantNameByValue(self::PAYMENT_AMOUNT_EXCEEDS_REQUESTED_AMOUNT),
400,
function ($message) {
return $message;
},
__('The payment amount exceeds requested amount.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::DUPLICATE_REQUEST_OR_RACE_CONDITION,
$this->getConstantNameByValue(self::DUPLICATE_REQUEST_OR_RACE_CONDITION),
400,
function ($message) {
return $message;
},
__('Either you are attempting a duplicate request, or a race condition is occuring.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::INTERNAL_REQUEST_ERROR,
$this->getConstantNameByValue(self::INTERNAL_REQUEST_ERROR),
500,
function ($message) {
return $message;
},
__('Internal request error', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::TEMPORARY_CREDIT_CARD_ERROR,
$this->getConstantNameByValue(self::TEMPORARY_CREDIT_CARD_ERROR),
500,
function ($message) {
return $message;
},
__('A temporary error occurred while processing the credit card payment.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::CREDIT_CARD_PAYMENT_ERROR,
$this->getConstantNameByValue(self::CREDIT_CARD_PAYMENT_ERROR),
500,
function ($message) {
return $message;
},
__('Credit card payment error.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::CREDIT_CARD_AUTH_ERROR,
$this->getConstantNameByValue(self::CREDIT_CARD_AUTH_ERROR),
401,
function ($message) {
return $message;
},
__('Credit card authorization error.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::SUSPECTED_FRAUD,
$this->getConstantNameByValue(self::SUSPECTED_FRAUD),
403,
function ($message) {
return $message;
},
__('The payment was refused due to suspected fraud.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::CARD_PAYMENT_TEMPORARILY_STOPPED,
$this->getConstantNameByValue(self::CARD_PAYMENT_TEMPORARILY_STOPPED),
423,
function ($message) {
return $message;
},
__('The credit card payment has temporarily stopped.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::CARD_PAYMENT_MISSING_INFO,
$this->getConstantNameByValue(self::CARD_PAYMENT_MISSING_INFO),
400,
function ($message) {
return $message;
},
__('Missing credit card payment information.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::WRONG_CARD_PAYMENT_INFO,
$this->getConstantNameByValue(self::WRONG_CARD_PAYMENT_INFO),
400,
function ($message) {
return $message;
},
__('Wrong credit card payment information.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::CARD_EXPIRED,
$this->getConstantNameByValue(self::CARD_EXPIRED),
403,
function ($message) {
return $message;
},
__('The credit card is expired.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::CARD_LOW_BALANCE,
$this->getConstantNameByValue(self::CARD_LOW_BALANCE),
403,
function ($message) {
return $message;
},
__('Card balance is too low.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::CARD_LIMIT_EXCEEDED,
$this->getConstantNameByValue(self::CARD_LIMIT_EXCEEDED),
400,
function ($message) {
return $message;
},
__('Credit card limit exceeded.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::CARD_PER_PAYMENT_LIMIT_EXCEEDED,
$this->getConstantNameByValue(self::CARD_PER_PAYMENT_LIMIT_EXCEEDED),
400,
function ($message) {
return $message;
},
__('The payment amount exceeds the credit card per-payment limit.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::CARD_REPORTED_STOLEN,
$this->getConstantNameByValue(self::CARD_REPORTED_STOLEN),
403,
function ($message) {
return $message;
},
__('The card has been reported as a stolen card.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::CARD_SUSPENDED,
$this->getConstantNameByValue(self::CARD_SUSPENDED),
403,
function ($message) {
return $message;
},
__('The card has been suspended.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::CVN_INPUT_ERROR,
$this->getConstantNameByValue(self::CVN_INPUT_ERROR),
400,
function ($message) {
return $message;
},
__('The inputed CVN is not correct.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::CARD_BLACKLISTED,
$this->getConstantNameByValue(self::CARD_BLACKLISTED),
403,
function ($message) {
return $message;
},
__('The card blacklisted.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::WRONG_CREDIT_CARD_NUMBER,
$this->getConstantNameByValue(self::WRONG_CREDIT_CARD_NUMBER),
400,
function ($message) {
return $message;
},
__('The credit card number is incorrect.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::CANNOT_PROCESS_AMOUNT,
$this->getConstantNameByValue(self::CANNOT_PROCESS_AMOUNT),
500,
function ($message) {
return $message;
},
__('Cannot process payment amount.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::CARD_DECLINED,
$this->getConstantNameByValue(self::CARD_DECLINED),
403,
function ($message) {
return $message;
},
__('The card was declined.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::USER_SUSPENDED_1101,
$this->getConstantNameByValue(self::USER_SUSPENDED_1101),
404,
function ($message) {
return $message;
},
__('Not a LINE Pay member.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::USER_SUSPENDED_1102,
$this->getConstantNameByValue(self::USER_SUSPENDED_1102),
403,
function ($message) {
return $message;
},
__('The member is unable to proceed with the transaction.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::TEMPORARY_ERROR_1900,
$this->getConstantNameByValue(self::TEMPORARY_ERROR_1900),
500,
function ($message) {
return $message;
},
__('A temporary error occured. Please try again later.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::TEMPORARY_ERROR_1902,
$this->getConstantNameByValue(self::TEMPORARY_ERROR_1902),
500,
function ($message) {
return $message;
},
__('A temporary error occured. Please try again later.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::REQUEST_INFO_DIFFERENT_THAN_PREVIOUS,
$this->getConstantNameByValue(self::REQUEST_INFO_DIFFERENT_THAN_PREVIOUS),
400,
function ($message) {
return $message;
},
__('The request information is different than the previous one.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::ERROR_IN_AMOUNT_SCALE,
$this->getConstantNameByValue(self::ERROR_IN_AMOUNT_SCALE),
400,
function ($message) {
return $message;
},
__('Could not parse amount.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::REFUNDABLE_TIME_WINDOW_EXCEEDED,
$this->getConstantNameByValue(self::REFUNDABLE_TIME_WINDOW_EXCEEDED),
400,
function ($message) {
return $message;
},
__('The refundable time window has passed.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::REFUNDABLE_AMOUNT_EXCEEDED,
$this->getConstantNameByValue(self::REFUNDABLE_AMOUNT_EXCEEDED),
400,
function ($message) {
return $message;
},
__('Exceeded refundable amount.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::TRANSACTION_ALREADY_REFUNDED,
$this->getConstantNameByValue(self::TRANSACTION_ALREADY_REFUNDED),
400,
function ($message) {
return $message;
},
__('This order has already been refunded.', 'wcex_linepay')
));
$this->addError(new LinePayError(
self::PARAMETER_ERROR,
$this->getConstantNameByValue(self::PARAMETER_ERROR),
500,
function ($message) {
return $message;
},
__('Parameter error.', 'wcex_linepay')
));
}
/**
* Code number 1155 is duplicated so we have to call this in case
* 1155 is returned from the refund API
*
* Thanks LINE!
*
* @author Evan D Shaw <evandanielshaw@gmail.com>
* @return LinePayError
*/
public function getRefund1155Error() {
return (new LinePayError(
1155,
'TRANSACTION_TYPE_CANNOT_BE_REFUNDED',
400,
__('This transaction is in a non-refundable state.', 'wcex_linepay'),
__('This transaction is in a non-refundable state.', 'wcex_linepay')
))->setLogger($this->logger);
}
}
- getRefund1155Error — Code number 1155 is duplicated so we have to call this in case 1155 is returned from the refund API
- populate — Populates (initializes) error store