コード例 #1
0
 private function createTransactionRequest()
 {
     $transactionRequest = new Bcash\Domain\TransactionRequest();
     $transactionRequest->setSellerMail(Configuration::get(self::prefix . 'EMAIL'));
     $transactionRequest->setDiscount($this->calculateDiscounts());
     $transactionRequest->setOrderId($this->createOrder());
     $transactionRequest->setBuyer($this->createBuyer());
     $shoppingCost = $this->context->cart->getTotalShippingCost();
     $shoppingCost = FormatHelper::monetize($shoppingCost);
     $transactionRequest->setShipping($shoppingCost);
     $transactionRequest->setUrlNotification($this->context->link->getModuleLink('bcash', 'notification', array(), true));
     $transactionRequest->setProducts($this->createProducts());
     $transactionRequest->setAcceptedContract("S");
     $transactionRequest->setViewedContract("S");
     $transactionRequest->setPlatformId('567');
     $paymentMethodHelper = new PaymentMethodHelper();
     $paymentMethod = $paymentMethodHelper->getById(Tools::getValue('payment-method'));
     $transactionRequest->setPaymentMethod($paymentMethod->id);
     if (PaymentMethodHelper::isCard($paymentMethod)) {
         $transactionRequest->setInstallments(Tools::getValue('card-installment'));
         $transactionRequest->setCreditCard($this->createCreditCard());
     }
     return $transactionRequest;
 }
コード例 #2
0
 /**
  * Cria o objeto TransactionRequest via SDK Api Bcash.
  * @return TransactionRequest
  */
 public function createTransactionRequestBcash()
 {
     $url = Mage::getUrl('bcash/notification/request', array('_secure' => true));
     $transactionRequest = new TransactionRequest();
     $transactionRequest->setSellerMail($this->email);
     $transactionRequest->setOrderId($this->quoteBcash->getReservedOrderId());
     $transactionRequest->setBuyer($this->createBuyerBcash());
     $transactionRequest->setUrlNotification($url);
     $transactionRequest->setProducts($this->createProductBcash());
     $transactionRequest->setAcceptedContract("S");
     $transactionRequest->setViewedContract("S");
     $transactionRequest->setDependentTransactions($this->createDependentTransactionsBcash());
     $transactionRequest->setPlatformId(565);
     return $transactionRequest;
 }