Plugin Directory

Changeset 1958225


Ignore:
Timestamp:
10/17/2018 06:17:37 PM (7 years ago)
Author:
ingpsp
Message:

Use dropdowns for DOB

Location:
ing-psp/trunk
Files:
7 edited

Legend:

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

    r1951028 r1958225  
    11# Changelog WooCommerce
     2
     3** 1.3.5 **
     4* Use dropdowns for DOB
    25
    36** 1.3.4 **
  • ing-psp/trunk/README.md

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

    r1951028 r1958225  
    107107        ));
    108108
    109         woocommerce_form_field('dob', array(
    110             'type' => 'text',
    111             'class' => array('input-text'),
    112             'label' => __('Date of birth:', WC_Ingpsp_Helper::DOMAIN),
    113             'description' => __('Birth date format: DD - MM - YYYY, eg: 31-12-1980', WC_Ingpsp_Helper::DOMAIN),
    114             'required' => true
    115         ));
     109        ?>
     110        <select class="dob_select dob_day" name="<?php echo esc_attr( $this->id ); ?>_date_of_birth_day">
     111            <option value="">
     112            <?php esc_html_e( 'Dag', 'afterpay' ); ?>
     113            </option>
     114            <?php
     115                $day = 1;
     116            while ( $day <= 31 ) {
     117                $day_pad = str_pad( $day, 2, '0', STR_PAD_LEFT );
     118                echo '<option value="' . esc_attr( $day_pad ) . '">' . esc_html( $day_pad ) . '</option>';
     119                $day++;
     120            }
     121            ?>
     122        </select>
     123        <select class="dob_select dob_month" name="<?php echo esc_attr( $this->id ); ?>_date_of_birth_month">
     124            <option value="">
     125            <?php esc_html_e( 'Maand', 'afterpay' ); ?>
     126            </option>
     127            <option value="01"><?php esc_html_e( 'Jan', 'afterpay' ); ?></option>
     128            <option value="02"><?php esc_html_e( 'Feb', 'afterpay' ); ?></option>
     129            <option value="03"><?php esc_html_e( 'Mar', 'afterpay' ); ?></option>
     130            <option value="04"><?php esc_html_e( 'Apr', 'afterpay' ); ?></option>
     131            <option value="05"><?php esc_html_e( 'May', 'afterpay' ); ?></option>
     132            <option value="06"><?php esc_html_e( 'Jun', 'afterpay' ); ?></option>
     133            <option value="07"><?php esc_html_e( 'Jul', 'afterpay' ); ?></option>
     134            <option value="08"><?php esc_html_e( 'Aug', 'afterpay' ); ?></option>
     135            <option value="09"><?php esc_html_e( 'Sep', 'afterpay' ); ?></option>
     136            <option value="10"><?php esc_html_e( 'Oct', 'afterpay' ); ?></option>
     137            <option value="11"><?php esc_html_e( 'Nov', 'afterpay' ); ?></option>
     138            <option value="12"><?php esc_html_e( 'Dec', 'afterpay' ); ?></option>
     139        </select>
     140        <select class="dob_select dob_year" name="<?php echo esc_attr( $this->id ); ?>_date_of_birth_year">
     141            <option value="">
     142            <?php esc_html_e( 'Jaar', 'afterpay' ); ?>
     143            </option>
     144            <?php
     145                // Select current date and deduct 18 years because of the date limit of using AfterPay.
     146                $year = date( 'Y' ) - 18;
     147                // Select the oldest year (current year minus 100 years).
     148                $lowestyear = $year - 82;
     149            while ( $year >= $lowestyear ) {
     150                echo '<option value="' . esc_attr( $year ) . '">' . esc_html( $year ) . '</option>';
     151                $year--;
     152            }
     153            ?>
     154        </select>
     155        <?php   
    116156
    117157        woocommerce_form_field('toc', array(
  • ing-psp/trunk/classes/class-wc-ingpsp-helper.php

    r1951028 r1958225  
    104104        }
    105105
    106         $birthdate = static::getCustomPaymentField('dob');
    107         if ($birthdate !== null) {
    108             $birthdate_parts = explode('-', $birthdate);
    109             $birthdate = implode('-', [$birthdate_parts[2], $birthdate_parts[1], $birthdate_parts[0]]);
    110         }
     106        $ingpsp_afterpay_date_of_birth_day = static::getCustomPaymentField('ingpsp_afterpay_date_of_birth_day');
     107        $ingpsp_afterpay_date_of_birth_month = static::getCustomPaymentField('ingpsp_afterpay_date_of_birth_month');
     108        $ingpsp_afterpay_date_of_birth_year = static::getCustomPaymentField('ingpsp_afterpay_date_of_birth_year');
     109
     110        $birthdate = implode('-', [$ingpsp_afterpay_date_of_birth_year, $ingpsp_afterpay_date_of_birth_month, $ingpsp_afterpay_date_of_birth_day]);
    111111
    112112        return \GingerPayments\Payment\Common\ArrayFunctions::withoutNullValues([
  • ing-psp/trunk/ing-php/vendor/beberlei/assert/lib/Assert/Assertion.php

    r1951028 r1958225  
    21912191    public static function date($value, $format, $message = null, $propertyPath = null)
    21922192    {
     2193        if (strlen($value) != 10) {
     2194            throw static::createException($value, 'Gelieve geboortedatum in te vullen', static::INVALID_DATE, $propertyPath, array('format' => $format));
     2195        }
    21932196        static::string($value, $message, $propertyPath);
    21942197        static::string($format, $message, $propertyPath);
  • ing-psp/trunk/ingpsp.php

    r1951028 r1958225  
    55 * Plugin URI: https://www.ing.nl/
    66 * Description: ING WooCommerce plugin for ING Kassa Compleet and ING ePay markets.
    7  * Version: 1.3.4
     7 * Version: 1.3.5
    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.4');
     22define('INGPSP_PLUGIN_VERSION', 'WooCommerce v1.3.5');
    2323
    2424add_action('plugins_loaded', 'woocommerce_ingpsp_init', 0);
  • ing-psp/trunk/readme.txt

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