Skip to content

Commit

Permalink
Fix product name issue
Browse files Browse the repository at this point in the history
If the product name more than 40 characters, Thawani api will reject the request because the product name must be a string with a maximum length of 40. This release developed to sub-string the product name to 39 character.
  • Loading branch information
malnafei committed Aug 11, 2021
1 parent 3754307 commit 1f88c9f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions thawani-pay-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
Plugin Name: Thawani Pay v2
Description: Thawani V2 Payment Gateway for WooCommerce
Version: 1.3.0
Version: 1.3.2
Author: Mahmoud Alnafei
Author URI: https://twitter.com/magic_coding
Tags: payment, online payment, woocommerce, thawani pay, oman payment gateway
Expand Down Expand Up @@ -260,7 +260,7 @@ public function process_payment( $order_id ) {
// $subtotal_tax = $item->get_subtotal_tax(); // Line subtotal tax
// $price_incl_tax = ( $subtotal + $subtotal_tax ) / $quantity;

array_push($products_list, array('name'=> substr($product_name, 0, 40), 'unit_amount' => $price_excl_tax * 1000, 'quantity' => $quantity));
array_push($products_list, array('name'=> substr($product_name, 0, 39), 'unit_amount' => $price_excl_tax * 1000, 'quantity' => $quantity));
}

//check for shipping cost to be added as product item on Thawani checkout api.
Expand Down

0 comments on commit 1f88c9f

Please sign in to comment.