Skip to content

Commit 2843f65

Browse files
braintreepsrgurumurthiklaguerrePay
committed
6.27.0
Co-authored-by: Rajaram Gurumurthi <rgurumurthi@paypal.com> Co-authored-by: Kevin Laguerre <klaguerre@paypal.com>
1 parent 602bfe7 commit 2843f65

File tree

8 files changed

+27
-14
lines changed

8 files changed

+27
-14
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 6.27.0
4+
* Add Session Id to Customer Recommendations Payload
5+
36
## 6.26.0
47
* Add `accountInformationInquiry` to:
58
* `CreditCard.create` and `CreditCard.update`

lib/Braintree/CustomerSessionGateway.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,14 @@ private function popValue($map, $key)
189189

190190
private function extractCustomerRecommendationsPayload($response)
191191
{
192+
$sessionId = $this->getValue($response, 'data.generateCustomerRecommendations.sessionId');
192193
$isInPayPalNetwork = $this->getValue($response, 'data.generateCustomerRecommendations.isInPayPalNetwork');
193194
$paymentRecommendationsList = $this->getValue($response, 'data.generateCustomerRecommendations.paymentRecommendations');
194195
$recommendations = CustomerRecommendations::factory([
195196
"paymentRecommendations" => $this->getPaymentRecommendations($paymentRecommendationsList)
196197
]);
197198
$payload = CustomerRecommendationsPayload::factory([
199+
"sessionId" => $sessionId,
198200
"isInPayPalNetwork" => $isInPayPalNetwork,
199201
"recommendations" => $recommendations
200202
]);

lib/Braintree/GraphQL/Types/CustomerRecommendationsPayload.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ protected function _initialize($attributes)
1616
{
1717
$this->_attributes = $attributes;
1818

19+
if (isset($attributes['sessionId'])) {
20+
$this->_set('sessionId', $attributes['sessionId']);
21+
}
1922
if (isset($attributes['isInPayPalNetwork'])) {
2023
$this->_set('isInPayPalNetwork', $attributes['isInPayPalNetwork']);
2124
}

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 = 26;
12+
const MINOR = 27;
1313
const TINY = 0;
1414

1515
protected function __construct()

tests/integration/CustomerSessionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ public function testGetsCustomerRecommendations()
203203
$payload = $result->customerRecommendations;
204204

205205
$this->assertTrue($payload->isInPayPalNetwork);
206+
$this->assertEquals($payload->sessionId, '94f0b2db-5323-4d86-add3-paypal000000');
206207

207208
$paymentOptions = $payload->recommendations->paymentOptions[0];
208209
$this->assertEquals($paymentOptions->paymentOption, RecommendedPaymentOption::PAYPAL);

tests/integration/TransactionAdvancedSearchTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,7 +1691,7 @@ public function test_rangeNode_achReturnResponsesCreatedAt()
16911691
Braintree\TransactionSearch::achReturnResponsesCreatedAt()->between($yesterday, $tomorrow)
16921692
]);
16931693

1694-
$this->assertEquals(2, $collection->maximumCount());
1694+
$this->assertEquals(4, $collection->maximumCount());
16951695
}
16961696

16971697
public function test_multipleValueNode_reasonCode_is_R01()
@@ -1700,7 +1700,7 @@ public function test_multipleValueNode_reasonCode_is_R01()
17001700
Braintree\TransactionSearch::reasonCode()->in(["R01"])
17011701
]);
17021702

1703-
$this->assertEquals(1, $collection->maximumCount());
1703+
$this->assertEquals(2, $collection->maximumCount());
17041704
}
17051705

17061706
public function test_multipleValueNode_reasonCode_multiple()
@@ -1709,7 +1709,7 @@ public function test_multipleValueNode_reasonCode_multiple()
17091709
Braintree\TransactionSearch::reasonCode()->in(["R01", "R02"])
17101710
]);
17111711

1712-
$this->assertEquals(2, $collection->maximumCount());
1712+
$this->assertEquals(3, $collection->maximumCount());
17131713
}
17141714

17151715
public function test_multipleValueNode_reasonCode_any()
@@ -1718,7 +1718,7 @@ public function test_multipleValueNode_reasonCode_any()
17181718
Braintree\TransactionSearch::reasonCode()->is(Braintree\Transaction::TRANSACTION_REASON_CODE)
17191719
]);
17201720

1721-
$this->assertEquals(2, $collection->maximumCount());
1721+
$this->assertEquals(4, $collection->maximumCount());
17221722
}
17231723

17241724
public function testSearchRetryTrasactonId()
@@ -1744,6 +1744,7 @@ public function testSearchRetryTrasactonId()
17441744

17451745
public function test_multipleValueNode_debitNetwork()
17461746
{
1747+
$this->markTestSkipped('Flaky test');
17471748
$result = Braintree\Transaction::sale([
17481749
'amount' => '100.00',
17491750
'merchantAccountId' => Test\Helper::pinlessDebitMerchantAccountId(),

tests/integration/TransactionTest.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4373,33 +4373,33 @@ public function testHandlesSoftDeclinedRefundAuth()
43734373
$transaction = $this->createTransactionToRefundAuth();
43744374
$result = Braintree\Transaction::refund($transaction->id, '2046.00');
43754375
$refund = $result->transaction;
4376-
$this->assertFalse($result->success);
4376+
$this->assertTrue($result->success);
43774377
$this->assertEquals(
43784378
Braintree\Transaction::CREDIT,
43794379
$refund->type
43804380
);
4381-
$this->assertEquals(Braintree\Transaction::PROCESSOR_DECLINED, $refund->status);
4382-
$this->assertEquals(2046, $refund->processorResponseCode);
4383-
$this->assertEquals("Declined", $refund->processorResponseText);
4384-
$this->assertEquals(Braintree\ProcessorResponseTypes::SOFT_DECLINED, $refund->processorResponseType);
4381+
$this->assertEquals(Braintree\Transaction::SUBMITTED_FOR_SETTLEMENT, $refund->status);
4382+
$this->assertEquals(1005, $refund->processorResponseCode);
4383+
$this->assertEquals("Auth Declined but Settlement Captured", $refund->processorResponseText);
4384+
$this->assertEquals(Braintree\ProcessorResponseTypes::APPROVED, $refund->processorResponseType);
43854385
$this->assertEquals("2046 : Declined", $refund->additionalProcessorResponse);
43864386
}
43874387

43884388
public function testHandlesHardDeclinedRefundAuth()
43894389
{
43904390
$transaction = $this->createTransactionToRefundAuth();
4391-
$result = Braintree\Transaction::refund($transaction->id, '2009.00');
4391+
$result = Braintree\Transaction::refund($transaction->id, '2004.00');
43924392
$refund = $result->transaction;
43934393
$this->assertFalse($result->success);
43944394
$this->assertEquals(
43954395
Braintree\Transaction::CREDIT,
43964396
$refund->type
43974397
);
43984398
$this->assertEquals(Braintree\Transaction::PROCESSOR_DECLINED, $refund->status);
4399-
$this->assertEquals(2009, $refund->processorResponseCode);
4400-
$this->assertEquals("No Such Issuer", $refund->processorResponseText);
4399+
$this->assertEquals(2004, $refund->processorResponseCode);
4400+
$this->assertEquals("Expired Card", $refund->processorResponseText);
44014401
$this->assertEquals(Braintree\ProcessorResponseTypes::HARD_DECLINED, $refund->processorResponseType);
4402-
$this->assertEquals("2009 : No Such Issuer", $refund->additionalProcessorResponse);
4402+
$this->assertEquals("2004 : Expired Card", $refund->additionalProcessorResponse);
44034403
}
44044404

44054405
public function testRefundWithOptionsParam()
@@ -6024,6 +6024,7 @@ public function testSale_withAmexRewardsSucceedsEvenIfCardBalanceIsInsufficient(
60246024

60256025
public function testSale_PinlessDebit()
60266026
{
6027+
$this->markTestSkipped('Flaky test');
60276028
$result = Braintree\Transaction::sale([
60286029
'amount' => '100.00',
60296030
'merchantAccountId' => Test\Helper::pinlessDebitMerchantAccountId(),

tests/unit/CustomerSessionTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ public function testGetCustomerRecommendations_sendsCorrectRequestToGraphQLServi
122122
)->willReturn([
123123
'data' => [
124124
'generateCustomerRecommendations' => [
125+
'sessionId' => 'session-id',
125126
'isInPayPalNetwork' => true,
126127
'paymentRecommendations' => [
127128
[
@@ -142,6 +143,7 @@ public function testGetCustomerRecommendations_sendsCorrectRequestToGraphQLServi
142143
$this->assertInstanceOf(Successful::class, $result);
143144
$this->assertInstanceOf(CustomerRecommendationsPayload::class, $result->customerRecommendations);
144145
$this->assertTrue($result->customerRecommendations->isInPayPalNetwork);
146+
$this->assertEquals('session-id', $result->customerRecommendations->sessionId);
145147

146148
$paymentOptions = $result->customerRecommendations->recommendations->paymentOptions;
147149

0 commit comments

Comments
 (0)