Skip to content

Commit

Permalink
Merge pull request #382 from braintree/DTCRDCMPLY-755
Browse files Browse the repository at this point in the history
Add Excessive Retry to Gateway rejection reason
  • Loading branch information
Sujith Sudarsanan (CW) authored and GitHub Enterprise committed Jan 6, 2023
2 parents faaae03 + c5845c8 commit 98e3045
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,7 @@
* Add `preDisputeProgram` to `Dispute` and `DisputeSearch`
* Add `AUTO_ACCEPTED` Dispute Status
* Add `DISPUTE_AUTO_ACCEPTED` WebhookNotification
* Add `EXCESSIVE_RETRY` to `GatewayRejectionReason`

## 6.10.0
* Add `SEPADirectDebitAccount` payment method
Expand Down
17 changes: 9 additions & 8 deletions lib/Braintree/Transaction.php
Expand Up @@ -176,14 +176,15 @@ class Transaction extends Base
const RECURRING = 'recurring';

// Gateway Rejection Reason
const AVS = 'avs';
const AVS_AND_CVV = 'avs_and_cvv';
const CVV = 'cvv';
const DUPLICATE = 'duplicate';
const FRAUD = 'fraud';
const RISK_THRESHOLD = 'risk_threshold';
const THREE_D_SECURE = 'three_d_secure';
const TOKEN_ISSUANCE = 'token_issuance';
const AVS = 'avs';
const AVS_AND_CVV = 'avs_and_cvv';
const CVV = 'cvv';
const DUPLICATE = 'duplicate';
const EXCESSIVE_RETRY = 'excessive_retry';
const FRAUD = 'fraud';
const RISK_THRESHOLD = 'risk_threshold';
const THREE_D_SECURE = 'three_d_secure';
const TOKEN_ISSUANCE = 'token_issuance';
const APPLICATION_INCOMPLETE = 'application_incomplete';

// Industry Types
Expand Down
10 changes: 10 additions & 0 deletions tests/Helper.php
Expand Up @@ -72,6 +72,16 @@ public static function effortlessChargebackProtectionGateway()
]);
}

public static function duplicateCheckingMerchantGateway()
{
return new Braintree\Gateway([
'environment' => 'development',
'merchantId' => 'dup_checking_integration_merchant_id',
'publicKey' => 'dup_checking_integration_public_key',
'privateKey' => 'dup_checking_integration_private_key'
]);
}

public static function defaultMerchantAccountId()
{
return 'sandbox_credit_card';
Expand Down
18 changes: 18 additions & 0 deletions tests/integration/TransactionTest.php
Expand Up @@ -4515,6 +4515,24 @@ public function testGatewayRejectionOnFraud()
$this->assertEquals(Braintree\Transaction::FRAUD, $result->transaction->gatewayRejectionReason);
}

public function testGatewayRejectionOnExcessiveRetry()
{
$gateway = Test\Helper::duplicateCheckingMerchantGateway();
for ($i = 0; $i <= 16; $i++) {
$result = $gateway->transaction()->sale([
'amount' => Braintree\Test\TransactionAmounts::$decline,
'creditCard' => [
'number' => Braintree\Test\CreditCardNumbers::$visa,
'expirationDate' => '05/17',
'cvv' => '333'
]
]);
}

$this->assertFalse($result->success);
$this->assertEquals(Braintree\Transaction::EXCESSIVE_RETRY, $result->transaction->gatewayRejectionReason);
}

public function testGatewayRejectionOnRiskThreshold()
{
$gateway = Test\Helper::advancedFraudKountIntegrationMerchantGateway();
Expand Down

0 comments on commit 98e3045

Please sign in to comment.