Ejegg has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/358155 )
Change subject: Recover Amazon order IDs when txn captured at console ...................................................................... Recover Amazon order IDs when txn captured at console Bug: T167380 Change-Id: I60408a7029d06945ac9dd69af0ebf0f00695cbdf --- M PaymentProviders/Amazon/Actions/ReconstructMerchantReference.php M PaymentProviders/Amazon/AmazonApi.php M PaymentProviders/Amazon/Audit/SettlementReport.php 3 files changed, 11 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig refs/changes/55/358155/1 diff --git a/PaymentProviders/Amazon/Actions/ReconstructMerchantReference.php b/PaymentProviders/Amazon/Actions/ReconstructMerchantReference.php index 21be498..27ff4df 100644 --- a/PaymentProviders/Amazon/Actions/ReconstructMerchantReference.php +++ b/PaymentProviders/Amazon/Actions/ReconstructMerchantReference.php @@ -18,7 +18,7 @@ return true; } $captureReference = $msg->getOrderId(); - if ( substr( $captureReference, 0, 10 ) !== 'AUTHORIZE_' ) { + if ( !AmazonApi::isAmazonGeneratedMerchantReference( $captureReference ) ) { // We only have to fix Amazon-generated IDs with that prefix return true; } diff --git a/PaymentProviders/Amazon/AmazonApi.php b/PaymentProviders/Amazon/AmazonApi.php index 6e27411..0cd5763 100644 --- a/PaymentProviders/Amazon/AmazonApi.php +++ b/PaymentProviders/Amazon/AmazonApi.php @@ -117,4 +117,8 @@ } return $getDetailsResult['GetOrderReferenceDetailsResult']['OrderReferenceDetails']; } + + public static function isAmazonGeneratedMerchantReference( $reference ) { + return substr( $reference, 0, 10 ) === 'AUTHORIZE_'; + } } diff --git a/PaymentProviders/Amazon/Audit/SettlementReport.php b/PaymentProviders/Amazon/Audit/SettlementReport.php index 9b8f524..991aeb1 100644 --- a/PaymentProviders/Amazon/Audit/SettlementReport.php +++ b/PaymentProviders/Amazon/Audit/SettlementReport.php @@ -4,6 +4,7 @@ use SmashPig\Core\DataFiles\DataFileException; use SmashPig\Core\Logging\Logger; use SmashPig\Core\UtcDate; +use SmashPig\PaymentProviders\Amazon\AmazonApi; /** * Parses off-Amazon payments settlement reports retrieved from MWS @@ -35,7 +36,7 @@ /** * @param HeadedCsvReader $csv - * @throws OutOfBoundsException + * @throws \OutOfBoundsException */ protected function parseLine( HeadedCsvReader $csv ) { $type = $csv->currentCol( 'TransactionType' ); @@ -47,6 +48,10 @@ $msg = array(); $orderId = $csv->currentCol( 'SellerReferenceId' ); + if ( AmazonApi::isAmazonGeneratedMerchantReference( $orderId ) ) { + // If the capture was pushed through via console, it might be here: + $orderId = $csv->currentCol( 'SellerOrderId' ); + } $parts = explode( '-', $orderId ); $msg['contribution_tracking_id'] = $parts[0]; $msg['currency'] = $csv->currentCol( 'CurrencyCode' ); -- To view, visit https://gerrit.wikimedia.org/r/358155 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I60408a7029d06945ac9dd69af0ebf0f00695cbdf Gerrit-PatchSet: 1 Gerrit-Project: wikimedia/fundraising/SmashPig Gerrit-Branch: master Gerrit-Owner: Ejegg <ej...@ejegg.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits