Plugin Directory

Changeset 1951028


Ignore:
Timestamp:
10/03/2018 06:29:03 PM (8 years ago)
Author:
ingpsp
Message:

Handle AfterPay testing. Correct calculation of line item totals. Support different billing address.

Location:
ing-psp/trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • ing-psp/trunk/CHANGELOG.md

    r1942964 r1951028  
    11# Changelog WooCommerce
     2
     3** 1.3.4 **
     4* Handle AfterPay testing. Correct calculation of line item totals. Support different billing address.
    25
    36** 1.3.3 **
  • ing-psp/trunk/README.md

    r1942964 r1951028  
    1515
    1616## Version number
    17 Version 1.3.3
     17Version 1.3.4
    1818
    1919## Pre-requisites to install the plug-ins
  • ing-psp/trunk/classes/class-wc-ingpsp-afterpay.php

    r1942964 r1951028  
    5454        } elseif ($ingOrder->status()->isCancelled()) {
    5555            wc_add_notice(
    56                 __('Unfortunately, we can not currently accept your purchase with AfterPay. Please choose another payment option to complete your order. We apologize for the inconvenience.'),
     56                __('Unfortunately, we can not currently accept your purchase with AfterPay. Please choose another payment option to complete your order. We apologize for the inconvenience.', WC_Ingpsp_Helper::DOMAIN),
    5757                'error'
    5858            );
  • ing-psp/trunk/classes/class-wc-ingpsp-helper.php

    r1942964 r1951028  
    9393    public static function getCustomerInfo(WC_Order $order)
    9494    {
    95         $address = $order->get_address();
     95        $shipping_address = $order->get_address('shipping');
     96        $billing_address = $order->get_address('billing');
    9697
    9798        if (version_compare(get_option('woocommerce_version'), '3.0', '>=')) {
     
    110111
    111112        return \GingerPayments\Payment\Common\ArrayFunctions::withoutNullValues([
    112             'address_type' => 'billing',
     113            'address_type' => 'customer',
    113114            'merchant_customer_id' => $order->get_user_id(),
    114             'email_address' => $address['email'],
    115             'first_name' => $address['first_name'],
    116             'last_name' => $address['last_name'],
    117             'address' => trim($address['address_1'])
    118                 .' '.trim($address['address_2'])
    119                 .' '.trim($address['postcode'])
    120                 .' '.trim($address['city']),
    121             'postal_code' => $address['postcode'],
    122             'country' => $address['country'],
    123             'phone_numbers' => [$address['phone']],
     115            'email_address' => $billing_address['email'],
     116            'first_name' => $shipping_address['first_name'],
     117            'last_name' => $shipping_address['last_name'],
     118            'address' => trim($shipping_address['address_1'])
     119                .' '.trim($shipping_address['address_2'])
     120                .' '.trim($shipping_address['postcode'])
     121                .' '.trim($shipping_address['city']),
     122            'postal_code' => $shipping_address['postcode'],
     123            'country' => $shipping_address['country'],
     124            'phone_numbers' => [$billing_address['phone']],
    124125            'user_agent' => $user_agent,
    125126            'ip_address' => $ip_address,
     
    127128            'gender' => static::getCustomPaymentField('gender'),
    128129            'birthdate' => $birthdate,
     130            'additional_addresses' => [
     131                [
     132                    'address_type' => 'billing',
     133                    'address' => trim($billing_address['address_1'])
     134                .' '.trim($billing_address['address_2'])
     135                .' '.trim($billing_address['postcode'])
     136                .' '.trim($billing_address['city']),
     137                    'country' => $billing_address['country'],
     138                ]
     139            ]
    129140        ]);
    130141    }
     
    151162     * @return float|string
    152163     */
    153     public static function getProductPrice(WC_Product $product)
     164    public static function getProductPrice($orderLine, $order)
    154165    {
    155166        if (version_compare(get_option('woocommerce_version'), '3.0', '>=')) {
    156             return wc_get_price_including_tax($product);
     167            return $order->get_item_total( $orderLine, true );
    157168        } else {
     169            $product = $orderLine->get_product();
    158170            return $product->get_price_including_tax();
    159171        }
     
    294306                'name' => $orderLine->get_name(),
    295307                'type' => \GingerPayments\Payment\Order\OrderLine\Type::PHYSICAL,
    296                 'amount' => static::getAmountInCents(static::getProductPrice($orderLine->get_product())),
     308                'amount' => static::getAmountInCents(static::getProductPrice($orderLine, $order)),
    297309                'currency' => \GingerPayments\Payment\Currency::EUR,
    298310                'quantity' => (int) $orderLine->get_quantity(),
  • ing-psp/trunk/ing-php/src/Order/Customer.php

    r1652620 r1951028  
    1313use GingerPayments\Payment\Order\Customer\Country;
    1414use GingerPayments\Payment\Order\Customer\PhoneNumbers;
     15use GingerPayments\Payment\Order\Customer\AdditionalAddresses;
     16use GingerPayments\Payment\Order\Customer\AdditionalAddress;
    1517use GingerPayments\Payment\Order\Customer\Locale;
    1618use GingerPayments\Payment\Order\Customer\Birthdate;
     
    6971     */
    7072    private $phoneNumbers;
     73
     74    /**
     75     * @var AdditionalAddresses|null
     76     */
     77    private $additionalAddresses;
    7178
    7279    /**
     
    108115            array_key_exists('country', $details) ? Country::fromString($details['country']) : null,
    109116            array_key_exists('phone_numbers', $details) ? PhoneNumbers::fromArray($details['phone_numbers']) : null,
     117            array_key_exists('additional_addresses', $details) ? AdditionalAddresses::fromArray($details['additional_addresses']) : null,
    110118            array_key_exists('locale', $details) ? Locale::fromString($details['locale']) : null,
    111119            array_key_exists('gender', $details) ? Gender::fromString($details['gender']) : null,
     
    132140            'country' => ($this->country() !== null) ? $this->country()->toString() : null,
    133141            'phone_numbers' => ($this->phoneNumbers() !== null) ? $this->phoneNumbers()->toArray() : [],
     142            'additional_addresses' => ($this->AdditionalAddresses() !== null) ? $this->AdditionalAddresses()->toArray() : [],
    134143            'locale' => ($this->locale() !== null) ? $this->locale()->toString() : null,
    135144            'gender' => ($this->gender() !== null) ? $this->gender()->toString() : null,
     
    217226    {
    218227        return $this->phoneNumbers;
     228    }
     229
     230    public function additionalAddresses()
     231    {
     232        return $this->additionalAddresses;
    219233    }
    220234
     
    262276     * @param Country $country
    263277     * @param PhoneNumbers $phoneNumbers
     278     * @param AdditionalAddresses $additionalAddresses
    264279     * @param Locale $locale
    265280     * @param Gender $gender
     
    278293        Country $country = null,
    279294        PhoneNumbers $phoneNumbers = null,
     295        AdditionalAddresses $additionalAddresses = null,
    280296        Locale $locale = null,
    281297        Gender $gender = null,
     
    293309        $this->country = $country;
    294310        $this->phoneNumbers = $phoneNumbers;
     311        $this->additionalAddresses = $additionalAddresses;
    295312        $this->locale = $locale;
    296313        $this->gender = $gender;
  • ing-psp/trunk/ing-php/vendor/beberlei/assert/lib/Assert/Assertion.php

    r1942964 r1951028  
    21982198        if (false === $dateTime || $value !== $dateTime->format($format)) {
    21992199            $message = \sprintf(
    2200                 static::generateMessage($message) ?: 'Datum "%s" is niet correct of in het formaat "%s".',
    2201                 static::stringify($value),
    2202                 static::stringify($format)
     2200                static::generateMessage($message) ?: 'Datum "%s" is niet correct of in het formaat jjjj-mm-dd.',
     2201                static::stringify($value)
    22032202            );
    22042203
  • ing-psp/trunk/ingpsp.php

    r1942964 r1951028  
    55 * Plugin URI: https://www.ing.nl/
    66 * Description: ING WooCommerce plugin for ING Kassa Compleet and ING ePay markets.
    7  * Version: 1.3.3
     7 * Version: 1.3.4
    88 * Author: Ginger Payments
    99 * Author URI: https://www.gingerpayments.com/
     
    2020 * Define ING PSP plugin version
    2121 */
    22 define('INGPSP_PLUGIN_VERSION', 'WooCommerce v1.3.3');
     22define('INGPSP_PLUGIN_VERSION', 'WooCommerce v1.3.4');
    2323
    2424add_action('plugins_loaded', 'woocommerce_ingpsp_init', 0);
     
    9999            $methods[] = 'WC_Ingpsp_Payconiq';
    100100        }
    101         if (in_array('afterpay', $allowed_products)  || $apiTestMode) {
    102             $methods[] = 'WC_Ingpsp_AfterPay';
    103         }
     101        $methods[] = 'WC_Ingpsp_AfterPay';
    104102
    105103        return $methods;
  • ing-psp/trunk/readme.txt

    r1942964 r1951028  
    55Requires at least: 4.0
    66Tested up to: 4.9.6
    7 Stable tag: 1.3.3
     7Stable tag: 1.3.4
    88License: The MIT License (MIT)
    99License URI: https://opensource.org/licenses/MIT
     
    104104== Changelog ==
    105105
     106= 1.3.4 =
     107* Handle AfterPay testing. Correct calculation of line item totals. Support different billing address.
     108
    106109= 1.3.3 =
    107110* Updated translations. Supporting dutch format for DOB
Note: See TracChangeset for help on using the changeset viewer.