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)));
     }
 }
Exemplo n.º 2
0
 public function getPaymentMethodConfigurationValue($key, $languageCode = null)
 {
     return $this->_paymentMethod->getPaymentMethodConfigurationValue($key, $languageCode = null);
 }
Exemplo n.º 3
0
 /**
  * @param Customweb_Payment_Authorization_IPaymentMethod $paymentMethod
  * @throws Exception
  * @return Customweb_Payment_Authorization_IAdapter
  */
 protected function getAdapterInstanceByPaymentMethod(Customweb_Payment_Authorization_IPaymentMethod $paymentMethod)
 {
     $configuredAuthorizationMethod = $paymentMethod->getPaymentMethodConfigurationValue('authorizationMethod');
     $adapter = null;
     switch (strtolower($configuredAuthorizationMethod)) {
         // In case the server mode is choosen, we stick to the hidden, for simplicity.
         case strtolower(Customweb_Saferpay_Authorization_Server_Adapter::AUTHORIZATION_METHOD_NAME):
         case strtolower(Customweb_Saferpay_Authorization_Hidden_Adapter::AUTHORIZATION_METHOD_NAME):
             $adapter = new Customweb_Saferpay_Authorization_Hidden_Adapter($this->getConfigurationAdapter(), $this->container);
             break;
         case strtolower(Customweb_Saferpay_Authorization_PaymentPage_Adapter::AUTHORIZATION_METHOD_NAME):
             $adapter = new Customweb_Saferpay_Authorization_PaymentPage_Adapter($this->getConfigurationAdapter(), $this->container);
             break;
         default:
             throw new Exception(Customweb_I18n_Translation::__("Could not find an adapter for the authoriztion method !methodName.", array('!methodName' => $configuredAuthorizationMethod)));
     }
     $adapter->setIsMoto(true);
     return $adapter;
 }
 /**
  * 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);
 }