From f5c90757907c84e7793abc5f5cb35d7bd6b6481e Mon Sep 17 00:00:00 2001 From: fraudlabspro Date: Thu, 3 Sep 2020 08:57:51 +0800 Subject: [PATCH] Implement SMS OTP timeout --- Block/Fraudlabsprosmsverificationsend.php | 2 ++ CHANGELOG | 5 ++++- composer.json | 2 +- etc/adminhtml/system.xml | 8 ++++++-- etc/config.xml | 1 + 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Block/Fraudlabsprosmsverificationsend.php b/Block/Fraudlabsprosmsverificationsend.php index adf827f..8ba4986 100644 --- a/Block/Fraudlabsprosmsverificationsend.php +++ b/Block/Fraudlabsprosmsverificationsend.php @@ -26,6 +26,7 @@ public function getOrder($id) public function methodBlock() { $apiKey = ($this->getConfig()->getValue('fraudlabsprosmsverification/active_display/api_key')) ? $this->getConfig()->getValue('fraudlabsprosmsverification/active_display/api_key') : 'API Key cannot be empty.'; + $otpTimeout = ($this->getConfig()->getValue('fraudlabsprosmsverification/active_display/otp_timeout')) ? $this->getConfig()->getValue('fraudlabsprosmsverification/active_display/otp_timeout') : 3600; if ($apiKey == 'Phone number cannot be empty.') return 'API Key cannot be empty.'; $tel = (filter_input(INPUT_POST, 'tel')) ? (filter_input(INPUT_POST, 'tel')) : 'Phone number cannot be empty.'; if ($tel == 'Phone number cannot be empty.') return 'Phone number cannot be empty.'; @@ -38,6 +39,7 @@ public function methodBlock() $params['tel'] = '+' . $params['tel']; $params['mesg'] = ($this->getConfig()->getValue('fraudlabsprosmsverification/active_display/sms_template')) ? $this->getConfig()->getValue('fraudlabsprosmsverification/active_display/sms_template') : 'Hi, your OTP for Magento is {otp}.'; $params['mesg'] = str_replace(['{', '}'], ['<', '>'], $params['mesg']); + $params['otp_timeout'] = $otpTimeout; $url = 'https://api.fraudlabspro.com/v1/verification/send'; $query = ''; diff --git a/CHANGELOG b/CHANGELOG index 2107a75..c084c03 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,4 +6,7 @@ Revision History for FraudLabs Pro Magento 2 Minor fixes. 1.0.2 2019-12-26 - Bug fixes. \ No newline at end of file + Bug fixes. + +1.1.0 2020-09-02 + Implement SMS OTP timeout. \ No newline at end of file diff --git a/composer.json b/composer.json index d43859e..93fe0a9 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "hexasoft/module-fraudlabsprosmsverification", "description": "FraudLabs Pro SMS Verification extension for Magento 2 that help merchants to authenticate the client's identity by sending them a SMS for verification.", - "version": "1.0.2", + "version": "1.1.0", "type": "magento2-module", "require": { "php": "~5.5.0|~5.6.0|~7.0" diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index d9ba0e7..3c36c31 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -27,11 +27,15 @@ {otp} for the generated OTP. The maximum length for SMS template must be less than 140 characters.]]> - + + + + + - + {email_verification_link} tag will be automatically replaced with the page URL for SMS verification, and must not be removed from the email body.]]> diff --git a/etc/config.xml b/etc/config.xml index 7ef73eb..2624c78 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -8,6 +8,7 @@ You are required to verify your phone number using SMS verification. Please make sure you enter the complete phone number (including the country code) and click on the below button to request for an OTP (One Time Password) SMS. Hi, your OTP for Magento is {otp}. + 3600 Action Required: SMS Verification is required to process the order. Dear Customer, Thanks for your business. Before we can continue processing your order, you may require you to click on the link to complete the SMS verification: {email_verification_link} Thank you.