Skip to content

Commit c37be45

Browse files
committed
Remove null values
1 parent ebe6056 commit c37be45

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Message/AuthorizeRequest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ public function getData()
4242
'taxExempt' => $this->getTaxExempt(),
4343
];
4444

45+
// Remove null values
46+
$data = array_filter($data);
47+
4548
$data += $this->getCardData();
4649

4750
return $data;

tests/Message/AuthorizeRequestTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ public function testGetData()
4040
$this->assertSame('Kayla', $data['billing']['firstName']);
4141
$this->assertSame('League', $data['shipping']['company']);
4242
$this->assertFalse($data['options']['submitForSettlement']);
43-
$this->assertNull($data['billingAddressId']);
43+
44+
// Check empty values are not sent
45+
$this->assertFalse(isset($data['billingAddressId']));
4446

4547
$this->request->configure();
4648
$this->assertSame('production', \Braintree_Configuration::environment());

0 commit comments

Comments
 (0)