From 214ca6f613ef91dcc12ef4d576dc7a2d863d499c Mon Sep 17 00:00:00 2001 From: serucee Date: Fri, 9 Nov 2018 11:24:02 +0100 Subject: [PATCH 1/3] #16 Update bancontact naming and birthdate validation --- .../wirecardceecheckoutpage.php | 37 ++++++++++++++++--- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/wirecardceecheckoutpage/wirecardceecheckoutpage.php b/wirecardceecheckoutpage/wirecardceecheckoutpage.php index b103ed4..e18d18f 100644 --- a/wirecardceecheckoutpage/wirecardceecheckoutpage.php +++ b/wirecardceecheckoutpage/wirecardceecheckoutpage.php @@ -102,7 +102,7 @@ class WirecardCEECheckoutPage extends PaymentModule const WCP_PT_TRUSTPAY = 'WCP_PT_TRUSTPAY'; const WCP_PT_INVOICE = 'WCP_PT_INVOICE'; const WCP_PT_INSTALLMENT = 'WCP_PT_INSTALLMENT'; - const WCP_PT_BANCONTACT = 'WCP_PT_BANCONTACT'; + const WCP_PT_BANCONTACT_MISTERCASH = 'WCP_PT_BANCONTACT_MISTERCASH'; const WCP_PT_P24 = 'WCP_PT_PRZELEWY24'; const WCP_PT_MONETA = 'WCP_PT_MONETA'; const WCP_PT_POLI = 'WCP_PT_POLI'; @@ -1280,6 +1280,7 @@ private function initiate($paymentType, $additionalData) $init = $this->setConsumerInformation($init); } + return $init->initiate()->getRedirectUrl(); } @@ -1330,14 +1331,38 @@ private function setConsumerInformation(WirecardCEE_QPay_FrontendClient $request ->setIpAddress($this->getConsumerIpAddress()); $customer = new Customer($this->getOrder()->id_customer); - $consumerData->setBirthDate(DateTime::createFromFormat("Y-m-d", $customer->birthday)) - ->setEmail($customer->email); - $request->setConsumerData($consumerData); + $consumerData->setBirthDate($this->getValidDate($customer->birthday, "Y-m-d")) + ->setEmail($customer->email); return $request; } + /* + * Returns today's date if $date is invalid + */ + public function getValidDate($date, $format) + { + if (!empty($date) && strtotime($date) !== false) { + if ($this->isValidDateFormat($date)) { + return DateTime::createFromFormat($format, $date); + } + } + return new DateTime(); + } + + /* + * Checks if format is Y-m-d + */ + public function isValidDateFormat($date) + { + if (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $date)) { + return true; + } else { + return false; + } + } + public function confirmResponse() { if (!$this->active) { @@ -1518,7 +1543,7 @@ private function getPaymentTypes() self::WCP_PT_EPS, self::WCP_PT_IDL, self::WCP_PT_GIROPAY, self::WCP_PT_TATRAPAY, self::WCP_PT_SOFORTUEBERWEISUNG, self::WCP_PT_PBX, self::WCP_PT_QUICK, self::WCP_PT_PAYPAL, self::WCP_PT_EPAY_BG, self::WCP_PT_SEPA_DD, self::WCP_PT_TRUSTPAY, self::WCP_PT_INVOICE, - self::WCP_PT_INSTALLMENT, self::WCP_PT_BANCONTACT, self::WCP_PT_P24, self::WCP_PT_MONETA, + self::WCP_PT_INSTALLMENT, self::WCP_PT_BANCONTACT_MISTERCASH, self::WCP_PT_P24, self::WCP_PT_MONETA, self::WCP_PT_POLI, self::WCP_PT_EKONTO, self::WCP_PT_TRUSTLY, self::WCP_PT_SKRILLWALLET, self::WCP_PT_VOUCHER); } @@ -1580,7 +1605,7 @@ private function getPaymentTypeInfo($type) case self::WCP_PT_INSTALLMENT: return array('title' => $this->l('Installment'), 'value' => WirecardCEE_QPay_PaymentType::INSTALLMENT); - case self::WCP_PT_BANCONTACT: + case self::WCP_PT_BANCONTACT_MISTERCASH: return array('title' => $this->l('Bancontact'), 'value' => WirecardCEE_QPay_PaymentType::BMC); case self::WCP_PT_P24: From b528010198df78d80a41ccf39becae28495ff95c Mon Sep 17 00:00:00 2001 From: serucee Date: Fri, 9 Nov 2018 11:26:03 +0100 Subject: [PATCH 2/3] #16 Update version --- wirecardceecheckoutpage/config.xml | 2 +- wirecardceecheckoutpage/wirecardceecheckoutpage.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wirecardceecheckoutpage/config.xml b/wirecardceecheckoutpage/config.xml index f24eab3..a398224 100644 --- a/wirecardceecheckoutpage/config.xml +++ b/wirecardceecheckoutpage/config.xml @@ -2,7 +2,7 @@ wirecardceecheckoutpage - 2.1.3 + 2.1.4 Wirecard diff --git a/wirecardceecheckoutpage/wirecardceecheckoutpage.php b/wirecardceecheckoutpage/wirecardceecheckoutpage.php index e18d18f..a162e8e 100644 --- a/wirecardceecheckoutpage/wirecardceecheckoutpage.php +++ b/wirecardceecheckoutpage/wirecardceecheckoutpage.php @@ -143,7 +143,7 @@ public function __construct() $this->config = $this->config(); $this->name = 'wirecardceecheckoutpage'; $this->tab = 'payments_gateways'; - $this->version = '2.1.3'; + $this->version = '2.1.4'; $this->author = 'Wirecard'; $this->controllers = array('breakoutIFrame', 'confirm', 'payment', 'paymentIFrame'); $this->is_eu_compatible = 1; From 976502bf07658e77676f70f916fe7ae8dd82d538 Mon Sep 17 00:00:00 2001 From: serucee Date: Mon, 12 Nov 2018 09:58:20 +0100 Subject: [PATCH 3/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index eb28837..01d2020 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Wirecard Checkout Page plugin for PrestaShop [![License](https://img.shields.io/badge/license-GPLv2-blue.svg)](https://raw.githubusercontent.com/wirecard/prestashop-wcp/master/LICENSE) -[![PrestaShop](https://img.shields.io/badge/PrestaShop-v1.7.2.2-green.svg)](https://www.prestashop.com/) +[![PrestaShop](https://img.shields.io/badge/PrestaShop-v1.7.4.3-green.svg)](https://www.prestashop.com/) [![PHP v5.6](https://img.shields.io/badge/php-v5.6-yellow.svg)](http://www.php.net) [![PHP v7.0](https://img.shields.io/badge/php-v7.0-yellow.svg)](http://www.php.net) [![PHP v7.1](https://img.shields.io/badge/php-v7.1-yellow.svg)](http://www.php.net)