Exemplo n.º 1
0
 /**
  * check if payment method is cc and zero amount authorization is enabled
  *
  * @param Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod
  *
  * @return bool
  */
 public function isCCAndZeroAmountAuthAllowed(Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod, Mage_Sales_Model_Quote $quote)
 {
     $result = false;
     $storeId = $quote->getStoreId();
     if ($quote->getBaseGrandTotal() < 0.01 && $opsPaymentMethod instanceof Netresearch_OPS_Model_Payment_Cc && $opsPaymentMethod->isZeroAmountAuthorizationAllowed($storeId) && 0 < $quote->getItemsCount()) {
         $result = true;
     }
     return $result;
 }
Exemplo n.º 2
0
 /**
  *
  * @param Mage_Sales_Model_Order $order
  * @param array                  $requestParams
  */
 public function getMethodDependendFormFields($order, $requestParams = null)
 {
     $formFields = parent::getMethodDependendFormFields($order, $requestParams);
     unset($formFields['OWNERADDRESS']);
     unset($formFields['OWNERTELNO']);
     unset($formFields['ECOM_SHIPTO_POSTAL_STREET_LINE1']);
     $shippingMethod = 'none';
     $isVirtual = true;
     if ($order->getShippingAddress()) {
         $isVirtual = false;
         $carrierCode = $order->getShippingCarrier()->getCarrierCode();
         $this->loadShippingSettingForCarrierCode($carrierCode);
         $shippingMethod = $carrierCode;
     }
     $formFields['ECOM_ESTIMATEDELIVERYDATE'] = $this->getEstimatedDeliveryDate($this->getCode(), $order->getStoreId());
     $formFields['RNPOFFERT'] = $this->getRnpFee($this->getCode(), $order->getStoreId());
     $formFields['ECOM_SHIPMETHODTYPE'] = $this->getShippingMethodType($this->getCode(), $order->getStoreId(), $isVirtual);
     $formFields['ECOM_SHIPMETHODSPEED'] = $this->getShippingMethodSpeed($this->getCode(), $order->getStoreId());
     $shipMethodDetails = $this->getShippingMethodDetails($this->getCode(), $order->getStoreId());
     if (0 < strlen(trim($shipMethodDetails))) {
         $formFields['ECOM_SHIPMETHODDETAILS'] = $shipMethodDetails;
     }
     if (4 == $formFields['ECOM_SHIPMETHODTYPE'] && !array_key_exists('ECOM_SHIPMETHODDETAILS', $formFields)) {
         $address = $order->getShippingAddress() ? $order->getShippingAddress()->toString() : $order->getBillingAddress()->toString();
         $formFields['ECOM_SHIPMETHODDETAILS'] = substr($address, 0, 50);
     }
     $formFields['ORDERSHIPMETH'] = $shippingMethod;
     $formFields['CIVILITY'] = $this->getGender($order) == 'Male' ? 'Mr' : 'Mrs';
     $formFields = array_merge($formFields, $this->getKwixoBillToParams($order));
     $formFields = array_merge($formFields, $this->getKwixoShipToParams($order));
     $formFields = array_merge($formFields, $this->getItemParams($order));
     $formFields['ORDERID'] = Mage::helper('ops/order')->getOpsOrderId($order, false);
     $formFields = $this->populateFromArray($formFields, $requestParams, $order);
     return $formFields;
 }
Exemplo n.º 3
0
 /**
  * add iDeal issuer id to form fields
  *
  * @override Netresearch_OPS_Model_Payment_Abstract
  *
  * @param      $order
  * @param null $requestParams
  *
  * @return array
  */
 public function getMethodDependendFormFields($order, $requestParams = null)
 {
     $formFields = parent::getMethodDependendFormFields($order, $requestParams);
     if ($order->getPayment()->getAdditionalInformation('iDeal_issuer_id')) {
         $formFields['ISSUERID'] = $order->getPayment()->getAdditionalInformation('iDeal_issuer_id');
     }
     return $formFields;
 }
Exemplo n.º 4
0
 /**
  * Assign data to info model instance
  *
  * @param   mixed $data
  * @return  Mage_Payment_Model_Info
  */
 public function assignData($data)
 {
     $countryId = '';
     if (is_object($data) && $data instanceof Varien_Object) {
         $countryId = $data->getCountryId();
     } elseif (is_array($data) && isset($data['country_id'])) {
         $countryId = $data['country_id'];
     }
     $pm = $brand = trim('Bank transfer' . ('*' == $countryId ? '' : ' ' . $countryId));
     $payment = Mage::getSingleton('checkout/session')->getQuote()->getPayment();
     $payment->setAdditionalInformation('PM', $pm);
     $payment->setAdditionalInformation('BRAND', $brand);
     parent::assignData($data);
     return $this;
 }
Exemplo n.º 5
0
 /**
  * @test
  * @loadFixture ../../../../var/fixtures/orders.yaml
  */
 public function testCanCancelManually()
 {
     $opsAbstractPayment = new Netresearch_OPS_Model_Payment_Abstract();
     //Check for successful can cancel (pending_payment and payment status 0)
     $order = Mage::getModel("sales/order")->load(11);
     $this->assertTrue($opsAbstractPayment->canCancelManually($order));
     //Check for successful cancel (pending_payment and payment status null/not existing)
     $order = Mage::getModel("sales/order")->load(14);
     $this->assertTrue($opsAbstractPayment->canCancelManually($order));
     //Check for denied can cancel (pending_payment and payment status 5)
     $order = Mage::getModel("sales/order")->load(12);
     $this->assertFalse($opsAbstractPayment->canCancelManually($order));
     //Check for denied can cancel (processing and payment status 0)
     $order = Mage::getModel("sales/order")->load(13);
     $this->assertFalse($opsAbstractPayment->canCancelManually($order));
 }
Exemplo n.º 6
0
 /**
  * Assign data to info model instance
  *
  * @param   mixed $data
  * @return  Mage_Payment_Model_Info
  */
 public function assignData($data)
 {
     $brand = '';
     if (is_object($data) && $data instanceof Varien_Object) {
         $brand = $data['directEbanking_brand'];
     } elseif (is_array($data) && isset($data['directEbanking_brand'])) {
         $brand = $data['directEbanking_brand'];
     }
     $brand = $this->fixSofortUberweisungBrand($brand);
     $payment = $this->getPayment();
     // brand == pm for all DirectEbanking methods
     $payment->setAdditionalInformation('PM', $brand);
     $payment->setAdditionalInformation('BRAND', $brand);
     parent::assignData($data);
     return $this;
 }
Exemplo n.º 7
0
 /**
  * Assign data to info model instance
  *
  * @param   mixed $data
  * @return  Mage_Payment_Model_Info
  */
 public function assignData($data)
 {
     $brand = '';
     if (is_object($data) && $data instanceof Varien_Object) {
         $brand = $data->getIntersolveBrand();
     } elseif (is_array($data) && isset($data['intersolve_brand'])) {
         $brand = $data['intersolve_brand'];
     }
     if (strlen(trim($brand)) === 0) {
         $brand = 'InterSolve';
     }
     $payment = Mage::getSingleton('checkout/session')->getQuote()->getPayment();
     $payment->setAdditionalInformation('BRAND', $brand);
     parent::assignData($data);
     return $this;
 }
Exemplo n.º 8
0
 /**
  * performs direct link request either for inline payments and direct sale mode or the normal maintenance call (invoice)
  *
  * @override
  * @param Varien_Object $payment
  * @param float         $amount
  *
  * @return Mage_Payment_Model_Abstract|void
  */
 public function capture(Varien_Object $payment, $amount)
 {
     /**
      * process direct sale inline payments (initial request)
      */
     if (Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE == $this->getConfigPaymentAction() && $this->getPaymentHelper()->isInlinePayment($payment)) {
         $order = $payment->getOrder();
         $quote = $this->getQuoteHelper()->getQuote();
         $this->confirmPayment($order, $quote, $payment);
     } elseif (0 < strlen(trim($payment->getAdditionalInformation('paymentId')))) {
         parent::capture($payment, $amount);
     }
 }