public function getConfig()
 {
     $config = parent::getConfig();
     $demoMode = $this->adyenHelper->getAdyenAbstractConfigDataFlag('demo_mode');
     if ($demoMode) {
         $cseKey = $this->adyenHelper->getAdyenCcConfigData('cse_publickey_test');
     } else {
         $cseKey = $this->adyenHelper->getAdyenCcConfigData('cse_publickey_live');
     }
     $cseEnabled = $this->adyenHelper->getAdyenCcConfigDataFlag('cse_enabled');
     $recurringType = $this->adyenHelper->getAdyenAbstractConfigData('recurring_type');
     $canCreateBillingAgreement = false;
     if ($recurringType == "ONECLICK" || $recurringType == "ONECLICK,RECURRING") {
         $canCreateBillingAgreement = true;
     }
     $config['payment']['adyenCc']['cseKey'] = $cseKey;
     $config['payment']['adyenCc']['cseEnabled'] = $cseEnabled;
     $config['payment']['adyenCc']['cseEnabled'] = $cseEnabled;
     $config['payment']['adyenCc']['generationTime'] = date("c");
     $config['payment']['adyenCc']['canCreateBillingAgreement'] = $canCreateBillingAgreement;
     foreach ($this->methodCodes as $code) {
         if ($this->methods[$code]->isAvailable()) {
             $config['payment']['adyenCc']['redirectUrl'][$code] = $this->getMethodRedirectUrl($code);
         }
     }
     return $config;
 }
 /**
  * @return bool
  */
 protected function _showLogos()
 {
     $showLogos = $this->_adyenHelper->getAdyenAbstractConfigData('title_renderer');
     if ($showLogos == \Adyen\Payment\Model\Config\Source\RenderMode::MODE_TITLE_IMAGE) {
         return true;
     }
     return false;
 }
 /**
  * @param array $buildSubject
  * @return array
  */
 public function build(array $buildSubject)
 {
     /** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
     $paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject);
     $order = $paymentDataObject->getOrder();
     $storeId = $order->getStoreId();
     $merchantAccount = $this->adyenHelper->getAdyenAbstractConfigData("merchant_account", $storeId);
     return ["merchantAccount" => $merchantAccount];
 }
示例#4
0
 /**
  * @param array $commandSubject
  * @return $this
  */
 public function execute(array $commandSubject)
 {
     $payment = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($commandSubject);
     $stateObject = \Magento\Payment\Gateway\Helper\SubjectReader::readStateObject($commandSubject);
     // do not send email
     $payment = $payment->getPayment();
     $payment->getOrder()->setCanSendNewEmailFlag(false);
     // update status and state
     $stateObject->setState(\Magento\Sales\Model\Order::STATE_NEW);
     $stateObject->setStatus($this->_adyenHelper->getAdyenAbstractConfigData('order_status'));
     $stateObject->setIsNotified(false);
     return $this;
 }
 /**
  * @return array
  */
 public function getConfig()
 {
     // set to active
     $config = ['payment' => [self::CODE => ['isActive' => true, 'redirectUrl' => $this->_urlBuilder->getUrl('adyen/process/validate3d/', ['_secure' => $this->_getRequest()->isSecure()])]]];
     $methodCode = self::CODE;
     $config = array_merge_recursive($config, ['payment' => ['ccform' => ['availableTypes' => [$methodCode => $this->getCcAvailableTypes($methodCode)], 'months' => [$methodCode => $this->getCcMonths()], 'years' => [$methodCode => $this->getCcYears()], 'hasVerification' => [$methodCode => $this->hasVerification($methodCode)], 'cvvImageUrl' => [$methodCode => $this->getCvvImageUrl()]]]]);
     $demoMode = $this->_adyenHelper->getAdyenAbstractConfigDataFlag('demo_mode');
     if ($demoMode) {
         $cseKey = $this->_adyenHelper->getAdyenCcConfigData('cse_publickey_test');
     } else {
         $cseKey = $this->_adyenHelper->getAdyenCcConfigData('cse_publickey_live');
     }
     $cseEnabled = $this->_adyenHelper->getAdyenCcConfigDataFlag('cse_enabled');
     $recurringType = $this->_adyenHelper->getAdyenAbstractConfigData('recurring_type');
     $canCreateBillingAgreement = false;
     if ($recurringType == "ONECLICK" || $recurringType == "ONECLICK,RECURRING") {
         $canCreateBillingAgreement = true;
     }
     $config['payment']['adyenOneclick']['cseKey'] = $cseKey;
     $config['payment']['adyenOneclick']['cseEnabled'] = $cseEnabled;
     $config['payment']['adyenOneclick']['cseEnabled'] = $cseEnabled;
     $config['payment']['adyenOneclick']['generationTime'] = date("c");
     $config['payment']['adyenOneclick']['canCreateBillingAgreement'] = $canCreateBillingAgreement;
     $recurringContractType = $this->_getRecurringContractType();
     $config['payment']['adyenOneclick']['billingAgreements'] = $this->getAdyenOneclickPaymentMethods();
     if ($recurringContractType == \Adyen\Payment\Model\RecurringType::ONECLICK) {
         $config['payment']['adyenOneclick']['hasCustomerInteraction'] = true;
     } else {
         $config['payment']['adyenOneclick']['hasCustomerInteraction'] = false;
     }
     return $config;
 }
示例#6
0
 public function getFormFields()
 {
     $paymentInfo = $this->getInfoInstance();
     $order = $paymentInfo->getOrder();
     $realOrderId = $order->getRealOrderId();
     $orderCurrencyCode = $order->getOrderCurrencyCode();
     $skinCode = trim($this->getConfigData('skin_code'));
     $amount = $this->_adyenHelper->formatAmount($order->getGrandTotal(), $orderCurrencyCode);
     $merchantAccount = trim($this->_adyenHelper->getAdyenAbstractConfigData('merchant_account'));
     $shopperEmail = $order->getCustomerEmail();
     $customerId = $order->getCustomerId();
     $shopperIP = $order->getRemoteIp();
     $browserInfo = $_SERVER['HTTP_USER_AGENT'];
     $deliveryDays = $this->getConfigData('delivery_days');
     $shopperLocale = trim($this->getConfigData('shopper_locale'));
     $shopperLocale = !empty($shopperLocale) ? $shopperLocale : $this->resolver->getLocale();
     $countryCode = trim($this->getConfigData('country_code'));
     $countryCode = !empty($countryCode) ? $countryCode : false;
     // if directory lookup is enabled use the billingadress as countrycode
     if ($countryCode == false) {
         if ($order->getBillingAddress() && $order->getBillingAddress()->getCountryId() != "") {
             $countryCode = $order->getBillingAddress()->getCountryId();
         }
     }
     $formFields = array();
     $formFields['merchantAccount'] = $merchantAccount;
     $formFields['merchantReference'] = $realOrderId;
     $formFields['paymentAmount'] = (int) $amount;
     $formFields['currencyCode'] = $orderCurrencyCode;
     $formFields['shipBeforeDate'] = date("Y-m-d", mktime(date("H"), date("i"), date("s"), date("m"), date("j") + $deliveryDays, date("Y")));
     $formFields['skinCode'] = $skinCode;
     $formFields['shopperLocale'] = $shopperLocale;
     $formFields['countryCode'] = $countryCode;
     $formFields['shopperIP'] = $shopperIP;
     $formFields['browserInfo'] = $browserInfo;
     $formFields['sessionValidity'] = date(DATE_ATOM, mktime(date("H") + 1, date("i"), date("s"), date("m"), date("j"), date("Y")));
     $formFields['shopperEmail'] = $shopperEmail;
     // recurring
     $recurringType = trim($this->_adyenHelper->getAdyenAbstractConfigData('recurring_type'));
     $formFields['recurringContract'] = $recurringType;
     $formFields['shopperReference'] = !empty($customerId) ? $customerId : self::GUEST_ID . $realOrderId;
     //blocked methods
     $formFields['blockedMethods'] = "";
     $baseUrl = $this->storeManager->getStore($this->getStore())->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK);
     $formFields['resURL'] = $baseUrl . 'adyen/process/result';
     $hmacKey = $this->_adyenHelper->getHmac();
     $brandCode = $this->getInfoInstance()->getCcType();
     if ($brandCode) {
         $formFields['brandCode'] = $brandCode;
     }
     // Sort the array by key using SORT_STRING order
     ksort($formFields, SORT_STRING);
     // Generate the signing data string
     $signData = implode(":", array_map(array($this, 'escapeString'), array_merge(array_keys($formFields), array_values($formFields))));
     $merchantSig = base64_encode(hash_hmac('sha256', $signData, pack("H*", $hmacKey), true));
     $formFields['merchantSig'] = $merchantSig;
     $this->_adyenLogger->info(print_r($formFields, true));
     return $formFields;
 }
 /**
  * @param array $buildSubject
  * @return array
  */
 public function build(array $buildSubject)
 {
     $result = [];
     /** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
     $paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject);
     $payment = $paymentDataObject->getPayment();
     // Needs to change when oneclick,cc using facade impl.
     $paymentMethodCode = $payment->getMethodInstance()->getCode();
     $storeId = null;
     if ($this->appState->getAreaCode() === \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) {
         $storeId = $payment->getOrder()->getStoreId();
     }
     $recurringType = $this->adyenHelper->getAdyenAbstractConfigData('recurring_type', $storeId);
     // set the recurring type
     $recurringContractType = null;
     if ($recurringType) {
         if ($paymentMethodCode == \Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider::CODE) {
             /*
              * For ONECLICK look at the recurringPaymentType that the merchant
              * has selected in Adyen ONECLICK settings
              */
             if ($payment->getAdditionalInformation('customer_interaction')) {
                 $recurringContractType = \Adyen\Payment\Model\RecurringType::ONECLICK;
             } else {
                 $recurringContractType = \Adyen\Payment\Model\RecurringType::RECURRING;
             }
         } else {
             if ($paymentMethodCode == \Adyen\Payment\Model\Ui\AdyenCcConfigProvider::CODE) {
                 if ($payment->getAdditionalInformation("store_cc") == "" && ($recurringType == "ONECLICK,RECURRING" || $recurringType == "RECURRING")) {
                     $recurringContractType = \Adyen\Payment\Model\RecurringType::RECURRING;
                 } elseif ($payment->getAdditionalInformation("store_cc") == "1") {
                     $recurringContractType = $recurringType;
                 }
             } else {
                 $recurringContractType = $recurringType;
             }
         }
     }
     if ($recurringContractType) {
         $recurring = ['contract' => $recurringContractType];
         $result['recurring'] = $recurring;
     }
     return $result;
 }
 public function authorise3d($payment)
 {
     $order = $payment->getOrder();
     $merchantAccount = $this->_adyenHelper->getAdyenAbstractConfigData("merchant_account");
     $shopperIp = $order->getRemoteIp();
     $md = $payment->getAdditionalInformation('md');
     $paResponse = $payment->getAdditionalInformation('paResponse');
     $request = array("action" => "Payment.authorise3d", "paymentRequest3d.merchantAccount" => $merchantAccount, "paymentRequest3d.browserInfo.userAgent" => $_SERVER['HTTP_USER_AGENT'], "paymentRequest3d.browserInfo.acceptHeader" => $_SERVER['HTTP_ACCEPT'], "paymentRequest3d.md" => $md, "paymentRequest3d.paResponse" => $paResponse, "paymentRequest3d.shopperIP" => $shopperIp);
     return $this->_apiRequest($request);
 }
示例#9
0
 /**
  * @param $store
  * @return mixed|string
  */
 protected function _getCurrentLocaleCode($store)
 {
     $localeCode = $this->_adyenHelper->getAdyenAbstractConfigData('shopper_locale', $store->getId());
     if ($localeCode != "") {
         return $localeCode;
     }
     $locale = $this->_localeResolver->getLocale();
     if ($locale) {
         return $locale;
     }
     // should have the vulue if not fall back to default
     $localeCode = $this->_config->getValue(Data::XML_PATH_DEFAULT_LOCALE, \Magento\Store\Model\ScopeInterface::SCOPE_STORES, $store->getCode());
     return $localeCode;
 }
示例#10
0
 /**
  * @param array $commandSubject
  * @return $this
  */
 public function execute(array $commandSubject)
 {
     $payment = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($commandSubject);
     $stateObject = \Magento\Payment\Gateway\Helper\SubjectReader::readStateObject($commandSubject);
     // do not send email
     $payment = $payment->getPayment();
     $order = $payment->getOrder();
     $order->setCanSendNewEmailFlag(false);
     // update customer based on additionalFields
     if ($payment->getAdditionalInformation("gender")) {
         $order->setCustomerGender(\Adyen\Payment\Model\Gender::getMagentoGenderFromAdyenGender($payment->getAdditionalInformation("gender")));
     }
     if ($payment->getAdditionalInformation("dob")) {
         $order->setCustomerDob($payment->getAdditionalInformation("dob"));
     }
     if ($payment->getAdditionalInformation("telephone")) {
         $order->getBillingAddress()->setTelephone($payment->getAdditionalInformation("telephone"));
     }
     // update status and state
     $stateObject->setState(\Magento\Sales\Model\Order::STATE_NEW);
     $stateObject->setStatus($this->_adyenHelper->getAdyenAbstractConfigData('order_status'));
     $stateObject->setIsNotified(false);
     return $this;
 }
示例#11
0
 /**
  * Disable a recurring contract
  *
  * @param $recurringDetailReference
  * @param $shopperReference
  * @param $storeId
  * @return bool
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function disableRecurringContract($recurringDetailReference, $shopperReference, $storeId)
 {
     $merchantAccount = $this->_adyenHelper->getAdyenAbstractConfigData("merchant_account", $storeId);
     $request = ["merchantAccount" => $merchantAccount, "shopperReference" => $shopperReference, "recurringDetailReference" => $recurringDetailReference];
     // call lib
     $service = new \Adyen\Service\Recurring($this->_client);
     try {
         $result = $service->disable($request);
     } catch (\Exception $e) {
         $this->_adyenLogger->info($e->getMessage());
     }
     if (isset($result['response']) && $result['response'] == '[detail-successfully-disabled]') {
         return true;
     } else {
         throw new \Magento\Framework\Exception\LocalizedException(__('Failed to disable this contract'));
     }
 }
示例#12
0
 /**
  * @desc HTTP Authentication of the notification
  * @param $response
  */
 protected function authorised($response)
 {
     // Add CGI support
     $this->_fixCgiHttpAuthentication();
     $internalMerchantAccount = $this->_adyenHelper->getAdyenAbstractConfigData('merchant_account');
     $username = $this->_adyenHelper->getAdyenAbstractConfigData('notification_username');
     $password = $this->_adyenHelper->getNotificationPassword();
     $submitedMerchantAccount = $response['merchantAccountCode'];
     if (empty($submitedMerchantAccount) && empty($internalMerchantAccount)) {
         if (strtolower(substr($response['pspReference'], 0, 17)) == "testnotification_" || strtolower(substr($response['pspReference'], 0, 5)) == "test_") {
             echo 'merchantAccountCode is empty in magento settings';
             exit;
         }
         return false;
     }
     // validate username and password
     if (!isset($_SERVER['PHP_AUTH_USER']) && !isset($_SERVER['PHP_AUTH_PW'])) {
         if (strtolower(substr($response['pspReference'], 0, 17)) == "testnotification_" || strtolower(substr($response['pspReference'], 0, 5)) == "test_") {
             echo 'Authentication failed: PHP_AUTH_USER and PHP_AUTH_PW are empty. See Adyen Magento manual CGI mode';
             exit;
         }
         return false;
     }
     $accountCmp = !$this->_adyenHelper->getAdyenAbstractConfigDataFlag('multiple_merchants') ? strcmp($submitedMerchantAccount, $internalMerchantAccount) : 0;
     $usernameCmp = strcmp($_SERVER['PHP_AUTH_USER'], $username);
     $passwordCmp = strcmp($_SERVER['PHP_AUTH_PW'], $password);
     if ($accountCmp === 0 && $usernameCmp === 0 && $passwordCmp === 0) {
         return true;
     }
     // If notification is test check if fields are correct if not return error
     if (strtolower(substr($response['pspReference'], 0, 17)) == "testnotification_" || strtolower(substr($response['pspReference'], 0, 5)) == "test_") {
         if ($accountCmp != 0) {
             echo 'MerchantAccount in notification is not the same as in Magento settings';
             exit;
         } elseif ($usernameCmp != 0 || $passwordCmp != 0) {
             echo 'username (PHP_AUTH_USER) and\\or password (PHP_AUTH_PW) are not the same as Magento settings';
             exit;
         }
     }
     return false;
 }
示例#13
0
 /**
  * @param $payment
  * @return array
  */
 protected function getFormFields($payment)
 {
     $order = $payment->getOrder();
     $realOrderId = $order->getRealOrderId();
     $orderCurrencyCode = $order->getOrderCurrencyCode();
     // check if paybymail has it's own skin
     $skinCode = trim($this->_adyenHelper->getAdyenPayByMailConfigData('skin_code'));
     if ($skinCode == "") {
         // use HPP skin and HMAC
         $skinCode = $this->_adyenHelper->getAdyenHppConfigData('skin_code');
         $hmacKey = $this->_adyenHelper->getHmac();
     } else {
         // use pay_by_mail skin and hmac
         $hmacKey = $this->_adyenHelper->getHmacPayByMail();
     }
     $amount = $this->_adyenHelper->formatAmount($order->getGrandTotal(), $orderCurrencyCode);
     $merchantAccount = trim($this->_adyenHelper->getAdyenAbstractConfigData('merchant_account'));
     $shopperEmail = $order->getCustomerEmail();
     $customerId = $order->getCustomerId();
     $shopperLocale = trim($this->_adyenHelper->getAdyenHppConfigData('shopper_locale'));
     $shopperLocale = !empty($shopperLocale) ? $shopperLocale : $this->_resolver->getLocale();
     $countryCode = trim($this->_adyenHelper->getAdyenHppConfigData('country_code'));
     $countryCode = !empty($countryCode) ? $countryCode : false;
     // if directory lookup is enabled use the billingadress as countrycode
     if ($countryCode == false) {
         if (is_object($order->getBillingAddress()) && $order->getBillingAddress()->getCountry() != "") {
             $countryCode = $order->getBillingAddress()->getCountry();
         } else {
             $countryCode = "";
         }
     }
     $deliveryDays = $this->_adyenHelper->getAdyenHppConfigData('delivery_days');
     $deliveryDays = !empty($deliveryDays) ? $deliveryDays : 5;
     $formFields = [];
     $formFields['merchantAccount'] = $merchantAccount;
     $formFields['merchantReference'] = $realOrderId;
     $formFields['paymentAmount'] = (int) $amount;
     $formFields['currencyCode'] = $orderCurrencyCode;
     $formFields['shipBeforeDate'] = date("Y-m-d", mktime(date("H"), date("i"), date("s"), date("m"), date("j") + $deliveryDays, date("Y")));
     $formFields['skinCode'] = $skinCode;
     $formFields['shopperLocale'] = $shopperLocale;
     if ($countryCode != "") {
         $formFields['countryCode'] = $countryCode;
     }
     $formFields['shopperEmail'] = $shopperEmail;
     // recurring
     $recurringType = trim($this->_adyenHelper->getAdyenAbstractConfigData('recurring_type'));
     $formFields['recurringContract'] = $recurringType;
     $sessionValidity = $this->_adyenHelper->getAdyenPayByMailConfigData('session_validity');
     if ($sessionValidity == "") {
         $sessionValidity = 3;
     }
     $formFields['sessionValidity'] = date("c", strtotime("+" . $sessionValidity . " days"));
     $formFields['shopperReference'] = !empty($customerId) ? $customerId : self::GUEST_ID . $realOrderId;
     // Sort the array by key using SORT_STRING order
     ksort($formFields, SORT_STRING);
     // Generate the signing data string
     $signData = implode(":", array_map([$this, 'escapeString'], array_merge(array_keys($formFields), array_values($formFields))));
     $merchantSig = base64_encode(hash_hmac('sha256', $signData, pack("H*", $hmacKey), true));
     $formFields['merchantSig'] = $merchantSig;
     $this->_adyenLogger->addAdyenDebug(print_r($formFields, true));
     return $formFields;
 }
示例#14
0
 /**
  * @param array $buildSubject
  * @return array
  */
 public function build(array $buildSubject)
 {
     /** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
     $paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject);
     $amount = \Magento\Payment\Gateway\Helper\SubjectReader::readAmount($buildSubject);
     $order = $paymentDataObject->getOrder();
     $payment = $paymentDataObject->getPayment();
     $pspReference = $payment->getCcTransId();
     $currency = $payment->getOrder()->getOrderCurrencyCode();
     $storeId = $order->getStoreId();
     $merchantAccount = $this->adyenHelper->getAdyenAbstractConfigData("merchant_account", $storeId);
     $grandTotal = $payment->getOrder()->getGrandTotal();
     // check if it contains a split payment
     $orderPaymentCollection = $this->orderPaymentCollectionFactory->create()->addFieldToFilter('payment_id', $payment->getId());
     // partial refund if multiple payments check refund strategy
     if ($orderPaymentCollection->getSize() > 1) {
         $refundStrategy = $this->adyenHelper->getAdyenAbstractConfigData('split_payments_refund_strategy', $order->getStoreId());
         $ratio = null;
         if ($refundStrategy == "1") {
             // Refund in ascending order
             $orderPaymentCollection->addPaymentFilterAscending($payment->getId());
         } elseif ($refundStrategy == "2") {
             // Refund in descending order
             $orderPaymentCollection->addPaymentFilterDescending($payment->getId());
         } elseif ($refundStrategy == "3") {
             // refund based on ratio
             $ratio = $amount / $grandTotal;
             $orderPaymentCollection->addPaymentFilterAscending($payment->getId());
         }
         // loop over payment methods and refund them all
         $result = [];
         foreach ($orderPaymentCollection as $splitPayment) {
             // could be that not all the split payments need a refund
             if ($amount > 0) {
                 if ($ratio) {
                     // refund based on ratio calculate refund amount
                     $modificationAmount = $ratio * ($splitPayment->getAmount() - $splitPayment->getTotalRefunded());
                 } else {
                     // total authorised amount of the split payment
                     $splitPaymentAmount = $splitPayment->getAmount() - $splitPayment->getTotalRefunded();
                     // if rest amount is zero go to next payment
                     if (!$splitPaymentAmount > 0) {
                         continue;
                     }
                     // if refunded amount is greather then split payment amount do a full refund
                     if ($amount >= $splitPaymentAmount) {
                         $modificationAmount = $splitPaymentAmount;
                     } else {
                         $modificationAmount = $amount;
                     }
                     // update amount with rest of the available amount
                     $amount = $amount - $splitPaymentAmount;
                 }
                 $modificationAmountObject = ['currency' => $currency, 'value' => $this->adyenHelper->formatAmount($modificationAmount, $currency)];
                 $result[] = ["modificationAmount" => $modificationAmountObject, "reference" => $payment->getOrder()->getIncrementId(), "originalReference" => $splitPayment->getPspreference(), "merchantAccount" => $merchantAccount];
             }
         }
     } else {
         //format the amount to minor units
         $amount = $this->adyenHelper->formatAmount($amount, $currency);
         $modificationAmount = ['currency' => $currency, 'value' => $amount];
         $result = [["modificationAmount" => $modificationAmount, "reference" => $payment->getOrder()->getIncrementId(), "originalReference" => $pspReference, "merchantAccount" => $merchantAccount]];
     }
     return $result;
 }
示例#15
0
 /**
  * @return array
  */
 public function getFormFields()
 {
     $formFields = [];
     try {
         if ($this->_order->getPayment()) {
             $realOrderId = $this->_order->getRealOrderId();
             $orderCurrencyCode = $this->_order->getOrderCurrencyCode();
             $skinCode = trim($this->_adyenHelper->getAdyenHppConfigData('skin_code'));
             $amount = $this->_adyenHelper->formatAmount($this->_order->getGrandTotal(), $orderCurrencyCode);
             $merchantAccount = trim($this->_adyenHelper->getAdyenAbstractConfigData('merchant_account'));
             $shopperEmail = $this->_order->getCustomerEmail();
             $customerId = $this->_order->getCustomerId();
             $shopperIP = $this->_order->getRemoteIp();
             $browserInfo = $_SERVER['HTTP_USER_AGENT'];
             $deliveryDays = $this->_adyenHelper->getAdyenHppConfigData('delivery_days');
             $shopperLocale = trim($this->_adyenHelper->getAdyenHppConfigData('shopper_locale'));
             $shopperLocale = !empty($shopperLocale) ? $shopperLocale : $this->_resolver->getLocale();
             $countryCode = trim($this->_adyenHelper->getAdyenHppConfigData('country_code'));
             $countryCode = !empty($countryCode) ? $countryCode : false;
             // if directory lookup is enabled use the billingadress as countrycode
             if ($countryCode == false) {
                 if ($this->_order->getBillingAddress() && $this->_order->getBillingAddress()->getCountryId() != "") {
                     $countryCode = $this->_order->getBillingAddress()->getCountryId();
                 }
             }
             $formFields = [];
             $formFields['merchantAccount'] = $merchantAccount;
             $formFields['merchantReference'] = $realOrderId;
             $formFields['paymentAmount'] = (int) $amount;
             $formFields['currencyCode'] = $orderCurrencyCode;
             $formFields['shipBeforeDate'] = date("Y-m-d", mktime(date("H"), date("i"), date("s"), date("m"), date("j") + $deliveryDays, date("Y")));
             $formFields['skinCode'] = $skinCode;
             $formFields['shopperLocale'] = $shopperLocale;
             $formFields['countryCode'] = $countryCode;
             $formFields['shopperIP'] = $shopperIP;
             $formFields['browserInfo'] = $browserInfo;
             $formFields['sessionValidity'] = date(DATE_ATOM, mktime(date("H") + 1, date("i"), date("s"), date("m"), date("j"), date("Y")));
             $formFields['shopperEmail'] = $shopperEmail;
             // recurring
             $recurringType = trim($this->_adyenHelper->getAdyenAbstractConfigData('recurring_type'));
             $brandCode = $this->_order->getPayment()->getAdditionalInformation("brand_code");
             // Paypal does not allow ONECLICK,RECURRING only RECURRING
             if ($brandCode == "paypal" && $recurringType == 'ONECLICK,RECURRING') {
                 $recurringType = "RECURRING";
             }
             $formFields['recurringContract'] = $recurringType;
             $formFields['shopperReference'] = !empty($customerId) ? $customerId : self::GUEST_ID . $realOrderId;
             //blocked methods
             $formFields['blockedMethods'] = "";
             $baseUrl = $this->_storeManager->getStore($this->getStore())->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK);
             $formFields['resURL'] = $baseUrl . 'adyen/process/result';
             $hmacKey = $this->_adyenHelper->getHmac();
             if ($brandCode) {
                 $formFields['brandCode'] = $brandCode;
             }
             $issuerId = $this->_order->getPayment()->getAdditionalInformation("issuer_id");
             if ($issuerId) {
                 $formFields['issuerId'] = $issuerId;
             }
             $formFields = $this->setBillingAddressData($formFields);
             $formFields = $this->setShippingAddressData($formFields);
             $formFields = $this->setOpenInvoiceData($formFields);
             $formFields['shopper.gender'] = $this->getGenderText($this->_order->getCustomerGender());
             $dob = $this->_order->getCustomerDob();
             if ($dob) {
                 $formFields['shopper.dateOfBirthDayOfMonth'] = trim($this->_getDate($dob, 'd'));
                 $formFields['shopper.dateOfBirthMonth'] = trim($this->_getDate($dob, 'm'));
                 $formFields['shopper.dateOfBirthYear'] = trim($this->_getDate($dob, 'Y'));
             }
             if ($this->_order->getPayment()->getAdditionalInformation(\Adyen\Payment\Observer\AdyenHppDataAssignObserver::BRAND_CODE) == "klarna") {
                 //  // needed for DE and AT
                 $formFields['klarna.acceptPrivacyPolicy'] = 'true';
                 // don't allow editable shipping/delivery address
                 $formFields['billingAddressType'] = "1";
                 $formFields['deliveryAddressType'] = "1";
                 // make setting to make this optional
                 $adyFields['shopperType'] = "1";
             }
             // Sort the array by key using SORT_STRING order
             ksort($formFields, SORT_STRING);
             // Generate the signing data string
             $signData = implode(":", array_map([$this, 'escapeString'], array_merge(array_keys($formFields), array_values($formFields))));
             $merchantSig = base64_encode(hash_hmac('sha256', $signData, pack("H*", $hmacKey), true));
             $formFields['merchantSig'] = $merchantSig;
             $this->_adyenLogger->addAdyenDebug(print_r($formFields, true));
         }
     } catch (Exception $e) {
         // do nothing for now
     }
     return $formFields;
 }