Exemple #1
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;
 }
 /**
  * Set configuration for AdyenHPP payemnt method
  *
  * @return array
  */
 public function getConfig()
 {
     // set to active
     $config = ['payment' => [self::CODE => ['isActive' => true, 'redirectUrl' => $this->_urlBuilder->getUrl('adyen/process/redirect', ['_secure' => $this->_getRequest()->isSecure()])]]];
     // get customer
     if ($this->_customerSession->isLoggedIn()) {
         $gender = \Adyen\Payment\Model\Gender::getAdyenGenderFromMagentoGender($this->_customerSession->getCustomerData()->getGender());
         // format to calendar date
         $dob = $this->_customerSession->getCustomerData()->getDob();
         $dob = strtotime($dob);
         $dob = date('m/d/Y', $dob);
     } else {
         $gender = "";
         $dob = "";
     }
     // add to config
     $config['payment']['adyenHpp']['gender'] = $gender;
     $config['payment']['adyenHpp']['dob'] = $dob;
     // gender types
     $config['payment']['adyenHpp']['genderTypes'] = \Adyen\Payment\Model\Gender::getGenderTypes();
     $paymentMethodSelectionOnAdyen = $this->_adyenHelper->getAdyenHppConfigDataFlag('payment_selection_on_adyen');
     $config['payment']['adyenHpp']['isPaymentMethodSelectionOnAdyen'] = $paymentMethodSelectionOnAdyen;
     $config['payment']['adyenHpp']['showGender'] = $this->_adyenHelper->getAdyenHppConfigDataFlag('show_gender');
     $config['payment']['adyenHpp']['showDob'] = $this->_adyenHelper->getAdyenHppConfigDataFlag('show_dob');
     $config['payment']['adyenHpp']['showTelephone'] = $this->_adyenHelper->getAdyenHppConfigDataFlag('show_telephone');
     return $config;
 }