public function onBeforeSave(Customweb_Database_Entity_IManager $manager) { if ($this->getContextId() === null) { $this->setCreatedOn(new DateTime()); } $this->setUpdatedOn(new DateTime()); if (is_object($this->paymentMethod)) { $this->paymentMethodMachineName = $this->paymentMethod->getPaymentMethodName(); } }
protected function _beforeSave() { parent::_beforeSave(); if ($this->isObjectNew()) { $this->setCreatedOn(date("Y-m-d H:i:s")); } $this->setUpdatedOn(date("Y-m-d H:i:s")); $this->setData('invoice_items', Mage::helper('SaferpayCw')->serialize($this->invoiceItems)); $this->setData('shipping_address', Mage::helper('SaferpayCw')->serialize($this->shippingAddress)); $this->setData('billing_address', Mage::helper('SaferpayCw')->serialize($this->billingAddress)); $this->setData('provider_data', Mage::helper('SaferpayCw')->serialize($this->providerData)); if (is_object($this->paymentMethod)) { $this->setData('payment_method_machine_name', $this->paymentMethod->getPaymentMethodName()); } }
public static function getWrapperFromPaymentMethod(Customweb_Payment_Authorization_IPaymentMethod $method) { $paymentMethodName = $method->getPaymentMethodName(); switch (strtolower($paymentMethodName)) { case 'mastercard': case 'visa': case 'americanexpress': case 'diners': case 'jcb': case 'saferpaytestcard': case 'laser': case 'lasercard': case 'bonuscard': case 'maestro': case 'myone': case 'creditcard': return new Customweb_Saferpay_Method_CreditCardWrapper($method); case 'postfinanceefinance': case 'postfinancecard': case 'paypal': case 'ideal': case 'clickandbuy': case 'eps': return new Customweb_Saferpay_Method_DefaultWrapper($method); case 'openinvoice': return new Customweb_Saferpay_Method_BillpayOpenInvoice($method); case 'mpass': case 'giropay': case 'directebanking': return new Customweb_Saferpay_Method_OnlineBankingWrapper($method); case 'directdebits': if ($method->getPaymentMethodConfigurationValue('provider') == 'billpay') { return new Customweb_Saferpay_Method_BillpayDirectDebits($method); } else { return new Customweb_Saferpay_Method_DirectDebitWrapper($method); } break; case 'masterpass': return new Customweb_Saferpay_Method_Masterpass($method); default: throw new Exception(Customweb_I18n_Translation::__("No method wrapper found for payment method '!method'.", array('!method' => $paymentMethodName))); } }
/** * Sets the mandate id on the customer context. * * @param Customweb_Payment_Authorization_IPaymentCustomerContext $context * @param string $id * @return void */ public static function setMandateIdIntoCustomerContext(Customweb_Payment_Authorization_IPaymentCustomerContext $context, $id, Customweb_Payment_Authorization_IPaymentMethod $paymentMethod) { $methodKey = strtolower($paymentMethod->getPaymentMethodName()); $map = array(self::CUSTOMER_CONTEXT_KEY => array($methodKey => $id)); $context->updateMap($map); }
public function getPaymentMethodName() { return $this->_paymentMethod->getPaymentMethodName(); }
/** * This method returns the keys for accessing the map with the classes. * * @param Customweb_Payment_Authorization_IPaymentMethod $method * @param unknown $authorizationMethodName * @return string[] */ protected final function getKeys(Customweb_Payment_Authorization_IPaymentMethod $method, $authorizationMethodName) { $paymentMethodKey = strtolower($method->getPaymentMethodName()); if ($authorizationMethodName === null) { $authorizationMethodName = '*'; } $authorizationMethodNameKey = strtolower($authorizationMethodName); $processorKey = null; if ($method->existsPaymentMethodConfigurationValue('processor')) { $processorKey = $method->getPaymentMethodConfigurationValue('processor'); } if ($processorKey === null) { $processorKey = $this->getDefaultOperator($method, $authorizationMethodName); } if ($processorKey === null) { $processorKey = '*'; } $processorKey = strtolower($processorKey); return array('paymentMethodKey' => $paymentMethodKey, 'authorizationMethodNameKey' => $authorizationMethodNameKey, 'processorKey' => $processorKey); }