Awight has uploaded a new change for review. https://gerrit.wikimedia.org/r/281081
Change subject: Move most error mapping into config ...................................................................... Move most error mapping into config Change-Id: Ie1100666ba669cfeeeb7cc4826118e48bc1db3f7 --- M adyen_gateway/adyen.adapter.php A adyen_gateway/config/error_map.yaml M amazon_gateway/amazon.adapter.php A amazon_gateway/config/error_map.yaml M astropay_gateway/astropay.adapter.php M gateway_common/gateway.adapter.php A globalcollect_gateway/config/error_map.yaml M globalcollect_gateway/globalcollect.adapter.php A paypal_gateway/config/error_map.yaml M paypal_gateway/paypal.adapter.php A worldpay_gateway/config/error_map.yaml M worldpay_gateway/worldpay.adapter.php 12 files changed, 114 insertions(+), 94 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface refs/changes/81/281081/1 diff --git a/adyen_gateway/adyen.adapter.php b/adyen_gateway/adyen.adapter.php index d2824a8..fc60460 100644 --- a/adyen_gateway/adyen.adapter.php +++ b/adyen_gateway/adyen.adapter.php @@ -45,12 +45,6 @@ ); } - function defineErrorMap() { - $this->error_map = array( - 'internal-0000' => 'donate_interface-processing-error', // Failed failed pre-process checks. - ); - } - function defineStagedVars() { $this->staged_vars = array( 'amount', diff --git a/adyen_gateway/config/error_map.yaml b/adyen_gateway/config/error_map.yaml new file mode 100644 index 0000000..4a715b0 --- /dev/null +++ b/adyen_gateway/config/error_map.yaml @@ -0,0 +1,2 @@ +# Failed failed pre-process checks. +internal-0000: donate_interface-processing-error diff --git a/amazon_gateway/amazon.adapter.php b/amazon_gateway/amazon.adapter.php index 33ce5ad..998a9ee 100644 --- a/amazon_gateway/amazon.adapter.php +++ b/amazon_gateway/amazon.adapter.php @@ -91,6 +91,8 @@ function setGatewayDefaults() {} public function defineErrorMap() { + parent::defineErrorMap(); + $self = $this; $differentCard = function() use ( $self ) { $otherWays = $self->localizeGlobal( 'OtherWaysURL' ); @@ -100,15 +102,8 @@ $self->getGlobal( 'ProblemsEmail' ) ); }; - $this->error_map = array( - // These might be transient - tell donor to try again soon - 'InternalServerError' => 'donate_interface-try-again', - 'RequestThrottled' => 'donate_interface-try-again', - 'ServiceUnavailable' => 'donate_interface-try-again', - 'ProcessingFailure' => 'donate_interface-try-again', - // Donor needs to select a different card - 'InvalidPaymentMethod' => $differentCard, - ); + // Donor needs to select a different card. + $this->error_map['InvalidPaymentMethod'] = $differentCard; } function defineTransactions() { diff --git a/amazon_gateway/config/error_map.yaml b/amazon_gateway/config/error_map.yaml new file mode 100644 index 0000000..5357945 --- /dev/null +++ b/amazon_gateway/config/error_map.yaml @@ -0,0 +1,5 @@ +# These might be transient - tell donor to try again soon +InternalServerError: donate_interface-try-again +RequestThrottled: donate_interface-try-again +ServiceUnavailable: donate_interface-try-again +ProcessingFailure: donate_interface-try-again diff --git a/astropay_gateway/astropay.adapter.php b/astropay_gateway/astropay.adapter.php index 29c7867..fd6df1d 100644 --- a/astropay_gateway/astropay.adapter.php +++ b/astropay_gateway/astropay.adapter.php @@ -43,6 +43,7 @@ $this->accountInfo = $this->account_config; } + // TODO: How to DRYly configurify? function defineErrorMap() { $this->error_map = array( 'internal-0000' => 'donate_interface-processing-error', // Failed pre-process checks. diff --git a/gateway_common/gateway.adapter.php b/gateway_common/gateway.adapter.php index e0dc8de..5bbb267 100644 --- a/gateway_common/gateway.adapter.php +++ b/gateway_common/gateway.adapter.php @@ -345,6 +345,13 @@ } } + // TODO: see comment on definePaymentMethods + public function defineErrorMap() { + if ( isset( $this->config['error_map'] ) ) { + $this->error_map = $this->config['error_map']; + } + } + public function defineDataTransformers() { if ( empty( $this->config['transformers'] ) ) { return; diff --git a/globalcollect_gateway/config/error_map.yaml b/globalcollect_gateway/config/error_map.yaml new file mode 100644 index 0000000..f0ba1e6 --- /dev/null +++ b/globalcollect_gateway/config/error_map.yaml @@ -0,0 +1,76 @@ +0: globalcollect_gateway-response-default +# Order ID already used in a previous transaction +300620: donate_interface-processing-error +# Not authorised :: This message was generated when trying to attempt a direct debit transaction from Belgium. +430452: globalcollect_gateway-response-default +# NO VALID PROVIDERS FOUND FOR COMBINATION MERCHANTID: NNNN, PAYMENTPRODUCT: NNN, COUNTRYCODE: XX, CURRENCYCODE: XXX +430900: globalcollect_gateway-response-default + +# Errors where the suggested action is to try again +# COULD NOT START TRANSACTION +20205: donate_interface-try-again +# ANOTHER_ACTION_IS_IN_PROCESS +103000: donate_interface-try-again +# IDEAL_SYSTEM_MAINTENANCE +400850: donate_interface-try-again +# READ_REQUEST_EXCEPTION +430150: donate_interface-try-again +# Unable to authorize ALL_TERMINAL_IDS_FOR_MERCHANT_CURRENCY_IN_USE +430160: donate_interface-try-again +# Unable to authorize COMMS_FAIL_101 +430215: donate_interface-try-again +# Unable to authorize COMMS_FAIL_103 +430220: donate_interface-try-again +# Unable to authorize COMMS_FAIL_111 +430225: donate_interface-try-again +# Unable to authorize COMMS_FAIL_113 +430230: donate_interface-try-again +# Unable to authorize COMMS_FAIL_183 +430235: donate_interface-try-again +# Unable to authorize COMMS_FAIL_601 +430240: donate_interface-try-again +# Unable to authorize COMMS_FAIL_605 +430245: donate_interface-try-again +# Unable to authorize TIMEOUT +430430: donate_interface-try-again +# Unable to authorize TOO_MUCH_USAGE +430433: donate_interface-try-again +# Not authorized SOFT_DECLINE_BUYER_HAS_ALTERNATE_FUNDING_SOURCE +430581: donate_interface-try-again +# Unable to authorize NEW_ACCOUNT_INFO_AVAILABLE +485000: donate_interface-try-again +# Unable to authorize TRY_AGAIN_LATER +485010: donate_interface-try-again +# PBS_SERVICE_NOT_AVAILABLE +4311130: donate_interface-try-again +# ECARD SYSTEM ERROR +4360025: donate_interface-try-again +# BOKU ERROR +4500600: donate_interface-try-again +# SUB1 ERROR +4500700: donate_interface-try-again +# COMMUNICATION ERROR +22000045: donate_interface-try-again +# ERROR_IN_PROCESSING_THE_REQUEST +9999999999: donate_interface-try-again + +# Internal messages +# Failed failed pre-process checks. +internal-0000: donate_interface-processing-error +# Transaction could not be processed due to an internal error. +internal-0001: donate_interface-processing-error +# Communication failure +internal-0002: donate_interface-processing-error +# Toxic card, don't retry on pain of $1000+ fine +internal-0003: donate_interface-processing-error + +# Do bank validation messages +# FIXME: Why are these commented out? Complete. +# Account number format incorrect +#'dbv-50' => 'globalcollect_gateway-response-dbv-50' +# Account details missing +#'dbv-80' => 'globalcollect_gateway-response-dbv-80' +# Check digit format is incorrect +#'dbv-330' => 'globalcollect_gateway-response-dbv-330' +# Branch code not submitted +#'dbv-340' => 'globalcollect_gateway-response-dbv-340' diff --git a/globalcollect_gateway/globalcollect.adapter.php b/globalcollect_gateway/globalcollect.adapter.php index 76d45c0..ea56035 100644 --- a/globalcollect_gateway/globalcollect.adapter.php +++ b/globalcollect_gateway/globalcollect.adapter.php @@ -59,60 +59,6 @@ } /** - * Define error_map - * - * @todo - * - Add: Error messages - */ - public function defineErrorMap() { - - $this->error_map = array( - 0 => 'globalcollect_gateway-response-default', - 300620 => 'donate_interface-processing-error', // Order ID already used in a previous transaction - 430452 => 'globalcollect_gateway-response-default', // Not authorised :: This message was generated when trying to attempt a direct debit transaction from Belgium. - 430900 => 'globalcollect_gateway-response-default', // NO VALID PROVIDERS FOUND FOR COMBINATION MERCHANTID: NNNN, PAYMENTPRODUCT: NNN, COUNTRYCODE: XX, CURRENCYCODE: XXX - - // Errors where the suggested action is to try again - 20205 => 'donate_interface-try-again', // COULD NOT START TRANSACTION - 103000 => 'donate_interface-try-again', // ANOTHER_ACTION_IS_IN_PROCESS - 400850 => 'donate_interface-try-again', // IDEAL_SYSTEM_MAINTENANCE - 430150 => 'donate_interface-try-again', // READ_REQUEST_EXCEPTION - 430160 => 'donate_interface-try-again', // Unable to authorize ALL_TERMINAL_IDS_FOR_MERCHANT_CURRENCY_IN_USE - 430215 => 'donate_interface-try-again', // Unable to authorize COMMS_FAIL_101 - 430220 => 'donate_interface-try-again', // Unable to authorize COMMS_FAIL_103 - 430225 => 'donate_interface-try-again', // Unable to authorize COMMS_FAIL_111 - 430230 => 'donate_interface-try-again', // Unable to authorize COMMS_FAIL_113 - 430235 => 'donate_interface-try-again', // Unable to authorize COMMS_FAIL_183 - 430240 => 'donate_interface-try-again', // Unable to authorize COMMS_FAIL_601 - 430245 => 'donate_interface-try-again', // Unable to authorize COMMS_FAIL_605 - 430430 => 'donate_interface-try-again', // Unable to authorize TIMEOUT - 430433 => 'donate_interface-try-again', // Unable to authorize TOO_MUCH_USAGE - 430581 => 'donate_interface-try-again', // Not authorized SOFT_DECLINE_BUYER_HAS_ALTERNATE_FUNDING_SOURCE - 485000 => 'donate_interface-try-again', // Unable to authorize NEW_ACCOUNT_INFO_AVAILABLE - 485010 => 'donate_interface-try-again', // Unable to authorize TRY_AGAIN_LATER - 4311130 => 'donate_interface-try-again', // PBS_SERVICE_NOT_AVAILABLE - 4360025 => 'donate_interface-try-again', // ECARD SYSTEM ERROR - 4500600 => 'donate_interface-try-again', // BOKU ERROR - 4500700 => 'donate_interface-try-again', // SUB1 ERROR - 22000045 => 'donate_interface-try-again', // COMMUNICATION ERROR - 9999999999 => 'donate_interface-try-again', // ERROR_IN_PROCESSING_THE_REQUEST - - // Internal messages - 'internal-0000' => 'donate_interface-processing-error', // Failed failed pre-process checks. - 'internal-0001' => 'donate_interface-processing-error', // Transaction could not be processed due to an internal error. - 'internal-0002' => 'donate_interface-processing-error', // Communication failure - 'internal-0003' => 'donate_interface-processing-error', // Toxic card, don't retry on pain of $1000+ fine - - // Do bank validation messages - //'dbv-50' => 'globalcollect_gateway-response-dbv-50', // Account number format incorrect - //'dbv-80' => 'globalcollect_gateway-response-dbv-80', // Account details missing - //'dbv-330' => 'globalcollect_gateway-response-dbv-330', // Check digit format is incorrect - //'dbv-340' => 'globalcollect_gateway-response-dbv-340', // Branch code not submitted - - ); - } - - /** * Setting some GC-specific defaults. * @param array $options These get extracted in the parent. */ diff --git a/paypal_gateway/config/error_map.yaml b/paypal_gateway/config/error_map.yaml new file mode 100644 index 0000000..0101f9f --- /dev/null +++ b/paypal_gateway/config/error_map.yaml @@ -0,0 +1,7 @@ +# Internal messages +# Failed failed pre-process checks. +internal-0000: donate_interface-processing-error +# Transaction could not be processed due to an internal error. +internal-0001: donate_interface-processing-error +# Communication failure +internal-0002: donate_interface-processing-error diff --git a/paypal_gateway/paypal.adapter.php b/paypal_gateway/paypal.adapter.php index b514da9..fc3dee5 100644 --- a/paypal_gateway/paypal.adapter.php +++ b/paypal_gateway/paypal.adapter.php @@ -66,19 +66,6 @@ } function setGatewayDefaults() {} - public function defineErrorMap() { - - $this->error_map = array( - // Internal messages - // Failed failed pre-process checks. - 'internal-0000' => 'donate_interface-processing-error', - // Transaction could not be processed due to an internal error. - 'internal-0001' => 'donate_interface-processing-error', - // Communication failure - 'internal-0002' => 'donate_interface-processing-error', - ); - } - function defineTransactions() { $this->transactions = array(); $this->transactions[ 'Donate' ] = array( diff --git a/worldpay_gateway/config/error_map.yaml b/worldpay_gateway/config/error_map.yaml new file mode 100644 index 0000000..f809889 --- /dev/null +++ b/worldpay_gateway/config/error_map.yaml @@ -0,0 +1,12 @@ +# Well, this is probably going to get annoying as soon as we want to get specific here. +# We can't just use numbers here: We're going to have to break it out by request and number. +# +# Internal messages +# Failed failed pre-process checks. +internal-0000: donate_interface-processing-error +# Transaction could not be processed due to an internal error. +internal-0001: donate_interface-processing-error +# Communication failure +internal-0002: donate_interface-processing-error +# Some error code returned from one of the daisy-chained requests. +internal-0003: donate_interface-processing-error diff --git a/worldpay_gateway/worldpay.adapter.php b/worldpay_gateway/worldpay.adapter.php index c50150a..9333cde 100644 --- a/worldpay_gateway/worldpay.adapter.php +++ b/worldpay_gateway/worldpay.adapter.php @@ -265,18 +265,6 @@ ); } - function defineErrorMap() { - //Well, this is probably going to get annoying as soon as we want to get specific here. - //We can't just use numbers here: We're going to have to break it out by request and number. - $this->error_map = array( - // Internal messages - 'internal-0000' => 'donate_interface-processing-error', // Failed failed pre-process checks. - 'internal-0001' => 'donate_interface-processing-error', // Transaction could not be processed due to an internal error. - 'internal-0002' => 'donate_interface-processing-error', // Communication failure - 'internal-0003' => 'donate_interface-processing-error', // Some error code returned from one of the daisy-chained requests. - ); - } - function defineReturnValueMap() { /* From the integration manual; this is the list of all possible return codes * (excluding the 3000 series which are foreign exchange system errors which we don't use) -- To view, visit https://gerrit.wikimedia.org/r/281081 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie1100666ba669cfeeeb7cc4826118e48bc1db3f7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/DonationInterface Gerrit-Branch: master Gerrit-Owner: Awight <awi...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits