Example #1
0
 /**
  * The phoneDirectCheckout web method allows you to initialize a new payment in the ICEPAY system 
  * with paymentmethod Phone with Pincode
  * 
  * @since version 2.1.0
  * @access public
  * @param object $data
  * @return array result
  */
 public function phoneDirectCheckout(Icepay_PaymentObject_Interface_Abstract $paymentObj)
 {
     $obj = new StdClass();
     // Must be in specific order for checksum ---------
     $obj->MerchantID = $this->getMerchantID();
     $obj->Timestamp = $this->getTimeStamp();
     $obj->Amount = $paymentObj->getAmount();
     $obj->Country = $paymentObj->getCountry();
     $obj->Currency = $paymentObj->getCurrency();
     $obj->Description = $paymentObj->getDescription();
     $obj->EndUserIP = $this->getIP();
     $obj->Issuer = $paymentObj->getIssuer();
     $obj->Language = $paymentObj->getLanguage();
     $obj->OrderID = $paymentObj->getOrderID();
     $obj->PaymentMethod = $paymentObj->getPaymentMethod();
     $obj->Reference = $paymentObj->getReference();
     $obj->URLCompleted = $this->getSuccessURL();
     $obj->URLError = $this->getErrorURL();
     $obj->PINCode = $this->getPinCode();
     $obj->Checksum = $this->generateChecksum($obj, $this->getSecretCode());
     $result = $this->client->phoneDirectCheckout(array('request' => $obj));
     $result = $result->PhoneDirectCheckoutResult;
     /* store the checksum momentarily */
     $checksum = $result->Checksum;
     /* Replace the checksum in the data with secretCode to generate a new checksum */
     $result->Checksum = $this->getSecretCode();
     // Reverse Success and Error Description, since order must be specific for Checksum
     $success = $result->Success;
     $errorDescription = $result->ErrorDescription;
     unset($result->Success, $result->ErrorDescription);
     $result->Success = $success;
     $result->ErrorDescription = $errorDescription;
     /* Verify response data */
     if ($checksum != $this->generateChecksum($result)) {
         throw new Exception("Data could not be verified");
     }
     /* Return mister checksum */
     $result->Checksum = $checksum;
     /* Default return all data */
     return (array) $result;
 }
Example #2
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;
 }