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 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;
 }
示例#3
0
 /**
  * @return mixed
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function getCsePublicKey()
 {
     // get storeId for admin
     if (!$this->_appState->getAreaCode() === \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) {
         $storeId = $this->_storeManager->getStore()->getId();
     } else {
         $storeId = null;
     }
     $demoMode = $this->_adyenHelper->getAdyenAbstractConfigDataFlag('demo_mode', $storeId);
     if ($demoMode) {
         $cseKey = $this->_adyenHelper->getAdyenCcConfigData('cse_publickey_test', $storeId);
     } else {
         $cseKey = $this->_adyenHelper->getAdyenCcConfigData('cse_publickey_live', $storeId);
     }
     return $cseKey;
 }
 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');
     $config['payment']['adyenCc']['cseKey'] = $cseKey;
     $config['payment']['adyenCc']['cseEnabled'] = $cseEnabled;
     $config['payment']['adyenCc']['cseEnabled'] = $cseEnabled;
     $config['payment']['adyenCc']['generationTime'] = date("c");
     foreach ($this->methodCodes as $code) {
         if ($this->methods[$code]->isAvailable()) {
             $config['payment']['adyenCc']['redirectUrl'][$code] = $this->getMethodRedirectUrl($code);
         }
     }
     return $config;
 }
示例#5
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;
 }
示例#6
0
 /**
  * @return mixed
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function isDemoMode()
 {
     $storeId = $this->getInfo()->getOrder()->getStoreId();
     return $this->_adyenHelper->getAdyenAbstractConfigDataFlag('demo_mode', $storeId);
 }