We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit 6eeed37f authored by alessio's avatar alessio Committed by attilak

PW-1103: Added Oneclick support for 3ds2, added temporary TODOs for challengeshopper

parent 44574199
...@@ -23,12 +23,13 @@ ...@@ -23,12 +23,13 @@
namespace Adyen\Payment\Helper; namespace Adyen\Payment\Helper;
use Adyen\Payment\Observer\AdyenOneclickDataAssignObserver;
use Magento\Framework\App\Helper\AbstractHelper; use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Vault\Model\Ui\VaultConfigProvider; use Magento\Vault\Model\Ui\VaultConfigProvider;
use Adyen\Payment\Observer\AdyenHppDataAssignObserver; use Adyen\Payment\Observer\AdyenHppDataAssignObserver;
use Adyen\Payment\Observer\AdyenCcDataAssignObserver; use Adyen\Payment\Observer\AdyenCcDataAssignObserver;
//TODO: enable stateOrProvince field if no issues with empty values
class Requests extends AbstractHelper class Requests extends AbstractHelper
{ {
/** /**
...@@ -148,14 +149,14 @@ class Requests extends AbstractHelper ...@@ -148,14 +149,14 @@ class Requests extends AbstractHelper
"postalCode" => '', "postalCode" => '',
"city" => "N/A", "city" => "N/A",
"houseNumberOrName" => '', "houseNumberOrName" => '',
"stateOrProvince" => '', // "stateOrProvince" => '',
"country" => "ZZ" "country" => "ZZ"
]; ];
// Save the defaults for later to compare if anything has changed // Save the defaults for later to compare if anything has changed
$requestBilling = $requestBillingDefaults; $requestBilling = $requestBillingDefaults;
$address = $this->getStreetStringFromBillingAddress($billingAddress); $address = $this->getStreetStringFromAddress($billingAddress);
if (!empty($address["name"])) { if (!empty($address["name"])) {
$requestBilling["street"] = $address["name"]; $requestBilling["street"] = $address["name"];
...@@ -173,9 +174,9 @@ class Requests extends AbstractHelper ...@@ -173,9 +174,9 @@ class Requests extends AbstractHelper
$requestBilling["city"] = $billingAddress->getCity(); $requestBilling["city"] = $billingAddress->getCity();
} }
if (!empty($billingAddress->getRegionCode())) { // if (!empty($billingAddress->getRegionCode())) {
$requestBilling["stateOrProvince"] = $billingAddress->getRegionCode(); // $requestBilling["stateOrProvince"] = $billingAddress->getRegionCode();
} // }
if (!empty($billingAddress->getCountryId())) { if (!empty($billingAddress->getCountryId())) {
$requestBilling["country"] = $billingAddress->getCountryId(); $requestBilling["country"] = $billingAddress->getCountryId();
...@@ -195,7 +196,7 @@ class Requests extends AbstractHelper ...@@ -195,7 +196,7 @@ class Requests extends AbstractHelper
"postalCode" => '', "postalCode" => '',
"city" => "N/A", "city" => "N/A",
"houseNumberOrName" => '', "houseNumberOrName" => '',
"stateOrProvince" => '', // "stateOrProvince" => '',
"country" => "ZZ" "country" => "ZZ"
]; ];
...@@ -203,7 +204,7 @@ class Requests extends AbstractHelper ...@@ -203,7 +204,7 @@ class Requests extends AbstractHelper
$requestDelivery = $requestDeliveryDefaults; $requestDelivery = $requestDeliveryDefaults;
// Parse address into street and house number where possible // Parse address into street and house number where possible
$address = $this->adyenHelper->getStreetFromString($shippingAddress->getStreetFull()); $address = $this->getStreetStringFromAddress($shippingAddress);
if (!empty($address['name'])) { if (!empty($address['name'])) {
$requestDelivery["street"] = $address["name"]; $requestDelivery["street"] = $address["name"];
...@@ -221,9 +222,9 @@ class Requests extends AbstractHelper ...@@ -221,9 +222,9 @@ class Requests extends AbstractHelper
$requestDelivery["city"] = $shippingAddress->getCity(); $requestDelivery["city"] = $shippingAddress->getCity();
} }
if (!empty($shippingAddress->getRegionCode())) { // if (!empty($shippingAddress->getRegionCode())) {
$requestDelivery["stateOrProvince"] = $shippingAddress->getRegionCode(); // $requestDelivery["stateOrProvince"] = $shippingAddress->getRegionCode();
} // }
if (!empty($shippingAddress->getCountryId())) { if (!empty($shippingAddress->getCountryId())) {
$requestDelivery["country"] = $shippingAddress->getCountryId(); $requestDelivery["country"] = $shippingAddress->getCountryId();
...@@ -288,8 +289,8 @@ class Requests extends AbstractHelper ...@@ -288,8 +289,8 @@ class Requests extends AbstractHelper
$request['browserInfo']['screenHeight'] = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::SCREEN_HEIGHT); $request['browserInfo']['screenHeight'] = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::SCREEN_HEIGHT);
$request['browserInfo']['colorDepth'] = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::SCREEN_COLOR_DEPTH); $request['browserInfo']['colorDepth'] = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::SCREEN_COLOR_DEPTH);
$request['browserInfo']['timeZoneOffset'] = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::TIMEZONE_OFFSET); $request['browserInfo']['timeZoneOffset'] = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::TIMEZONE_OFFSET);
$request['browserInfo']['language'] = $this->adyenHelper->getCurrentLocaleCode($store); $request['browserInfo']['language'] = "nl-NL";//$this->adyenHelper->getCurrentLocaleCode($store); TODO change format to nl-NL instead of nl_NL
$request['browserInfo']['javaEnabled'] = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::JAVA_ENABLED); $request['browserInfo']['javaEnabled'] = false; //$payment->getAdditionalInformation(AdyenCcDataAssignObserver::JAVA_ENABLED);TODO make sure it is not passed as null
// uset browser related data from additional information // uset browser related data from additional information
$payment->unsAdditionalInformation(AdyenCcDataAssignObserver::SCREEN_WIDTH); $payment->unsAdditionalInformation(AdyenCcDataAssignObserver::SCREEN_WIDTH);
...@@ -370,6 +371,10 @@ class Requests extends AbstractHelper ...@@ -370,6 +371,10 @@ class Requests extends AbstractHelper
$request['paymentMethod']['encryptedSecurityCode'] = $securityCode; $request['paymentMethod']['encryptedSecurityCode'] = $securityCode;
} }
if ($recurringDetailReference = $payment->getAdditionalInformation(AdyenOneclickDataAssignObserver::RECURRING_DETAIL_REFERENCE)) {
$request['paymentMethod']['recurringDetailReference'] = $recurringDetailReference;
}
// Remove from additional information // Remove from additional information
$payment->unsAdditionalInformation(AdyenCcDataAssignObserver::ENCRYPTED_CREDIT_CARD_NUMBER); $payment->unsAdditionalInformation(AdyenCcDataAssignObserver::ENCRYPTED_CREDIT_CARD_NUMBER);
$payment->unsAdditionalInformation(AdyenCcDataAssignObserver::ENCRYPTED_EXPIRY_MONTH); $payment->unsAdditionalInformation(AdyenCcDataAssignObserver::ENCRYPTED_EXPIRY_MONTH);
...@@ -424,13 +429,13 @@ class Requests extends AbstractHelper ...@@ -424,13 +429,13 @@ class Requests extends AbstractHelper
* @param $billingAddress * @param $billingAddress
* @return array * @return array
*/ */
private function getStreetStringFromBillingAddress($billingAddress) private function getStreetStringFromAddress($address)
{ {
if (method_exists($billingAddress, 'getStreetFull')) { if (method_exists($address, 'getStreetFull')) {
// Parse address into street and house number where possible // Parse address into street and house number where possible
$address = $this->adyenHelper->getStreetFromString($billingAddress->getStreetFull()); $address = $this->adyenHelper->getStreetFromString($address->getStreetFull());
} else { } else {
$address = $this->adyenHelper->getStreetFromString($billingAddress->getStreetLine1()); $address = $this->adyenHelper->getStreetFromString($address->getStreetLine1());
} }
return $address; return $address;
......
...@@ -35,6 +35,11 @@ class AdyenOneclickDataAssignObserver extends AbstractDataAssignObserver ...@@ -35,6 +35,11 @@ class AdyenOneclickDataAssignObserver extends AbstractDataAssignObserver
const ENCRYPTED_SECURITY_CODE = 'cvc'; const ENCRYPTED_SECURITY_CODE = 'cvc';
const NUMBER_OF_INSTALLMENTS = 'number_of_installments'; const NUMBER_OF_INSTALLMENTS = 'number_of_installments';
const VARIANT = 'variant'; const VARIANT = 'variant';
const JAVA_ENABLED = 'java_enabled';
const SCREEN_COLOR_DEPTH = 'screen_color_depth';
const SCREEN_WIDTH = 'screen_width';
const SCREEN_HEIGHT = 'screen_height';
const TIMEZONE_OFFSET = 'timezone_offset';
/** /**
* @var array * @var array
...@@ -43,7 +48,12 @@ class AdyenOneclickDataAssignObserver extends AbstractDataAssignObserver ...@@ -43,7 +48,12 @@ class AdyenOneclickDataAssignObserver extends AbstractDataAssignObserver
self::RECURRING_DETAIL_REFERENCE, self::RECURRING_DETAIL_REFERENCE,
self::ENCRYPTED_SECURITY_CODE, self::ENCRYPTED_SECURITY_CODE,
self::NUMBER_OF_INSTALLMENTS, self::NUMBER_OF_INSTALLMENTS,
self::VARIANT self::VARIANT,
self::JAVA_ENABLED,
self::SCREEN_COLOR_DEPTH,
self::SCREEN_WIDTH,
self::SCREEN_HEIGHT,
self::TIMEZONE_OFFSET
]; ];
/** /**
......
...@@ -528,15 +528,7 @@ ...@@ -528,15 +528,7 @@
<virtualType name="AdyenPaymentOneclickAuthorizeRequest" type="Magento\Payment\Gateway\Request\BuilderComposite"> <virtualType name="AdyenPaymentOneclickAuthorizeRequest" type="Magento\Payment\Gateway\Request\BuilderComposite">
<arguments> <arguments>
<argument name="builders" xsi:type="array"> <argument name="builders" xsi:type="array">
<item name="merchantaccount" xsi:type="string">Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder</item>
<item name="customer" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerDataBuilder</item>
<item name="customerip" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerIpDataBuilder</item>
<item name="address" xsi:type="string">Adyen\Payment\Gateway\Request\AddressDataBuilder</item>
<item name="payment" xsi:type="string">Adyen\Payment\Gateway\Request\PaymentDataBuilder</item>
<item name="browserinfo" xsi:type="string">Adyen\Payment\Gateway\Request\BrowserInfoDataBuilder</item>
<item name="recurring" xsi:type="string">Adyen\Payment\Gateway\Request\RecurringDataBuilder</item>
<item name="transaction" xsi:type="string">Adyen\Payment\Gateway\Request\CcAuthorizationDataBuilder</item> <item name="transaction" xsi:type="string">Adyen\Payment\Gateway\Request\CcAuthorizationDataBuilder</item>
<item name="oneclick" xsi:type="string">Adyen\Payment\Gateway\Request\OneclickAuthorizationDataBuilder</item>
</argument> </argument>
</arguments> </arguments>
</virtualType> </virtualType>
......
...@@ -134,6 +134,11 @@ ...@@ -134,6 +134,11 @@
</div> </div>
</div> </div>
<!-- /ko --> <!-- /ko -->
<div id="threeDS2ModalOneClick">
<div id="threeDS2ContainerOneClick"></div>
</div>
</fieldset> </fieldset>
</form> </form>
<div class="checkout-agreements-block"> <div class="checkout-agreements-block">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment