Ejegg has uploaded a new change for review.
https://gerrit.wikimedia.org/r/277240
Change subject: Update SmashPig lib for audit fix
......................................................................
Update SmashPig lib for audit fix
Change-Id: Ie239ade1bfb1868f54b1224999a1299c3b7eb902
---
M composer/LICENSE
M composer/installed.json
M wikimedia/smash-pig/Core/Configuration.php
M wikimedia/smash-pig/Core/DataStores/JsonSerializableObject.php
M wikimedia/smash-pig/Core/Http/RequestHandler.php
M wikimedia/smash-pig/Core/Listeners/ListenerBase.php
M wikimedia/smash-pig/Core/Logging/Logger.php
M wikimedia/smash-pig/CrmLink/Messages/DonationInterfaceAntifraud.php
M wikimedia/smash-pig/CrmLink/Messages/DonationInterfaceMessage.php
M wikimedia/smash-pig/Maintenance/StompJobRunner.php
M wikimedia/smash-pig/Maintenance/TestDatastore.php
M wikimedia/smash-pig/PaymentProviders/Adyen/Actions/CaptureResponseAction.php
M wikimedia/smash-pig/PaymentProviders/Adyen/Actions/PaymentCaptureAction.php
M wikimedia/smash-pig/PaymentProviders/Adyen/AdyenPaymentsAPI.php
M wikimedia/smash-pig/PaymentProviders/Adyen/Audit/AdyenAudit.php
M wikimedia/smash-pig/PaymentProviders/Adyen/ExpatriatedMessages/Capture.php
A wikimedia/smash-pig/PaymentProviders/Adyen/ExpatriatedMessages/Refund.php
M
wikimedia/smash-pig/PaymentProviders/Adyen/ExpatriatedMessages/RefundWithData.php
M
wikimedia/smash-pig/PaymentProviders/Adyen/ExpatriatedMessages/ReportAvailable.php
M wikimedia/smash-pig/PaymentProviders/Adyen/Jobs/DownloadReportJob.php
M wikimedia/smash-pig/PaymentProviders/Adyen/Jobs/ProcessCaptureRequestJob.php
M wikimedia/smash-pig/PaymentProviders/Adyen/Jobs/RecordCaptureJob.php
M wikimedia/smash-pig/PaymentProviders/Amazon/Actions/AddMessageToQueue.php
M wikimedia/smash-pig/PaymentProviders/Amazon/Actions/CloseOrderReference.php
M wikimedia/smash-pig/PaymentProviders/Amazon/AmazonApi.php
M wikimedia/smash-pig/PaymentProviders/Amazon/Audit/ReportDownloader.php
M wikimedia/smash-pig/PaymentProviders/Amazon/Tests/phpunit/ApiTest.php
M wikimedia/smash-pig/PaymentProviders/AstroPay/Actions/IncomingMessage.php
M wikimedia/smash-pig/PaymentProviders/AstroPay/ReferenceData.php
M wikimedia/smash-pig/PaymentProviders/GlobalCollect/Actions/IncomingMessage.php
A wikimedia/smash-pig/Tests/MessageTest.php
M wikimedia/smash-pig/config_defaults.php
M wikimedia/smash-pig/phpunit.xml
33 files changed, 319 insertions(+), 160 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/vendor
refs/changes/40/277240/1
diff --git a/composer/LICENSE b/composer/LICENSE
index c8d57af..1a28124 100644
--- a/composer/LICENSE
+++ b/composer/LICENSE
@@ -1,5 +1,5 @@
-Copyright (c) 2015 Nils Adermann, Jordi Boggiano
+Copyright (c) 2016 Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/composer/installed.json b/composer/installed.json
index 83676a8..7760352 100644
--- a/composer/installed.json
+++ b/composer/installed.json
@@ -841,7 +841,7 @@
"source": {
"type": "git",
"url":
"https://gerrit.wikimedia.org/r/wikimedia/fundraising/SmashPig.git",
- "reference": "c34a5fc3cfbb16d6fb019bea9a3d8d73eeb73f7b"
+ "reference": "8ba1c5bd34982e7f527a60df46a443e0fa00e3fd"
},
"require": {
"amzn/login-and-pay-with-amazon-sdk-php": "dev-master",
@@ -851,7 +851,7 @@
"symfony/event-dispatcher": ">=2.1,<2.4-dev",
"symfony/http-foundation": ">=2.1,<2.4-dev"
},
- "time": "2016-02-19 05:15:23",
+ "time": "2016-03-11 23:11:37",
"type": "library",
"installation-source": "source",
"autoload": {
diff --git a/wikimedia/smash-pig/Core/Configuration.php
b/wikimedia/smash-pig/Core/Configuration.php
index 9f865c1..5a90727 100644
--- a/wikimedia/smash-pig/Core/Configuration.php
+++ b/wikimedia/smash-pig/Core/Configuration.php
@@ -224,7 +224,7 @@
* value is contained under additional keys.
* @param bool $persistent If true the object is saved for future
calls.
*/
- public function &obj( $node, $persistent = true ) {
+ public function &object( $node, $persistent = true ) {
// First look and see if we already have a $persistent object.
if ( array_key_exists( $node, $this->objects ) ) {
return $this->objects[ $node ];
diff --git a/wikimedia/smash-pig/Core/DataStores/JsonSerializableObject.php
b/wikimedia/smash-pig/Core/DataStores/JsonSerializableObject.php
index f4b64f0..3a7736b 100644
--- a/wikimedia/smash-pig/Core/DataStores/JsonSerializableObject.php
+++ b/wikimedia/smash-pig/Core/DataStores/JsonSerializableObject.php
@@ -1,7 +1,5 @@
<?php namespace SmashPig\Core\DataStores;
-use SmashPig\Core\Logging\Logger;
-
/**
* Base class providing generic serialization/deserialization capabilities.
*/
@@ -57,11 +55,10 @@
public function toJson( $resumeUse = true ) {
$this->__sleep();
- $ignore = array_flip( $this->propertiesExcludedFromExport );
$properties = array();
foreach ( get_object_vars( $this ) as $propName => $propValue )
{
- if ( !array_key_exists( $propName, $ignore ) ) {
+ if ( !array_key_exists( $propName,
$this->propertiesExcludedFromExport ) ) {
if ( is_object( $propValue ) ) {
if ( $propValue instanceof
JsonSerializableObject ) {
$properties[ $propName ] =
$propValue->toJson( $resumeUse );
diff --git a/wikimedia/smash-pig/Core/Http/RequestHandler.php
b/wikimedia/smash-pig/Core/Http/RequestHandler.php
index e56d3fa..4dbb0b0 100644
--- a/wikimedia/smash-pig/Core/Http/RequestHandler.php
+++ b/wikimedia/smash-pig/Core/Http/RequestHandler.php
@@ -97,7 +97,7 @@
}
// --- Actually get the endpoint object and start the request
---
- $endpointObj = $config->obj( "endpoints/$action" );
+ $endpointObj = $config->object( "endpoints/$action" );
if ( $endpointObj instanceof IHttpActionHandler ) {
$endpointObj->execute( $request, $response, $parts );
} else {
diff --git a/wikimedia/smash-pig/Core/Listeners/ListenerBase.php
b/wikimedia/smash-pig/Core/Listeners/ListenerBase.php
index fffa26a..a995eb8 100644
--- a/wikimedia/smash-pig/Core/Listeners/ListenerBase.php
+++ b/wikimedia/smash-pig/Core/Listeners/ListenerBase.php
@@ -25,7 +25,7 @@
public function __construct() {
$this->c = Context::get()->getConfiguration();
- $this->inflightStore = $this->c->obj( 'data-store/inflight' );
+ $this->inflightStore = $this->c->object( 'data-store/inflight'
);
}
public function execute( Request $request, Response $response,
$pathParts ) {
diff --git a/wikimedia/smash-pig/Core/Logging/Logger.php
b/wikimedia/smash-pig/Core/Logging/Logger.php
index 155860e..4877053 100644
--- a/wikimedia/smash-pig/Core/Logging/Logger.php
+++ b/wikimedia/smash-pig/Core/Logging/Logger.php
@@ -35,7 +35,7 @@
$streams = $config->val( 'logging/enabled-log-streams'
);
foreach ( $streams as $streamName ) {
- $streamObjs[] = $config->obj(
"logging/log-streams/$streamName", false );
+ $streamObjs[] = $config->object(
"logging/log-streams/$streamName", false );
}
} catch ( \Exception $ex ) {
diff --git
a/wikimedia/smash-pig/CrmLink/Messages/DonationInterfaceAntifraud.php
b/wikimedia/smash-pig/CrmLink/Messages/DonationInterfaceAntifraud.php
index aa836a6..2fdae43 100644
--- a/wikimedia/smash-pig/CrmLink/Messages/DonationInterfaceAntifraud.php
+++ b/wikimedia/smash-pig/CrmLink/Messages/DonationInterfaceAntifraud.php
@@ -20,6 +20,7 @@
public static function factory(
DonationInterfaceMessage $message,
+ $order_id,
$riskScore,
$scoreBreakdown = array(),
$validationAction = 'process' ) {
@@ -33,7 +34,7 @@
$obj->date = $message->date;
$obj->gateway = $message->gateway;
$obj->gateway_txn_id = $message->gateway_txn_id;
- $obj->order_id = $message->order_id;
+ $obj->order_id = $order_id;
$obj->payment_method = $message->payment_method;
// no 'server' available
$obj->user_ip = $message->user_ip;
diff --git a/wikimedia/smash-pig/CrmLink/Messages/DonationInterfaceMessage.php
b/wikimedia/smash-pig/CrmLink/Messages/DonationInterfaceMessage.php
index bf834aa..6db0360 100644
--- a/wikimedia/smash-pig/CrmLink/Messages/DonationInterfaceMessage.php
+++ b/wikimedia/smash-pig/CrmLink/Messages/DonationInterfaceMessage.php
@@ -6,7 +6,6 @@
* Message sent to the 'cc-limbo' queue when a payment has been initiated and
sent off to the gateway.
*/
class DonationInterfaceMessage extends KeyedOpaqueStorableObject {
- public $capture_requested = false;
public $city = '';
public $city_2 = '';
public $comment = '';
diff --git a/wikimedia/smash-pig/Maintenance/StompJobRunner.php
b/wikimedia/smash-pig/Maintenance/StompJobRunner.php
index e17773f..167c237 100644
--- a/wikimedia/smash-pig/Maintenance/StompJobRunner.php
+++ b/wikimedia/smash-pig/Maintenance/StompJobRunner.php
@@ -4,7 +4,7 @@
use SmashPig\Core\Logging\Logger;
use SmashPig\Core\DataStores\StompDataStore;
-use SmashPig\Core\SmashPigException;
+use \Exception;
$maintClass = '\SmashPig\Maintenance\StompJobRunner';
@@ -54,7 +54,7 @@
} else {
Logger::info( "Job tells us
that it did not successfully execute. Sending to damaged message queue." );
}
- } catch ( SmashPigException $ex ) {
+ } catch ( Exception $ex ) {
Logger::error( "Job threw exception.
Sending to damaged message queue.", null, $ex );
}
} else {
diff --git a/wikimedia/smash-pig/Maintenance/TestDatastore.php
b/wikimedia/smash-pig/Maintenance/TestDatastore.php
index c6c992a..6f5c748 100644
--- a/wikimedia/smash-pig/Maintenance/TestDatastore.php
+++ b/wikimedia/smash-pig/Maintenance/TestDatastore.php
@@ -32,7 +32,7 @@
* Do the actual work of the script.
*/
public function execute() {
- $this->datastore = Context::get()->getConfiguration()->obj(
+ $this->datastore = Context::get()->getConfiguration()->object(
'data-store/' . $this->getArgument( 0, 'test' ),
false
);
@@ -51,7 +51,7 @@
shuffle( $this->testObjects );
// Now attempt to find them and their pairs!
- $this->datastore = Context::get()->getConfiguration()->obj(
+ $this->datastore = Context::get()->getConfiguration()->object(
'data-store/' . $this->getArgument( 0, 'test' ),
false
);
diff --git
a/wikimedia/smash-pig/PaymentProviders/Adyen/Actions/CaptureResponseAction.php
b/wikimedia/smash-pig/PaymentProviders/Adyen/Actions/CaptureResponseAction.php
index 7bb40be..404d6b4 100644
---
a/wikimedia/smash-pig/PaymentProviders/Adyen/Actions/CaptureResponseAction.php
+++
b/wikimedia/smash-pig/PaymentProviders/Adyen/Actions/CaptureResponseAction.php
@@ -19,7 +19,7 @@
if ( $msg instanceof Capture ) {
if ( $msg->success ) {
$recordJob = RecordCaptureJob::factory( $msg );
- $jobQueue =
Configuration::getDefaultConfig()->obj( 'data-store/jobs' );
+ $jobQueue =
Configuration::getDefaultConfig()->object( 'data-store/jobs' );
$jobQueue->addObject( $recordJob );
} else {
$tl->warning(
@@ -31,4 +31,4 @@
return true;
}
-}
\ No newline at end of file
+}
diff --git
a/wikimedia/smash-pig/PaymentProviders/Adyen/Actions/PaymentCaptureAction.php
b/wikimedia/smash-pig/PaymentProviders/Adyen/Actions/PaymentCaptureAction.php
index 173be04..088b0df 100644
---
a/wikimedia/smash-pig/PaymentProviders/Adyen/Actions/PaymentCaptureAction.php
+++
b/wikimedia/smash-pig/PaymentProviders/Adyen/Actions/PaymentCaptureAction.php
@@ -23,7 +23,7 @@
$tl->info(
"Adding Adyen capture job for
{$msg->currency} {$msg->amount} with id {$msg->correlationId} and psp reference
{$msg->pspReference}."
);
- $jobQueueObj =
Context::get()->getConfiguration()->obj( 'data-store/jobs' );
+ $jobQueueObj =
Context::get()->getConfiguration()->object( 'data-store/jobs' );
$jobQueueObj->addObject(
ProcessCaptureRequestJob::factory( $msg
)
);
@@ -34,7 +34,7 @@
"Adyen payment with correlation id
{$msg->correlationId} reported status failed: '{$msg->reason}'. Deleting
orphans."
);
$tl->debug( "Deleting all queue objects with
correlation ID '{$msg->correlationId}'" );
- $pendingQueueObj =
Context::get()->getConfiguration()->obj( 'data-store/pending' );
+ $pendingQueueObj =
Context::get()->getConfiguration()->object( 'data-store/pending' );
$pendingQueueObj->removeObjectsById(
$msg->correlationId );
}
}
diff --git a/wikimedia/smash-pig/PaymentProviders/Adyen/AdyenPaymentsAPI.php
b/wikimedia/smash-pig/PaymentProviders/Adyen/AdyenPaymentsAPI.php
index 41c8a1e..a61b43d 100644
--- a/wikimedia/smash-pig/PaymentProviders/Adyen/AdyenPaymentsAPI.php
+++ b/wikimedia/smash-pig/PaymentProviders/Adyen/AdyenPaymentsAPI.php
@@ -63,4 +63,37 @@
return false;
}
}
+
+ /**
+ * Cancels an Adyen authorization
+ *
+ * @param string $pspReference Original pspReference of the request
+ *
+ * @returns bool|string Result will be false on SOAP exception or
remote request denial.
+ * If request was successful the return result will be a pspReference
string to this modification.
+ */
+ public function cancel( $pspReference ) {
+ $data = new WSDL\cancel();
+ $data->modificationRequest = new WSDL\ModificationRequest();
+
+ $data->modificationRequest->merchantAccount = $this->account;
+ $data->modificationRequest->originalReference = $pspReference;
+
+ $tl = new TaggedLogger( 'RawData' );
+ $tl->info( 'Launching SOAP capture request', $data );
+
+ try {
+ $resp = $this->soapClient->cancel( $data );
+ } catch ( \Exception $ex ) {
+ Logger::error( 'SOAP capture request threw exception!',
null, $ex );
+ return false;
+ }
+
+ if ( $resp->captureResult->response == '[cancel-received]' ) {
+ return $resp->captureResult->pspReference;
+ } else {
+ Logger::error( 'SOAP capture request did not work as
expected!', $resp );
+ return false;
+ }
+ }
}
diff --git a/wikimedia/smash-pig/PaymentProviders/Adyen/Audit/AdyenAudit.php
b/wikimedia/smash-pig/PaymentProviders/Adyen/Audit/AdyenAudit.php
index 42f9dda..e2b33f7 100644
--- a/wikimedia/smash-pig/PaymentProviders/Adyen/Audit/AdyenAudit.php
+++ b/wikimedia/smash-pig/PaymentProviders/Adyen/Audit/AdyenAudit.php
@@ -17,24 +17,24 @@
protected $ignoredStatuses;
protected $fileData = array();
protected static $ignoredTypes = array(
- 'Fee',
- 'MiscCosts',
- 'MerchantPayout',
- 'ChargebackReversed', // oh hey, we could try to handle these
- 'RefundedReversed',
- 'DepositCorrection',
- 'InvoiceDeduction',
- 'MatchedStatement',
- 'ManualCorrected',
- 'AuthorisationSchemeFee',
- 'BankInstructionReturned',
- 'InternalCompanyPayout',
- 'EpaPaid',
- 'BalanceTransfer',
- 'PaymentCost',
- 'SettleCost',
- 'PaidOut',
- 'PaidOutReversed',
+ 'fee',
+ 'misccosts',
+ 'merchantpayout',
+ 'chargebackreversed', // oh hey, we could try to handle these
+ 'refundedreversed',
+ 'depositcorrection',
+ 'invoicededuction',
+ 'matchedstatement',
+ 'manualcorrected',
+ 'authorisationschemefee',
+ 'bankinstructionreturned',
+ 'internalcompanypayout',
+ 'epapaid',
+ 'balancetransfer',
+ 'paymentcost',
+ 'settlecost',
+ 'paidout',
+ 'paidoutreversed',
);
public function __construct() {
@@ -97,7 +97,7 @@
protected function parseLine( $line ) {
$row = array_combine( $this->columnHeaders, $line );
- $type = $row['Type'];
+ $type = strtolower( $row['Type'] );
if ( in_array( $type, self::$ignoredTypes ) ) {
return;
}
@@ -111,11 +111,11 @@
$msg['contribution_tracking_id'] = $parts[0];
switch( $type ) {
- case 'Settled':
+ case 'settled':
$this->parseDonation( $row, $msg );
break;
- case 'Chargeback':
- case 'Refunded':
+ case 'chargeback':
+ case 'refunded':
$this->parseRefund( $row, $msg );
break;
default:
@@ -134,7 +134,7 @@
$msg['gateway_parent_id'] = $row['Psp Reference'];
$msg['gateway_refund_id'] = $row['Modification Reference'];
- if ( $row['Type'] === 'Chargeback' ) {
+ if ( strtolower( $row['Type'] ) === 'chargeback' ) {
$msg['type'] = 'chargeback';
} else {
$msg['type'] = 'refund';
diff --git
a/wikimedia/smash-pig/PaymentProviders/Adyen/ExpatriatedMessages/Capture.php
b/wikimedia/smash-pig/PaymentProviders/Adyen/ExpatriatedMessages/Capture.php
index eb25a7a..43c2afd 100644
--- a/wikimedia/smash-pig/PaymentProviders/Adyen/ExpatriatedMessages/Capture.php
+++ b/wikimedia/smash-pig/PaymentProviders/Adyen/ExpatriatedMessages/Capture.php
@@ -1,6 +1,7 @@
<?php namespace SmashPig\PaymentProviders\Adyen\ExpatriatedMessages;
use SmashPig\PaymentProviders\Adyen\Actions\CaptureResponseAction;
+use SmashPig\PaymentProviders\Adyen\WSDL\NotificationRequestItem;
/**
* An Adyen Capture message is sent from the server to SmashPig after
@@ -16,6 +17,24 @@
class Capture extends AdyenMessage {
/**
+ * @var string the reference for this capture's original payment
authorization
+ */
+ public $originalReference;
+
+ /**
+ * Overloads the generic Adyen method adding fields specific to the
Capture message
+ * type.
+ *
+ * @param \SmashPig\PaymentProviders\Adyen\WSDL\NotificationRequestItem
$msgObj
+ */
+ protected function constructFromWSDL( NotificationRequestItem $msgObj )
+ {
+ parent::constructFromWSDL($msgObj);
+
+ $this->originalReference = $msgObj->originalReference;
+ }
+
+ /**
* Will run all the actions that are loaded (from the 'actions'
configuration
* node) and that are applicable to this message type. Will return true
* if all actions returned true. Otherwise will return false. This
implicitly
diff --git
a/wikimedia/smash-pig/PaymentProviders/Adyen/ExpatriatedMessages/Refund.php
b/wikimedia/smash-pig/PaymentProviders/Adyen/ExpatriatedMessages/Refund.php
new file mode 100644
index 0000000..cccc412
--- /dev/null
+++ b/wikimedia/smash-pig/PaymentProviders/Adyen/ExpatriatedMessages/Refund.php
@@ -0,0 +1,26 @@
+<?php namespace SmashPig\PaymentProviders\Adyen\ExpatriatedMessages;
+
+use SmashPig\PaymentProviders\Adyen\Actions\RefundInitiatedAction;
+
+class Refund extends AdyenMessage {
+
+ /**
+ * Will run all the actions that are loaded (from the 'actions'
configuration
+ * node) and that are applicable to this message type. Will return true
+ * if all actions returned true. Otherwise will return false. This
implicitly
+ * means that the message will be re-queued if any action fails.
Therefore
+ * all actions need to be idempotent.
+ *
+ * @returns bool True if all actions were successful. False otherwise.
+ */
+ public function runActionChain() {
+ $action = new RefundInitiatedAction();
+ $result = $action->execute( $this );
+
+ if ( $result === true ) {
+ return parent::runActionChain();
+ } else {
+ return false;
+ }
+ }
+}
diff --git
a/wikimedia/smash-pig/PaymentProviders/Adyen/ExpatriatedMessages/RefundWithData.php
b/wikimedia/smash-pig/PaymentProviders/Adyen/ExpatriatedMessages/RefundWithData.php
index db9f3ff..84bca9e 100644
---
a/wikimedia/smash-pig/PaymentProviders/Adyen/ExpatriatedMessages/RefundWithData.php
+++
b/wikimedia/smash-pig/PaymentProviders/Adyen/ExpatriatedMessages/RefundWithData.php
@@ -1,26 +1,5 @@
<?php namespace SmashPig\PaymentProviders\Adyen\ExpatriatedMessages;
-use SmashPig\PaymentProviders\Adyen\Actions\RefundInitiatedAction;
+class RefundWithData extends Refund {
-class RefundWithData extends AdyenMessage {
-
- /**
- * Will run all the actions that are loaded (from the 'actions'
configuration
- * node) and that are applicable to this message type. Will return true
- * if all actions returned true. Otherwise will return false. This
implicitly
- * means that the message will be re-queued if any action fails.
Therefore
- * all actions need to be idempotent.
- *
- * @returns bool True if all actions were successful. False otherwise.
- */
- public function runActionChain() {
- $action = new RefundInitiatedAction();
- $result = $action->execute( $this );
-
- if ( $result === true ) {
- return parent::runActionChain();
- } else {
- return false;
- }
- }
}
diff --git
a/wikimedia/smash-pig/PaymentProviders/Adyen/ExpatriatedMessages/ReportAvailable.php
b/wikimedia/smash-pig/PaymentProviders/Adyen/ExpatriatedMessages/ReportAvailable.php
index d9996e4..4c4f2d6 100644
---
a/wikimedia/smash-pig/PaymentProviders/Adyen/ExpatriatedMessages/ReportAvailable.php
+++
b/wikimedia/smash-pig/PaymentProviders/Adyen/ExpatriatedMessages/ReportAvailable.php
@@ -20,7 +20,7 @@
$this->reason
);
- $jobQueueObj = Context::get()->getConfiguration()->obj(
'data-store/jobs' );
+ $jobQueueObj = Context::get()->getConfiguration()->object(
'data-store/jobs' );
if ( strpos( $this->pspReference, 'settlement_detail_report' )
=== 0 ) {
$jobQueueObj->addObject(
DownloadReportJob::factory(
diff --git
a/wikimedia/smash-pig/PaymentProviders/Adyen/Jobs/DownloadReportJob.php
b/wikimedia/smash-pig/PaymentProviders/Adyen/Jobs/DownloadReportJob.php
index 2f566c1..afc33fe 100644
--- a/wikimedia/smash-pig/PaymentProviders/Adyen/Jobs/DownloadReportJob.php
+++ b/wikimedia/smash-pig/PaymentProviders/Adyen/Jobs/DownloadReportJob.php
@@ -21,6 +21,7 @@
protected $reportUrl;
protected $downloadLoc;
+ protected $propertiesExcludedFromExport = array( 'logger' );
public static function factory( $account, $url ) {
$obj = new DownloadReportJob();
@@ -80,5 +81,6 @@
$this->logger->error( "Report downloaded(?), but with
incorrect HTTP code: {$httpCode}" );
throw new SmashPigException( "Could not download
report." );
}
+ return true;
}
}
diff --git
a/wikimedia/smash-pig/PaymentProviders/Adyen/Jobs/ProcessCaptureRequestJob.php
b/wikimedia/smash-pig/PaymentProviders/Adyen/Jobs/ProcessCaptureRequestJob.php
index a054d25..8e1c4f9 100644
---
a/wikimedia/smash-pig/PaymentProviders/Adyen/Jobs/ProcessCaptureRequestJob.php
+++
b/wikimedia/smash-pig/PaymentProviders/Adyen/Jobs/ProcessCaptureRequestJob.php
@@ -21,9 +21,15 @@
protected $account;
protected $currency;
protected $amount;
+ protected $merchantReference;
protected $pspReference;
protected $avsResult;
protected $cvvResult;
+ // Actions to take after examining capture request and queue message
+ const ACTION_IGNORE = 'ignore'; // no donor info or auth already
captured, do nothing
+ const ACTION_PROCESS = 'process'; // all clear to capture payment
+ const ACTION_REJECT = 'reject'; // very likely fraud - cancel the
authorization
+ const ACTION_REVIEW = 'review'; // potential fraud - do not capture now
public static function factory( Authorisation $authMessage ) {
$obj = new ProcessCaptureRequestJob();
@@ -32,6 +38,7 @@
$obj->account = $authMessage->merchantAccountCode;
$obj->currency = $authMessage->currency;
$obj->amount = $authMessage->amount;
+ $obj->merchantReference = $authMessage->merchantReference;
$obj->pspReference = $authMessage->pspReference;
$obj->cvvResult = $authMessage->cvvResult;
$obj->avsResult = $authMessage->avsResult;
@@ -42,36 +49,35 @@
public function execute() {
Logger::enterContext( "corr_id-{$this->correlationId}" );
Logger::info(
- "Attempting to capture payment on account
'{$this->account}' with reference '{$this->pspReference}' " .
+ "Running capture request job on account
'{$this->account}' with reference '{$this->pspReference}' " .
"and correlation id '{$this->correlationId}'."
);
// Determine if a message exists in the pending queue; if it
does not then
- // this payment has already been sent to the verified queue. If
it does,
- // we need to check $capture_requested in case we have
requested a capture
- // but have not yet received notification of capture success.
- Logger::debug( 'Attempting to locate associated message in
pending queue' );
- $pendingQueue = Configuration::getDefaultConfig()->obj(
'data-store/pending' );
+ // this payment has already been sent to the verified queue.
+ Logger::debug( 'Attempting to locate associated message in
pending queue.' );
+ $pendingQueue = Configuration::getDefaultConfig()->object(
'data-store/pending' );
$queueMessage = $pendingQueue->queueGetObject( null,
$this->correlationId );
$success = true;
- if ( $this->shouldCapture( $queueMessage ) ) {
+ $action = $this->determineAction( $queueMessage );
+ if ( $action == self::ACTION_PROCESS ) {
+ // Tell the pending queue to keep the message around
for the RecordCaptureJob
+ $pendingQueue->queueIgnoreObject();
+
// Attempt to capture the payment
$api = new AdyenPaymentsAPI( $this->account );
+ Logger::info(
+ "Attempting capture API call for currency
'{$this->currency}', " .
+ "amount '{$this->amount}', reference
'{$this->pspReference}'."
+ );
$captureResult = $api->capture( $this->currency,
$this->amount, $this->pspReference );
if ( $captureResult ) {
// Success!
Logger::info(
"Successfully captured payment!
Returned reference: '{$captureResult}'. " .
- 'Will requeue message as
processed.');
- // Remove it from the pending queue
- $pendingQueue->queueAckObject();
- $pendingQueue->removeObjectsById(
$this->correlationId );
- // Indicate that it has been captured and
re-queue it for use
- // when the capture IPN message comes in.
- $queueMessage->capture_requested = true;
- $pendingQueue->addObj( $queueMessage );
+ 'Leaving pending message in
queue for record capture job.');
} else {
// Some kind of error in the request. We should
keep the pending
// message, complain loudly, and move this
capture job to the
@@ -83,61 +89,77 @@
);
$success = false;
}
+ } else if ( $action == self::ACTION_REJECT ) {
+ Logger::debug( "Cancelling authorization with reference
'{$this->pspReference}'" );
+ $api = new AdyenPaymentsAPI( $this->account );
+ $result = $api->cancel( $this->pspReference );
+ if ( $result ) {
+ Logger::debug( "Successfully cancelled
authorization" );
+ } else {
+ // Not a big deal
+ Logger::warning( "Failed to cancel
authorization, it will remain in the payment console" );
+ }
+ // Delete the queue message whatever happened
+ $pendingQueue->queueAckObject();
+ $pendingQueue->removeObjectsById( $this->correlationId
);
}
Logger::leaveContext();
return $success;
}
- protected function shouldCapture( $queueMessage ) {
+ protected function determineAction( $queueMessage ) {
if ( $queueMessage && ( $queueMessage instanceof
DonationInterfaceMessage ) ) {
- Logger::debug( 'A valid message was obtained from the
pending queue' );
+ Logger::debug( 'A valid message was obtained from the
pending queue.' );
} else {
Logger::warning(
"Could not find a processable message for PSP
Reference '{$this->pspReference}' and correlation ".
"ID '{$this->correlationId}'.",
$queueMessage
);
- return false;
+ return self::ACTION_IGNORE;
}
- if ( $queueMessage->capture_requested ) {
- Logger::warning(
- "Duplicate capture job for PSP Reference
'{$this->pspReference}' and correlation ".
- "ID '{$this->correlationId}'.",
- $queueMessage
- );
- return false;
- }
- return $this->checkRiskScores( $queueMessage );
+ return $this->getRiskAction( $queueMessage );
}
- protected function checkRiskScores( DonationInterfaceMessage
$queueMessage ) {
+ protected function getRiskAction( DonationInterfaceMessage
$queueMessage ) {
$config = Configuration::getDefaultConfig();
$riskScore = $queueMessage->risk_score ?
$queueMessage->risk_score : 0;
- Logger::debug( "Base risk score from payments site is
$riskScore." );
+ Logger::debug( "Base risk score from payments site is
$riskScore, " .
+ "raw CVV result is '{$this->cvvResult}' and raw AVS
result is '{$this->avsResult}'." );
$cvvMap = $config->val( 'fraud-filters/cvv-map' );
$avsMap = $config->val( 'fraud-filters/avs-map' );
$scoreBreakdown = array();
if ( array_key_exists( $this->cvvResult, $cvvMap ) ) {
$scoreBreakdown['getCVVResult'] = $cvvScore =
$cvvMap[$this->cvvResult];
- Logger::debug( "CVV result {$this->cvvResult} adds risk
score $cvvScore." );
+ Logger::debug( "CVV result '{$this->cvvResult}' adds
risk score $cvvScore." );
$riskScore += $cvvScore;
+ } else {
+ Logger::warning( "CVV result '{$this->cvvResult}' not
found in cvv-map.", $cvvMap );
}
if ( array_key_exists( $this->avsResult, $avsMap ) ) {
$scoreBreakdown['getAVSResult'] = $avsScore =
$avsMap[$this->avsResult];
- Logger::debug( "AVS result {$this->avsResult} adds risk
score $avsScore." );
+ Logger::debug( "AVS result '{$this->avsResult}' adds
risk score $avsScore." );
$riskScore += $avsScore;
+ } else {
+ Logger::warning( "AVS result '{$this->avsResult}' not
found in avs-map.", $avsMap );
}
- $shouldCapture = ( $riskScore < $config->val(
'fraud-filters/risk-threshold' ) );
- $this->sendAntifraudMessage( $queueMessage, $riskScore,
$scoreBreakdown, $shouldCapture );
- return $shouldCapture;
+ $action = self::ACTION_PROCESS;
+ if ( $riskScore >= $config->val(
'fraud-filters/review-threshold' ) ) {
+ $action = self::ACTION_REVIEW;
+ }
+ if ( $riskScore >= $config->val(
'fraud-filters/reject-threshold' ) ) {
+ $action = self::ACTION_REJECT;
+ }
+ $this->sendAntifraudMessage( $queueMessage, $riskScore,
$scoreBreakdown, $action );
+ return $action;
}
- protected function sendAntifraudMessage( $queueMessage, $riskScore,
$scoreBreakdown, $shouldCapture ) {
- $action = $shouldCapture ? 'process' : 'review';
+ protected function sendAntifraudMessage( $queueMessage, $riskScore,
$scoreBreakdown, $action ) {
$antifraudMessage = DonationInterfaceAntifraud::factory(
- $queueMessage, $riskScore, $scoreBreakdown, $action
+ $queueMessage, $this->merchantReference, $riskScore,
$scoreBreakdown, $action
);
- Configuration::getDefaultConfig()->obj( 'data-store/antifraud'
)->addObj( $antifraudMessage );
+ Logger::debug( "Sending antifraud message with risk score
$riskScore and action $action." );
+ Configuration::getDefaultConfig()->object(
'data-store/antifraud' )->addObject( $antifraudMessage );
}
}
diff --git
a/wikimedia/smash-pig/PaymentProviders/Adyen/Jobs/RecordCaptureJob.php
b/wikimedia/smash-pig/PaymentProviders/Adyen/Jobs/RecordCaptureJob.php
index f99bce4..d2eb544 100644
--- a/wikimedia/smash-pig/PaymentProviders/Adyen/Jobs/RecordCaptureJob.php
+++ b/wikimedia/smash-pig/PaymentProviders/Adyen/Jobs/RecordCaptureJob.php
@@ -7,8 +7,8 @@
use SmashPig\PaymentProviders\Adyen\ExpatriatedMessages\Capture;
/**
- * Job that merges capture IPN calls from Adyen with a pending message in the
- * queue and then places that into the verified queue.
+ * Job that merges a capture IPN message from Adyen with donor info from the
+ * pending queue, then places that into the verified queue.
*
* Class RecordCaptureJob
*
@@ -19,7 +19,7 @@
protected $account;
protected $currency;
protected $amount;
- protected $pspReference;
+ protected $originalReference;
public static function factory( Capture $captureMessage ) {
$obj = new RecordCaptureJob();
@@ -28,7 +28,7 @@
$obj->account = $captureMessage->merchantAccountCode;
$obj->currency = $captureMessage->currency;
$obj->amount = $captureMessage->amount;
- $obj->pspReference = $captureMessage->pspReference;
+ $obj->originalReference = $captureMessage->originalReference;
return $obj;
}
@@ -36,22 +36,22 @@
public function execute() {
Logger::enterContext( "corr_id-{$this->correlationId}" );
Logger::info(
- "Recording successful capture on account
'{$this->account}' with reference '{$this->pspReference}' " .
- "and correlation id '{$this->correlationId}'."
+ "Recording successful capture on account
'{$this->account}' with authorization reference " .
+ "'{$this->originalReference}' and correlation
id '{$this->correlationId}'."
);
$config = Configuration::getDefaultConfig();
// Find the details from the payment site in the pending queue.
Logger::debug( 'Attempting to locate associated message in
pending queue' );
- $pendingQueue = $config->obj( 'data-store/pending' );
+ $pendingQueue = $config->object( 'data-store/pending' );
$queueMessage = $pendingQueue->queueGetObject( null,
$this->correlationId );
if ( $queueMessage && ( $queueMessage instanceof
DonationInterfaceMessage ) ) {
Logger::debug( 'A valid message was obtained from the
pending queue' );
// Add the gateway transaction ID and send it to the
completed queue
- $queueMessage->gateway_txn_id = $this->pspReference;
- $config->obj( 'data-store/verified' )->addObject(
$queueMessage );
+ $queueMessage->gateway_txn_id =
$this->originalReference;
+ $config->object( 'data-store/verified' )->addObject(
$queueMessage );
// Remove it from the pending queue
Logger::debug( "Removing all references to donation in
pending queue" );
@@ -60,8 +60,8 @@
} else {
Logger::error(
- "Could not find a processable message for PSP
Reference '{$this->pspReference}' and correlation ".
- "ID '{$this->correlationId}'.",
+ "Could not find a processable message for
authorization Reference '{$this->originalReference}' " .
+ "and correlation ID
'{$this->correlationId}'.",
$queueMessage
);
}
diff --git
a/wikimedia/smash-pig/PaymentProviders/Amazon/Actions/AddMessageToQueue.php
b/wikimedia/smash-pig/PaymentProviders/Amazon/Actions/AddMessageToQueue.php
index 697934e..f392324 100644
--- a/wikimedia/smash-pig/PaymentProviders/Amazon/Actions/AddMessageToQueue.php
+++ b/wikimedia/smash-pig/PaymentProviders/Amazon/Actions/AddMessageToQueue.php
@@ -11,7 +11,7 @@
$destinationQueue = $msg->getDestinationQueue();
if ( $destinationQueue ) {
- $queue = Context::get()->getConfiguration()->obj(
"data-store/{$destinationQueue}" );
+ $queue = Context::get()->getConfiguration()->object(
"data-store/{$destinationQueue}" );
$queueMsg = $msg->normalizeForQueue();
$queue->addObject( $queueMsg );
diff --git
a/wikimedia/smash-pig/PaymentProviders/Amazon/Actions/CloseOrderReference.php
b/wikimedia/smash-pig/PaymentProviders/Amazon/Actions/CloseOrderReference.php
index 1eecdb0..34acd0e 100644
---
a/wikimedia/smash-pig/PaymentProviders/Amazon/Actions/CloseOrderReference.php
+++
b/wikimedia/smash-pig/PaymentProviders/Amazon/Actions/CloseOrderReference.php
@@ -15,7 +15,7 @@
}
$config = Context::get()->getConfiguration();
- $client = $config->obj( 'payments-client', true );
+ $client = $config->object( 'payments-client', true );
$captureId = $msg->getGatewayTransactionId();
$orderReferenceId = substr( $captureId, 0, 19 );
diff --git a/wikimedia/smash-pig/PaymentProviders/Amazon/AmazonApi.php
b/wikimedia/smash-pig/PaymentProviders/Amazon/AmazonApi.php
index 10bbc38..e7411b3 100644
--- a/wikimedia/smash-pig/PaymentProviders/Amazon/AmazonApi.php
+++ b/wikimedia/smash-pig/PaymentProviders/Amazon/AmazonApi.php
@@ -16,7 +16,7 @@
public static function findRefundParentId( $refundId ) {
$config = Context::get()->getConfiguration();
- $client = $config->obj( 'payments-client', true );
+ $client = $config->object( 'payments-client', true );
// The order reference ID is the first 19 characters of the
refund ID
$orderReferenceId = substr( $refundId, 0, 19 );
diff --git
a/wikimedia/smash-pig/PaymentProviders/Amazon/Audit/ReportDownloader.php
b/wikimedia/smash-pig/PaymentProviders/Amazon/Audit/ReportDownloader.php
index d4459b0..62eebe4 100644
--- a/wikimedia/smash-pig/PaymentProviders/Amazon/Audit/ReportDownloader.php
+++ b/wikimedia/smash-pig/PaymentProviders/Amazon/Audit/ReportDownloader.php
@@ -55,7 +55,7 @@
$this->ensureAndScanFolder( $this->downloadPath );
$this->reportsClient =
- Context::get()->getConfiguration()->obj(
'reports-client', true );
+ Context::get()->getConfiguration()->object(
'reports-client', true );
Logger::info( 'Getting report list' );
$startDate = new DateTime( "-{$this->days} days", new
DateTimeZone( 'UTC' ) );
@@ -84,7 +84,7 @@
$reportInfo['ReportType']
);
if ( array_search( $id, $this->downloadedIds ) === false ) {
- Logger::debug( "Downloading report with id: $id" );
+ Logger::debug( "Downloading report dated
{$reportInfo['AvailableDate']} with id: $id" );
$report = $this->reportsClient->getReport( array(
'report_id' => $id,
) );
diff --git
a/wikimedia/smash-pig/PaymentProviders/Amazon/Tests/phpunit/ApiTest.php
b/wikimedia/smash-pig/PaymentProviders/Amazon/Tests/phpunit/ApiTest.php
index 948f08d..9f908f1 100644
--- a/wikimedia/smash-pig/PaymentProviders/Amazon/Tests/phpunit/ApiTest.php
+++ b/wikimedia/smash-pig/PaymentProviders/Amazon/Tests/phpunit/ApiTest.php
@@ -17,7 +17,7 @@
true
);
Context::init( $config );
- $this->mockClient = Context::get()->getConfiguration()->obj(
'payments-client', true );
+ $this->mockClient = Context::get()->getConfiguration()->object(
'payments-client', true );
$this->mockClient->calls = array();
$this->mockClient->returns = array();
$this->mockClient->exceptions = array();
diff --git
a/wikimedia/smash-pig/PaymentProviders/AstroPay/Actions/IncomingMessage.php
b/wikimedia/smash-pig/PaymentProviders/AstroPay/Actions/IncomingMessage.php
index 9e18a67..d181627 100644
--- a/wikimedia/smash-pig/PaymentProviders/AstroPay/Actions/IncomingMessage.php
+++ b/wikimedia/smash-pig/PaymentProviders/AstroPay/Actions/IncomingMessage.php
@@ -11,7 +11,7 @@
$destinationQueue = $msg->getDestinationQueue();
if ( $destinationQueue ) {
- $queue = Context::get()->getConfiguration()->obj(
"data-store/{$destinationQueue}" );
+ $queue = Context::get()->getConfiguration()->object(
"data-store/{$destinationQueue}" );
$queueMsg = $msg->normalizeForQueue();
$queue->addObject( $queueMsg );
diff --git a/wikimedia/smash-pig/PaymentProviders/AstroPay/ReferenceData.php
b/wikimedia/smash-pig/PaymentProviders/AstroPay/ReferenceData.php
index 6c67089..6231ea5 100644
--- a/wikimedia/smash-pig/PaymentProviders/AstroPay/ReferenceData.php
+++ b/wikimedia/smash-pig/PaymentProviders/AstroPay/ReferenceData.php
@@ -7,43 +7,60 @@
$submethods = array(
'AG' => 'argen',
'AE' => 'amex',
+ 'AU' => 'aura',
'B' => 'bradesco',
'BB' => 'banco_do_brasil',
- 'BL' => 'boleto',
- 'BM' => 'banamex',
- 'BP' => 'bbva',
- 'BV' => 'bbva', // Mexico, aka Bancomer
+ 'BG' => 'cash_provencia_pagos',
+ 'BL' => 'cash_boleto',
+ 'BM' => 'cash_banamex',
+ 'BP' => 'bbva', // Peru, bank transfer
+ 'BV' => 'cash_bancomer', // Mexico, aka BBVA
'BX' => 'banco_de_chile',
'CA' => 'caixa',
+ 'CB' => 'baloto',
'CL' => 'cabal',
+ 'CM' => 'cmr',
+ 'CR' => 'carulla',
'CS' => 'cencosud',
- 'DA' => 'davivienda',
- 'DC' => 'dc',
- 'DM' => 'dineromail',
- 'EF' => 'pago_efectivo',
+ 'DA' => 'cash_davivienda',
+ 'DC' => 'diners',
+ 'DD' => 'dineromail', // (Transfer)
+ 'DM' => 'cash_dineromail', // (Cash)
+ 'DS' => 'discover',
+ 'EF' => 'cash_pago_efectivo',
'EL' => 'elo',
- 'EY' => 'efecty',
+ 'EQ' => 'quindio',
+ 'EX' => 'almancenes',
+ 'EY' => 'cash_efecty',
'H' => 'hsbc',
'HI' => 'hiper',
'I' => 'itau',
'IB' => 'interbank',
+ 'JC' => 'jcb',
'MC' => 'mc',
- 'MD' => 'mc_debit',
+ 'MD' => 'mc-debit',
+ 'MG' => 'magna',
'ML' => 'mercadolivre',
'NJ' => 'naranja',
'NT' => 'nativa',
- 'OX' => 'oxxo',
+ 'OC' => 'banco_de_occidente',
+ 'OX' => 'cash_oxxo',
'PA' => 'bcp', // Peru, "via LatinAmericanPayments"
'PC' => 'pse', // Columbia, "all banks"
- 'PF' => 'pago_facil',
- 'RP' => 'rapipago',
+ 'PF' => 'cash_pago_facil',
+ 'PR' => 'presto',
+ 'RE' => 'cash_red_pagos',
+ 'RL' => 'red_link',
+ 'RP' => 'cash_rapipago',
'SB' => 'santander', // Brazil
- 'SI' => 'santander', // Argentina
- 'SM' => 'santander', // Mexico
- 'TS' => 'tarjeta_shopping',
- 'VD' => 'visa_debit',
+ 'SI' => 'santander_rio', // Argentina
+ 'SM' => 'cash_santander', // Mexico
+ 'SP' => 'servipag',
+ 'SX' => 'surtimax',
+ 'TS' => 'shopping',
+ 'VD' => 'visa-debit',
'VI' => 'visa',
- 'WP' => 'other', // Chilean catch-all
+ 'WP' => 'webpay',
);
if ( array_key_exists( $code, $submethods ) ) {
diff --git
a/wikimedia/smash-pig/PaymentProviders/GlobalCollect/Actions/IncomingMessage.php
b/wikimedia/smash-pig/PaymentProviders/GlobalCollect/Actions/IncomingMessage.php
index 6aa9885..8637c3f 100644
---
a/wikimedia/smash-pig/PaymentProviders/GlobalCollect/Actions/IncomingMessage.php
+++
b/wikimedia/smash-pig/PaymentProviders/GlobalCollect/Actions/IncomingMessage.php
@@ -10,7 +10,7 @@
$destinationQueue = $msg->getDestinationQueue();
if ( $destinationQueue ) {
- $queue = Context::get()->getConfiguration()->obj(
"data-store/{$destinationQueue}" );
+ $queue = Context::get()->getConfiguration()->object(
"data-store/{$destinationQueue}" );
$queueMsg = $msg->normalizeForQueue();
$queue->addObject( $queueMsg );
diff --git a/wikimedia/smash-pig/Tests/MessageTest.php
b/wikimedia/smash-pig/Tests/MessageTest.php
new file mode 100644
index 0000000..a88b836
--- /dev/null
+++ b/wikimedia/smash-pig/Tests/MessageTest.php
@@ -0,0 +1,39 @@
+<?php
+use SmashPig\CrmLink\Messages\DonationInterfaceMessage;
+use SmashPig\CrmLink\Messages\DonationInterfaceAntifraud;
+
+/**
+ * Test CrmLink message functions
+ */
+class MessageTest extends \BaseSmashPigUnitTestCase {
+
+ public function testAntifraudFactory() {
+ $diMessage = new DonationInterfaceMessage();
+ $diMessage->contribution_tracking_id = mt_rand(0,1000000);
+ $diMessage->date = 1455128736;
+ $diMessage->gateway = 'adyen';
+ $diMessage->gateway_txn_id = mt_rand(0,10000000);
+ $diMessage->payment_method = 'cc';
+ $diMessage->user_ip = '8.8.4.4';
+
+ $orderId = $diMessage->contribution_tracking_id . '.0';
+ $scoreBreakdown = array(
+ 'getScoreCountry' => 25,
+ 'getScoreEmailDomain' => 10,
+ );
+ $afMessage = DonationInterfaceAntifraud::factory(
+ $diMessage, $orderId, 12.5, $scoreBreakdown, 'process'
+ );
+
+ $this->assertEquals($diMessage->contribution_tracking_id,
$afMessage->contribution_tracking_id);
+ $this->assertEquals(1455128736, $afMessage->date);
+ $this->assertEquals('adyen', $afMessage->gateway);
+ $this->assertEquals($diMessage->gateway_txn_id,
$afMessage->gateway_txn_id);
+ $this->assertEquals($orderId, $afMessage->order_id);
+ $this->assertEquals('cc', $afMessage->payment_method);
+ $this->assertEquals(12.5, $afMessage->risk_score);
+ $this->assertEquals($scoreBreakdown,
$afMessage->score_breakdown);
+ $this->assertEquals('8.8.4.4', $afMessage->user_ip);
+ $this->assertEquals('process', $afMessage->validation_action);
+ }
+}
diff --git a/wikimedia/smash-pig/config_defaults.php
b/wikimedia/smash-pig/config_defaults.php
index 841294a..d21c326 100644
--- a/wikimedia/smash-pig/config_defaults.php
+++ b/wikimedia/smash-pig/config_defaults.php
@@ -143,7 +143,10 @@
),
'fraud-filters' => array(
- 'risk-threshold' => 75,
+ // Automatically capture authorizations under this score
+ 'review-threshold' => 75,
+ // Automatically cancel authorizations with at least
this score
+ 'reject-threshold' => 100,
/**
* Authorization notifications include AVS and CVV
result codes.
* The following maps set a risk score for each result
code, which
@@ -152,23 +155,42 @@
*
https://docs.adyen.com/manuals/api-manual/payment-responses/additionaldata-payment-responses
*/
'avs-map' => array(
- '0' => 100,
- '1' => 75,
- '2' => 100,
- '3' => 50,
- '4' => 50,
- '5' => 50,
- '6' => 75,
- '7' => 0,
- ),
- 'cvv-map' => array(
- '0' => 100,
- '1' => 0,
- '2' => 100,
- '3' => 50,
- '4' => 100,
- '5' => 50,
- '6' => 50,
+ '0' => 100, // Unknown
+ '1' => 75, // Address matches, postal code
doesn't
+ '2' => 100, // Neither postal code nor address
match
+ '3' => 50, // AVS unavailable
+ '4' => 50, // AVS not supported for this card
type
+ '5' => 50, // No AVS data provided
+ '6' => 75, // Postal code matches, address
doesn't match
+ '7' => 0, // Both postal code and address match
+ '8' => 50, // Address not checked, postal code
unknown
+ '9' => 25, // Address matches, postal code
unknown
+ '10' => 50, // Address doesn't match, postal
code unknown
+ '11' => 75, // Postal code not checked, address
unknown
+ '12' => 50, // Address matches, postal code not
checked
+ '13' => 0, // Address doesn't match, postal
code not checked
+ '14' => 50, // Postal code matches, address
unknown
+ '15' => 50, // Postal code matches, address not
checked
+ '16' => 75, // Postal code doesn't match,
address unknown
+ '17' => 100, // Postal code doesn't match,
address not checked
+ '18' => 25, // Neither postal code nor address
were checked
+ '19' => 0, // Name and postal code matches
+ '20' => 0, // Name, address and postal code
matches
+ '21' => 0, // Name and address matches
+ '22' => 50, // Name matches
+ '23' => 50, // Postal code matches, name
doesn't match
+ '24' => 25, // Both postal code and address
matches, name doesn't match
+ '25' => 50, // Address matches, name doesn't
match
+ '26' => 100, // Neither postal code, address
nor name matches
+ ),
+ 'cvv-map' => array(
+ '0' => 100, // Unknown
+ '1' => 0, // Matches
+ '2' => 100, // Doesn't match
+ '3' => 50, // Not checked
+ '4' => 100, // No CVC/CVV provided, but was
required
+ '5' => 50, // Issuer not certified for CVC/CVV
+ '6' => 50, // No CVC/CVV provided
),
),
diff --git a/wikimedia/smash-pig/phpunit.xml b/wikimedia/smash-pig/phpunit.xml
index 01a15ec..ae488a5 100644
--- a/wikimedia/smash-pig/phpunit.xml
+++ b/wikimedia/smash-pig/phpunit.xml
@@ -4,6 +4,9 @@
bootstrap="Tests/bootstrap-phpunit.php">
<testsuites>
+ <testSuite name="Message tests">
+ <file>Tests/MessageTest.php</file>
+ </testSuite>
<testsuite name="Adyen tests">
<directory>PaymentProviders/Adyen/Tests/phpunit</directory>
</testsuite>
--
To view, visit https://gerrit.wikimedia.org/r/277240
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie239ade1bfb1868f54b1224999a1299c3b7eb902
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/vendor
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits