Skip to content
This repository has been archived by the owner on Aug 24, 2022. It is now read-only.

Commit

Permalink
Allow payment line unit price null default value.
Browse files Browse the repository at this point in the history
  • Loading branch information
rvdsteege committed Nov 14, 2018
1 parent 78d491d commit 6de6e45
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,20 @@ public function start( Payment $payment ) {
break;
}

// Price.
$unit_price = null;

if ( null !== $line->get_unit_price() ) {
$unit_price = $line->get_unit_price()->get_excluding_tax()->get_cents();
}

// Request parameters.
$request->merge_parameters(
array(
'product_id_' . $x => $product_id,
'product_description_' . $x => $line->get_name(),
'product_quantity_' . $x => $line->get_quantity(),
'product_netprice_' . $x => $line->get_unit_price()->get_excluding_tax()->get_cents(),
'product_netprice_' . $x => $unit_price,
'product_total_' . $x => $line->get_total_amount()->get_including_tax()->get_cents(),
'product_nettotal_' . $x => $line->get_total_amount()->get_excluding_tax()->get_cents(),
'product_tax_' . $x => $line->get_tax_amount()->get_cents(),
Expand Down

0 comments on commit 6de6e45

Please sign in to comment.