issue/97 - Ensure order amount is in integer when initializing new payment on Paystack by tubiz · Pull Request #98 · PaystackOSS/woo-paystack · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion includes/class-wc-gateway-paystack-subscriptions.php
12 changes: 6 additions & 6 deletions includes/class-wc-gateway-paystack.php
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ public function payment_scripts() {
if ( $the_order_id == $order_id && $the_order_key == $order_key ) {

$paystack_params['email'] = $email;
$paystack_params['amount'] = $amount;
$paystack_params['amount'] = absint( $amount );
$paystack_params['txnref'] = $txnref;
$paystack_params['currency'] = $currency;

Expand Down Expand Up @@ -881,7 +881,7 @@ public function process_redirect_payment_option( $order_id ) {
$payment_channels = $this->get_gateway_payment_channels( $order );

$paystack_params = array(
'amount' => $amount,
'amount' => absint( $amount ),
'email' => $order->get_billing_email(),
'currency' => $order->get_currency(),
'reference' => $txnref,
Expand Down Expand Up @@ -982,7 +982,7 @@ public function process_token_payment( $token, $order_id ) {

$body = array(
'email' => $customer_email,
'amount' => $order_amount,
'amount' => absint( $order_amount ),
'metadata' => $metadata,
'authorization_code' => $auth_code,
'reference' => $txnref,
Expand Down Expand Up @@ -1024,7 +1024,7 @@ public function process_token_payment( $token, $order_id ) {
$gateway_symbol = get_woocommerce_currency_symbol( $payment_currency );

// check if the amount paid is equal to the order amount.
if ( $amount_paid < $order_total ) {
if ( $amount_paid < absint( $order_total ) ) {

$order->update_status( 'on-hold', '' );

Expand Down Expand Up @@ -1191,7 +1191,7 @@ public function verify_paystack_transaction() {
$gateway_symbol = get_woocommerce_currency_symbol( $payment_currency );

// check if the amount paid is equal to the order amount.
if ( $amount_paid < $order_total ) {
if ( $amount_paid < absint( $order_total ) ) {

$order->update_status( 'on-hold', '' );

Expand Down Expand Up @@ -1341,7 +1341,7 @@ public function process_webhooks() {
$gateway_symbol = get_woocommerce_currency_symbol( $payment_currency );

// check if the amount paid is equal to the order amount.
if ( $amount_paid < $order_total ) {
if ( $amount_paid < absint( $order_total ) ) {

$order->update_status( 'on-hold', '' );

Expand Down