Skip to content

Commit

Permalink
Remove empty meta data from payment request JSON.
Browse files Browse the repository at this point in the history
  • Loading branch information
rvdsteege committed Jun 26, 2020
1 parent 89f61e0 commit ae88977
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/AbstractPaymentRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,8 @@ public function set_telephone_number( $telephone_number ) {
* @return object
*/
public function get_json() {
$metadata = $this->get_metadata();

$properties = Util::filter_null(
array(
'amount' => $this->get_amount()->get_json(),
Expand All @@ -578,7 +580,7 @@ public function get_json() {
'lineItems' => is_null( $this->line_items ) ? null : $this->line_items->get_json(),
'merchantAccount' => $this->get_merchant_account(),
'merchantOrderReference' => $this->get_merchant_order_reference(),
'metadata' => $this->get_metadata(),
'metadata' => empty( $metadata ) ? null : (object) $metadata,
'reference' => $this->get_reference(),
'returnUrl' => $this->get_return_url(),
'shopperIP' => $this->shopper_ip,
Expand Down

0 comments on commit ae88977

Please sign in to comment.