Opayo Form Payment (originally Sage Pay)

Open to all! Ask other shopowners for help.
Post Reply
Xpajun
Contributor
Posts: 187
Joined: Thu Mar 04, 2021 1:18 pm
Phoenix Version: v1.0.9.0
Has thanked: 3 times
Been thanked: 6 times

Opayo Form Payment (originally Sage Pay)

Post by Xpajun »

Hi there - it's been a long time since I've been on here so New year greatings every one

Now my problem... I'm using Sage Pay Form (API version = 3.0) - and it works everywhere except for America where the state must be included and the state is not being sent or collected for some reason.

Code as follows:

Code: Select all

      $crypt = [
        'ReferrerID' => 'C74D7B82-E9EB-4FBD-93DB-76F0F551C802',
        'VendorTxCode' => substr(date('YmdHis') . '-' . $_SESSION['customer_id'] . '-' . $_SESSION['cartID'], 0, 40),
        'Amount' => $this->format_raw($order->info['total']),
        'Currency' => $_SESSION['currency'],
        'Description' => substr(STORE_NAME, 0, 100),
        'SuccessURL' => tep_href_link('checkout_process.php', '', 'SSL'),
        'FailureURL' => tep_href_link('checkout_payment.php', 'payment_error=' . $this->code, 'SSL'),
        'CustomerName' => substr($order->billing['name'], 0, 100),
        'CustomerEMail' => substr($order->customer['email_address'], 0, 255),
        'BillingSurname' => substr($order->billing['lastname'], 0, 20),
        'BillingFirstnames' => substr($order->billing['firstname'], 0, 20),
        'BillingAddress1' => substr($order->billing['street_address'], 0, 100),
        'BillingCity' => substr($order->billing['city'], 0, 40),
        'BillingPostCode' => substr($order->billing['postcode'], 0, 10),
        'BillingCountry' => $order->billing['country']['iso_code_2'],
      ];

      if ($crypt['BillingCountry'] == 'US') {
        $crypt['BillingState'] = tep_get_zone_code($order->billing['country']['id'], $order->billing['zone_id'], '');
      }

      $crypt['BillingPhone'] = substr($order->customer['telephone'], 0, 20);
      $crypt['DeliverySurname'] = substr($order->delivery['lastname'], 0, 20);
      $crypt['DeliveryFirstnames'] = substr($order->delivery['firstname'], 0, 20);
      $crypt['DeliveryAddress1'] = substr($order->delivery['street_address'], 0, 100);
      $crypt['DeliveryCity'] = substr($order->delivery['city'], 0, 40);
      $crypt['DeliveryPostCode'] = substr($order->delivery['postcode'], 0, 10);
      $crypt['DeliveryCountry'] = $order->delivery['country']['iso_code_2'];

      if ($crypt['DeliveryCountry'] == 'US') {
        $crypt['DeliveryState'] = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], '');
      }

Yes I'm aware that tep_get needs updating

Any help would be welcome
Current Store is now running 1.0.9.0 - php 8.2.18
Now working on taking a short rest :D - php 8.2.18


Join The Code Co-op to get access to your library in the Code Co-op Forum
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: Opayo Form Payment (originally Sage Pay)

Post by heatherbell »

Have a word with @raiwa - think they are making an up to date version.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply