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

Commit

Permalink
Handle shipping and payment fee product ID.
Browse files Browse the repository at this point in the history
  • Loading branch information
rvdsteege committed Oct 12, 2018
1 parent 83b78e9 commit bc5b358
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Pronamic\WordPress\Pay\Core\Gateway as Core_Gateway;
use Pronamic\WordPress\Pay\Core\PaymentMethods;
use Pronamic\WordPress\Pay\Payments\Payment;
use Pronamic\WordPress\Pay\Payments\PaymentLineType;

/**
* Title: Sisow gateway
Expand Down Expand Up @@ -242,9 +243,17 @@ public function start( Payment $payment ) {
$tax = ( null === $line->get_tax_amount() ) ? null : $line->get_tax_amount()->get_cents();
$net_total = ( $total - $tax );

$product_id = $line->get_id();

if ( PaymentLineType::SHIPPING === $line->get_type() ) {
$product_id = 'shipping';
} elseif ( PaymentLineType::FEE === $line->get_type() ) {
$product_id = 'paymentfee';
}

$request->merge_parameters(
array(
'product_id_' . $x => $line->get_id(),
'product_id_' . $x => $product_id,
'product_description_' . $x => $line->get_description(),
'product_quantity_' . $x => $line->get_quantity(),
'product_netprice_' . $x => $net_price,
Expand Down

0 comments on commit bc5b358

Please sign in to comment.