Skip to content

Commit 26554ef

Browse files
braintreepsDavid Johnson
andcommitted
6.30.0
Co-authored-by: David Johnson <djohnson14@paypal.com>
1 parent 210629e commit 26554ef

File tree

6 files changed

+107
-4
lines changed

6 files changed

+107
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# Changelog
22

3-
## 6.29.0
3+
## 6.30.0
4+
* Add `processingMerchantCategoryCode` to `TransactionGateway`
5+
* Add missing `transfer` validation error codes in `Transaction`
46

7+
## 6.29.0
58
* Add Bank Account Instant Verification functionality
69
* Add `BankAccountInstantVerificationGateway` for creating JWT tokens
710
* Add `BankAccountInstantVerificationJwt` and `BankAccountInstantVerificationJwtRequest` classes

lib/Braintree/Error/Codes.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,7 @@ class Codes
584584
const TRANSACTION_PAYPAL_NOT_ENABLED = '91576';
585585
const TRANSACTION_PAY_PAL_AUTH_EXPIRED = '91579';
586586
const TRANSACTION_PAY_PAL_VAULT_RECORD_MISSING_DATA = '91583';
587+
const TRANSACTION_PROCESSING_MERCHANT_CATEGORY_CODE_IS_INVALID = '915265';
587588
const TRANSACTION_PROCESSOR_AUTHORIZATION_CODE_CANNOT_BE_SET = '91519';
588589
const TRANSACTION_PROCESSOR_AUTHORIZATION_CODE_IS_INVALID = '81520';
589590
const TRANSACTION_PROCESSOR_DOES_NOT_SUPPORT_AUTHS = '915104';
@@ -640,8 +641,19 @@ class Codes
640641
const TRANSACTION_TRANSACTION_SOURCE_IS_INVALID = '915133';
641642

642643

643-
const TRANSFER_DETAILS_NOT_APPLICABLE = '97501';
644-
const TRANSFER_DETAILS_NOT_AVAILABLE = '97510';
644+
const TRANSFER_DETAILS_NOT_APPLICABLE = '97501'; //Deprecated
645+
const TRANSFER_DETAILS_NOT_AVAILABLE = '97510'; //Deprecated
646+
const TRANSACTION_TRANSFER_DETAILS_NOT_APPLICABLE = '97511';
647+
const TRANSACTION_TRANSFER_DETAILS_NOT_AVAILABLE = '97510';
648+
const TRANSACTION_TRANSFER_RECEIVER_ACCOUNT_REFERENCE_NUMBER_IS_NOT_VALID = '97509';
649+
const TRANSACTION_TRANSFER_RECEIVER_FIRST_NAME_IS_NOT_VALID = '97507';
650+
const TRANSACTION_TRANSFER_RECEIVER_LAST_NAME_IS_NOT_VALID = '97508';
651+
const TRANSACTION_TRANSFER_RECEIVER_TAX_ID_IS_NOT_VALID = '97506';
652+
const TRANSACTION_TRANSFER_SENDER_ACCOUNT_REFERENCE_NUMBER_IS_NOT_VALID = '97505';
653+
const TRANSACTION_TRANSFER_SENDER_FIRST_NAME_IS_NOT_VALID = '97503';
654+
const TRANSACTION_TRANSFER_SENDER_LAST_NAME_IS_NOT_VALID = '97504';
655+
const TRANSACTION_TRANSFER_SENDER_TAX_ID_IS_NOT_VALID = '97502';
656+
const TRANSACTION_TRANSFER_TYPE_INVALID = '97501';
645657

646658
const US_BANK_ACCOUNT_VERIFICATION_NOT_CONFIRMABLE = '96101';
647659
const US_BANK_ACCOUNT_VERIFICATION_MUST_BE_MICRO_TRANSFERS_VERIFICATION = '96102';

lib/Braintree/TransactionGateway.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ public static function createSignature()
294294
'paymentMethodNonce',
295295
'paymentMethodToken',
296296
['paypalAccount' => ['payeeId', 'payeeEmail', 'payerId', 'paymentId']],
297+
'processingMerchantCategoryCode',
297298
'productSku',
298299
'purchaseOrderNumber',
299300
'recurring',

lib/Braintree/Version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class Version
1010
{
1111
const MAJOR = 6;
12-
const MINOR = 29;
12+
const MINOR = 30;
1313
const TINY = 0;
1414

1515
protected function __construct()

tests/integration/TransactionTest.php

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7390,4 +7390,72 @@ public function test_findTransactionWithPaymentAccountReferenceInGooglePayDetail
73907390
$this->assertNotNull($transaction->googlePayCardDetails);
73917391
$this->assertArrayHasKey('paymentAccountReference', $transaction->googlePayCardDetails->toArray());
73927392
}
7393+
7394+
public function testSale_withValidProcessingMerchantCategoryCode()
7395+
{
7396+
$result = Braintree\Transaction::sale([
7397+
'amount' => '100.00',
7398+
'creditCard' => [
7399+
'number' => '5105105105105100',
7400+
'expirationDate' => '05/2025',
7401+
],
7402+
'processingMerchantCategoryCode' => '5411'
7403+
]);
7404+
7405+
$this->assertTrue($result->success);
7406+
}
7407+
7408+
public function testSale_withInvalidProcessingMerchantCategoryCodeTooLong()
7409+
{
7410+
$result = Braintree\Transaction::sale([
7411+
'amount' => '100.00',
7412+
'creditCard' => [
7413+
'number' => '5105105105105100',
7414+
'expirationDate' => '05/2025',
7415+
],
7416+
'processingMerchantCategoryCode' => '54111'
7417+
]);
7418+
7419+
$this->assertFalse($result->success);
7420+
$this->assertEquals(
7421+
Braintree\Error\Codes::TRANSACTION_PROCESSING_MERCHANT_CATEGORY_CODE_IS_INVALID,
7422+
$result->errors->forKey('transaction')->onAttribute('processingMerchantCategoryCode')[0]->code
7423+
);
7424+
}
7425+
7426+
public function testSale_withInvalidProcessingMerchantCategoryCodeNonNumeric()
7427+
{
7428+
$result = Braintree\Transaction::sale([
7429+
'amount' => '100.00',
7430+
'creditCard' => [
7431+
'number' => '5105105105105100',
7432+
'expirationDate' => '05/2025',
7433+
],
7434+
'processingMerchantCategoryCode' => 'abcd'
7435+
]);
7436+
7437+
$this->assertFalse($result->success);
7438+
$this->assertEquals(
7439+
Braintree\Error\Codes::TRANSACTION_PROCESSING_MERCHANT_CATEGORY_CODE_IS_INVALID,
7440+
$result->errors->forKey('transaction')->onAttribute('processingMerchantCategoryCode')[0]->code
7441+
);
7442+
}
7443+
7444+
public function testSale_withInvalidProcessingMerchantCategoryCodeTooShort()
7445+
{
7446+
$result = Braintree\Transaction::sale([
7447+
'amount' => '100.00',
7448+
'creditCard' => [
7449+
'number' => '5105105105105100',
7450+
'expirationDate' => '05/2025',
7451+
],
7452+
'processingMerchantCategoryCode' => '541'
7453+
]);
7454+
7455+
$this->assertFalse($result->success);
7456+
$this->assertEquals(
7457+
Braintree\Error\Codes::TRANSACTION_PROCESSING_MERCHANT_CATEGORY_CODE_IS_INVALID,
7458+
$result->errors->forKey('transaction')->onAttribute('processingMerchantCategoryCode')[0]->code
7459+
);
7460+
}
73937461
}

tests/unit/TransactionTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,25 @@ public function testSaleAcceptsPaymentFacilitatorOptions()
169169
$transactionGateway->sale($transactionParams);
170170
}
171171

172+
public function testSaleWithProcessingMerchantCategoryCode()
173+
{
174+
$transactionGateway = $this->mockTransactionGatewayDoCreate();
175+
$transactionGateway
176+
->expects($this->once())
177+
->method('_doCreate')
178+
->will($this->returnCallback(function ($path, $params) {
179+
$this->assertEquals('5411', $params["transaction"]["processingMerchantCategoryCode"]);
180+
}));
181+
$transactionGateway->sale([
182+
'amount' => Braintree\Test\TransactionAmounts::$authorize,
183+
'creditCard' => [
184+
'number' => Braintree\Test\CreditCardNumbers::$visa,
185+
'expirationDate' => '05/2009',
186+
],
187+
'processingMerchantCategoryCode' => '5411'
188+
]);
189+
}
190+
172191
public function testTransactionWithMetaCheckoutCardAttributes()
173192
{
174193
$transaction = Braintree\Transaction::factory([

0 commit comments

Comments
 (0)