Plugin Directory

Changeset 3365680


Ignore:
Timestamp:
09/22/2025 09:50:23 AM (6 months ago)
Author:
allpay
Message:

v1.1.3. New: VAT calculation support.

Location:
allpay-payment-gateway/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • allpay-payment-gateway/trunk/allpay-gateway.php

    r3353274 r3365680  
    66 * Author: Allpay
    77 * Author URI: https://allpay.co.il
    8  * Version: 1.1.2
     8 * Version: 1.1.3
    99 * Text Domain: allpay-payment-gateway
    1010 * Domain Path: /languages
  • allpay-payment-gateway/trunk/classes/class-allpay.php

    r3353274 r3365680  
    3939        }
    4040
    41         $chunks = [];
    42         $wh_params = ['amount', 'order_id', 'currency', 'status', 'card_mask', 'card_brand', 'foreign_card', 'add_field_1', 'add_field_2', 'receipt'];
    43         foreach($wh_params as $k) {
    44             if(isset($_REQUEST[$k])) {
    45                 $chunks[$k] = sanitize_text_field($_REQUEST[$k]);
    46             }
    47         }
    48         $sign = $this->get_signature($chunks);
     41        $sign = $this->get_signature($_REQUEST);
    4942        $order_id = $_REQUEST['order_id'];
    5043        $status = (int)$_REQUEST['status'];
     
    112105        $customer_order = wc_get_order( $order_id );
    113106
    114         $environment_url = 'https://allpay.to/app/?show=getpayment&mode=api6';
     107        $environment_url = 'https://allpay.to/app/?show=getpayment&mode=api8';
    115108       
    116109        $user_id = get_current_user_id();
     
    158151        }
    159152
     153        $tax_included = wc_tax_enabled() && wc_prices_include_tax();
     154
    160155        // Items
    161156        $items = [];
     
    168163                'price' => $price,
    169164                'qty' => $quantity,
     165                'vat' => ($tax_included ? 1 : 0)
    170166            ];
    171167        }
     
    174170                'name' => $fee->get_name(),
    175171                'price' => $fee->get_total(),
    176                 'qty' => 1
     172                'qty' => 1,
     173                'vat' => ($tax_included ? 1 : 0)
    177174            ];
    178175        }
     
    181178                'name' => $customer_order->get_shipping_method(),
    182179                'price' => $shipping_total,
    183                 'qty' => 1
     180                'qty' => 1,
     181                'vat' => ($tax_included ? 1 : 0)
    184182            ];
    185183        }
     
    216214    }
    217215
    218     public function get_signature($data) {
    219         ksort($data);
     216    public function get_signature($params) {   
     217        ksort($params);
    220218        $chunks = [];
    221         foreach($data as $k => $v) {
    222             if(is_array($v)) {
    223                 foreach ($v as $item) {
     219
     220        foreach ($params as $k => $v) {
     221            if (is_array($v)) {
     222                ksort($v);
     223
     224                foreach ($v as $subkey => $item) {
    224225                    if (is_array($item)) {
    225226                        ksort($item);
    226227                        foreach($item as $name => $val) {
    227                             if (trim($val) !== '') {
     228                            if ($val !== '') {
    228229                                $chunks[] = $val;
    229                             }                               
     230                            }   
    230231                        }
    231                     }
     232                    } elseif ($item !== '') {
     233                        $chunks[] = $item;
     234                    }     
    232235                }
    233             } else {
    234                 if (trim($v) !== '') {
    235                     $chunks[] = $v;
    236                 }                   
    237             }
     236            } elseif ($v !== '') {
     237                $chunks[] = $v;
     238            }                   
    238239        }
    239         $signature = hash('sha256', implode(':', $chunks) . ':' . $this->api_key);
    240         return $signature;
    241     }
     240       
     241        $signature = implode(':', $chunks) . ':' . $this->api_key;
     242        $signature = hash('sha256', $signature);
     243        return $signature; 
     244    } 
    242245
    243246    public function get_lang() {
  • allpay-payment-gateway/trunk/readme.txt

    r3353274 r3365680  
    44Requires PHP: 5.6
    55Requires at least: 4.7
    6 Tested up to: 6.6.2
    7 Stable tag: 1.1.2
     6Tested up to: 6.8.2
     7Stable tag: 1.1.3
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    6464
    6565== Changelog ==
    66 = 1.1.2 - 31TH AUGUST 2025 =
    67 * Fix: Order status wasn't always changing to paid.
     66= 1.1.3 - 22 SEPTEMBER 2025 =
     67* New: VAT calculation support.
     68
     69= 1.1.2 - 31 AUGUST 2025 =
     70* Fix: Order status wasn’t always changing to paid.
    6871
    6972= 1.1.1 - 20TH FEBRUARY 2025 =
     
    8386= 1.0.2 - THURSDAY, 10TH AUGUST 2023 =
    8487* Improvement: Tested with WordPress v6.3.
     88
     89= 1.1.3 - THURSDAY, 10TH SEPTEMBER 2025 =
     90* Fix: inclusion of taxes in payment
Note: See TracChangeset for help on using the changeset viewer.