Skip to content

Commit

Permalink
Merge pull request #33 from xendit/feature/dynamic-options
Browse files Browse the repository at this point in the history
add dynamic options for create invoice and disbursement
  • Loading branch information
hakiemaul authored May 31, 2019
2 parents 4e146f8 + b979b8e commit 462ef3e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/XenditPHPClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ function createInvoice ($external_id, $amount, $payer_email, $description, $invo
$data['payer_email'] = $payer_email;
$data['description'] = $description;

if (!empty($invoice_options['callback_virtual_account_id'])) {
$data['callback_virtual_account_id'] = $invoice_options['callback_virtual_account_id'];
if ( is_array($invoice_options) ) {
foreach ( $invoice_options as $key => $value ) {
$data[$key] = $value;
}
}

$payload = json_encode($data);
Expand Down Expand Up @@ -59,8 +61,10 @@ function createDisbursement ($external_id, $amount, $bank_code, $account_holder_
$data['account_holder_name'] = $account_holder_name;
$data['account_number'] = $account_number;

if (!empty($disbursement_options['description'])) {
$data['description'] = $disbursement_options['description'];
if ( is_array($disbursement_options) ) {
foreach ( $disbursement_options as $key => $value ) {
$data[$key] = $value;
}
}

$payload = json_encode($data);
Expand Down

0 comments on commit 462ef3e

Please sign in to comment.