Example #1
0
 /**
  * Required for using the basicmode
  * @since version 2.1.0
  * @access public
  * @param Icepay_PaymentObject_Interface_Abstract $payment
  */
 public function validatePayment(Icepay_PaymentObject_Interface_Abstract $payment)
 {
     /* Clear the generated URL */
     $this->resetURL();
     $this->data = (object) array_merge((array) $this->data, (array) $payment->getData());
     if (!$payment->getPaymentMethod()) {
         return $this;
     }
     $paymentmethod = $payment->getBasicPaymentmethodClass();
     if (!$this->exists($payment->getCountry(), $paymentmethod->getSupportedCountries())) {
         throw new Exception('Country not supported');
     }
     if (!$this->exists($payment->getCurrency(), $paymentmethod->getSupportedCurrency())) {
         throw new Exception('Currency not supported');
     }
     if (!$this->exists($payment->getLanguage(), $paymentmethod->getSupportedLanguages())) {
         throw new Exception('Language not supported');
     }
     if (!$this->exists($payment->getIssuer(), $paymentmethod->getSupportedIssuers()) && $payment->getPaymentMethod() != null) {
         throw new Exception('Issuer not supported');
     }
     /* used for webservice call */
     $this->paymentObj = $payment;
     return $this;
 }