Skip to content

Commit

Permalink
Merge pull request #18 from anush/XOL-4975
Browse files Browse the repository at this point in the history
XOL-4975 Support for Stripe API version 2019-12-03
  • Loading branch information
anush authored Mar 10, 2020
2 parents b292b86 + b972a8d commit 3607fcb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/Message/AuthorizeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,21 +249,21 @@ public function getData()
$stripeVersion = $this->getStripeVersion();
if (is_null($stripeVersion) || (!is_null($stripeVersion)
&& $stripeVersion >= self::API_VERSION_STATEMENT_DESCRIPTOR)) {
$data['statement_descriptor'] = $this->getStatementDescriptor();
$data['statement_descriptor_suffix'] = $this->getStatementDescriptor();
} else {
$data['statement_description'] = $this->getStatementDescriptor();
}

if ($this->getDestination()) {
$data['destination'] = $this->getDestination();
$data['transfer_data'] = ['destination' => $this->getDestination()];
}

if ($this->getOnBehalfOf()) {
$data['on_behalf_of'] = $this->getOnBehalfOf();
}

if ($this->getApplicationFee()) {
$data['application_fee'] = $this->getApplicationFeeInteger();
$data['application_fee_amount'] = $this->getApplicationFeeInteger();
}

if ($this->getTransferGroup()) {
Expand Down
6 changes: 3 additions & 3 deletions tests/Message/AuthorizeRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function testGetData()
$this->assertSame('Order #42', $data['description']);
$this->assertSame('false', $data['capture']);
$this->assertSame(array('foo' => 'bar'), $data['metadata']);
$this->assertSame(100, $data['application_fee']);
$this->assertSame(100, $data['application_fee_amount']);
}

/**
Expand Down Expand Up @@ -72,7 +72,7 @@ public function testDataWithStatementDescriptor()
$this->request->setStatementDescriptor('OMNIPAY');
$data = $this->request->getData();

$this->assertSame('OMNIPAY', $data['statement_descriptor']);
$this->assertSame('OMNIPAY', $data['statement_descriptor_suffix']);
}

public function testDataWithSourceAndDestination()
Expand All @@ -82,7 +82,7 @@ public function testDataWithSourceAndDestination()
$data = $this->request->getData();

$this->assertSame('abc', $data['source']);
$this->assertSame('xyz', $data['destination']);
$this->assertSame('xyz', $data['transfer_data']['destination']);
}

public function testDataWithToken()
Expand Down
8 changes: 4 additions & 4 deletions tests/Message/PurchaseRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function testShouldReturnDataAsAnArray()
'object' => 'card',
'email' => null
),
'statement_descriptor' => 'FOO',
'statement_descriptor_suffix' => 'FOO',
'description' => null,
'capture' => 'true',
'metadata' => null
Expand Down Expand Up @@ -100,7 +100,7 @@ public function testShouldReturnLevel3DataIfItemsPresent()
'object' => 'card',
'email' => null
),
'statement_descriptor' => 'BOBS ANTIQUES',
'statement_descriptor_suffix' => 'BOBS ANTIQUES',
'description' => null,
'capture' => 'true',
'metadata' => null,
Expand Down Expand Up @@ -178,7 +178,7 @@ public function testShouldNotReturnLevel3DataIfItemsAmountsDoNotAddUpToAmountCha
'object' => 'card',
'email' => null
),
'statement_descriptor' => 'BOBS ANTIQUES',
'statement_descriptor_suffix' => 'BOBS ANTIQUES',
'description' => null,
'capture' => 'true',
'metadata' => null
Expand All @@ -195,7 +195,7 @@ public function testShouldUseOlderKeyOfStatementDescriptorWhenStripeVersionIsBef

$data = $this->request->getData();

$this->assertFalse(isset($data['statement_descriptor']), 'statement_descriptor should not be used for older version of the API');
$this->assertFalse(isset($data['statement_descriptor_suffix']), 'statement_descriptor_suffix should not be used for older version of the API');
$this->assertNotNull($data['statement_description'], 'statement_description should be used for this api version');
$this->assertEquals('FOO', $data['statement_description']);
}
Expand Down

0 comments on commit 3607fcb

Please sign in to comment.