Esempio n. 1
0
 /**
  * Get the payment url
  *
  * @param OrderInterface $order
  * @return string url
  */
 public function getPaymentURL(OrderInterface $order)
 {
     $icepay_config = \Drupal::config("uc_icepay.settings");
     $country = $icepay_config->get("country");
     $language = $icepay_config->get("language");
     $merchant_id = $icepay_config->get("merchant_id");
     $secret_code = $icepay_config->get("secret_code");
     $protocol = $icepay_config->get("https_protocol");
     $paymentObj = new \Icepay_PaymentObject();
     $paymentObj->setOrderID($order->id() . date('is'))->setReference($order->id())->setAmount(intval($order->getTotal() * 100))->setCurrency($order->getCurrency())->setCountry($country)->setLanguage($language);
     $payment_plugin_id = IcepayApi::getPaymentPluginId($order->getPaymentMethodId());
     $payment_method = IcepayApi::paymentPluginToIcepayPaymentMethod($payment_plugin_id);
     $paymentObj->setPaymentMethod($payment_method);
     if (isset($order->payment_details['ideal_issuer'])) {
         $paymentObj->setIssuer($order->payment_details['ideal_issuer']);
     }
     $basicmode = \Icepay_Basicmode::getInstance();
     $basicmode->setMerchantID($merchant_id)->setSecretCode($secret_code)->validatePayment($paymentObj);
     $protocol = $protocol == true ? 'https' : 'http';
     $basicmode->setProtocol($protocol);
     return $basicmode->getURL();
 }