Skip to content

Commit

Permalink
Fix first/second total handling
Browse files Browse the repository at this point in the history
  • Loading branch information
robwoodgate committed Jul 28, 2024
1 parent 1d69062 commit 86a8b38
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions kinesis-pay.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class Am_Paysystem_KinesisPay extends Am_Paysystem_ManualRebill
{
public const PLUGIN_STATUS = self::STATUS_BETA;
public const PLUGIN_REVISION = '3.1';
public const PLUGIN_REVISION = '3.2';
public const AMOUNT_PAID = 'kinesis-pay-amount_paid';
public const PAYMENT_ID = 'kinesis-pay-payment_id';
public const API_BASE_URL = 'https://apip.kinesis.money';
Expand Down Expand Up @@ -135,7 +135,8 @@ public function _process($invoice, $request, $result): void

// Calculate adjusted total to pay
$multiplier = abs($this->getConfig('percentage', 100)) / 100;
$total = $invoice->first_total * $multiplier;
$total = $invoice->isFirstPayment() ? $invoice->first_total : $invoice->second_total;
$total = $total * $multiplier;
$total = number_format($total, 2, '.', '');

// Send request for a payment ID
Expand Down Expand Up @@ -382,6 +383,8 @@ public function getReadme()
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
<strong>Like this plugin?</strong> <a href="https://btcpay.cogmentis.com/apps/359ErQmassvNesyXYkLqD3JU4SP2/pos" target="_blank">Buy me a coffee</a>
-------------------------------------------------------------------------------
README;
}
Expand Down

0 comments on commit 86a8b38

Please sign in to comment.