Skip to content

Commit 365b970

Browse files
author
Konstantinos Christofilos
committed
Fix UpdatePaymentMethodRequest unit test
1 parent 04eb8c3 commit 365b970

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/Message/UpdatePaymentMethodRequest.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ public function getData()
1515
{
1616
$data = array();
1717
$data['token'] = $this->getToken();
18-
$data['parameters'] = $this->parameters->get('paymentMethodOptions');
18+
$options = $this->parameters->get('paymentMethodOptions');
19+
20+
if (null !== $options) {
21+
$data['options'] = $options;
22+
}
1923

2024
return $data;
2125
}
@@ -28,7 +32,7 @@ public function getData()
2832
*/
2933
public function sendData($data)
3034
{
31-
$response = $this->braintree->paymentMethod()->update($data['token'], $data['parameters']);
35+
$response = $this->braintree->paymentMethod()->update($data['token'], $data['options']);
3236

3337
return $this->createResponse($response);
3438
}

tests/Message/UpdatePaymentMethodRequestTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ public function testGetData()
2020
{
2121
$this->request->initialize(
2222
array(
23-
'token' => 'abcd1234',
24-
'makeDefault' => true,
23+
'paymentMethodToken' => 'abcd1234',
24+
'options' => array(
25+
'makeDefault' => true,
26+
)
2527
)
2628
);
2729
$expected = array(
2830
'token' => 'abcd1234',
29-
'parameters' => array(
30-
'options' => array(
31-
'makeDefault' => true,
32-
),
31+
'options' => array(
32+
'makeDefault' => true,
3333
),
3434
);
3535
$this->assertSame($expected, $this->request->getData());
@@ -39,7 +39,7 @@ public function testGetDataNoParameters()
3939
{
4040
$this->request->initialize(
4141
array(
42-
'token' => 'abcd1234',
42+
'paymentMethodToken' => 'abcd1234',
4343
)
4444
);
4545
$expected = array(

0 commit comments

Comments
 (0)