public function loadGet()
 {
     $result = new \Icepay_Result();
     $result->setMerchantID((string) $this->merchantId)->setSecretCode((string) $this->secretCode);
     try {
         if ($result->validate()) {
             $this->status = new ResponseStatus($result->getStatus());
             $this->statusDescription = $result->getResultData()->statusCode;
             $this->orderId = $result->getOrderID();
             $this->parameters = (array) $result->getResultData();
         } else {
             throw new InvalidResponseException('Could not verify get response data');
         }
     } catch (\Exception $e) {
         throw new ApiException('There was a problem validating the get response', 0, $e);
     }
 }
示例#2
0
 /**
  * Update the status of the specified payment
  *
  * @param Pronamic_Pay_Payment $payment
  * @throws Exception
  */
 public function update_status(Pronamic_Pay_Payment $payment)
 {
     // Get the Icepay Result and set the required fields
     $result = new Icepay_Result();
     $result->setMerchantID($this->config->merchant_id)->setSecretCode($this->config->secret_code);
     try {
         // Determine if the result can be validated
         if ($result->validate()) {
             // What was the status response
             switch ($result->getStatus()) {
                 case Icepay_StatusCode::SUCCESS:
                     $payment->set_status(Pronamic_WP_Pay_Statuses::SUCCESS);
                     break;
                 case Icepay_StatusCode::OPEN:
                     $payment->set_status(Pronamic_WP_Pay_Statuses::OPEN);
                     break;
                 case Icepay_StatusCode::ERROR:
                     $payment->set_status(Pronamic_WP_Pay_Statuses::FAILURE);
                     break;
             }
         }
     } catch (Exception $exception) {
         $this->error = new WP_Error('icepay_error', $exception->getMessage(), $exception);
     }
 }
示例#3
0
 *  authors or copyright holders be liable for any claim, damages or
 *  other liability, whether in an action of contract, tort or otherwise,
 *  arising from, out of or in connection with the software or the use
 *  of other dealings in the software.
 *
 */
/*  Define your ICEPAY Merchant ID and Secret code. The values below are sample values and will not work, Change them to your own merchant settings. */
define('MERCHANTID', 12345);
//<--- Change this into your own merchant ID
define('SECRETCODE', "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
//<--- Change this into your own merchant ID
require_once '../src/icepay_api_basic.php';
/* Apply logging rules */
$logger = Icepay_Api_Logger::getInstance();
$logger->enableLogging()->setLoggingLevel(Icepay_Api_Logger::LEVEL_ALL)->logToFile()->setLoggingDirectory(realpath("../logs"))->setLoggingFile("result.txt")->logToScreen();
$icepay = new Icepay_Result();
$icepay->setMerchantID(MERCHANTID)->setSecretCode(SECRETCODE);
$order = new Example_Order();
// This is a dummy class to depict a sample usage.
try {
    if ($icepay->validate()) {
        switch ($icepay->getStatus()) {
            case Icepay_StatusCode::OPEN:
                // Close the cart
                echo "Thank you, awaiting payment verification.";
                break;
            case Icepay_StatusCode::SUCCESS:
                // Close the cart
                echo "Thank you for your purchase. The payment has been received.";
                break;
            case Icepay_StatusCode::ERROR:
示例#4
0
 /**
  * Handle the success or error result
  * @return bool|\Icepay_Result
  */
 public function handleResult()
 {
     try {
         $result = new \Icepay_Result();
         $result->setMerchantID($this->merchantID)->setSecretCode($this->secretCode);
         if (!$result->validate()) {
             return false;
         }
         if ($result->getStatus() == \Icepay_StatusCode::SUCCESS) {
             return $result;
         }
     } catch (\Exception $e) {
         \Yii::error($e->getMessage());
     }
     return false;
 }
 function after_confirm()
 {
     global $temp_orders_id;
     $data = '';
     foreach ($_GET as $key => $value) {
         $data .= $key . ': ' . "\n";
         $data .= $value . "\n\n";
     }
     tep_db_query('INSERT INTO payment_log (type, data, date) VALUES ("' . get_class($this) . '", "' . $data . '", NOW())');
     tep_db_query('DELETE FROM payment_log WHERE date < DATE_SUB(NOW(), INTERVAL 30 DAY)');
     $icepay = new Icepay_Result();
     $icepay->setMerchantID($this->instances[$this->temp_data[$temp_orders_id]['orders']['payment_method']]['merchant_id'])->setSecretCode($this->instances[$this->temp_data[$temp_orders_id]['orders']['payment_method']]['secret_code'])->enableLogging()->logToFile(true, realpath("../logs"));
     try {
         if ($icepay->validate()) {
             switch ($icepay->getStatus()) {
                 case Icepay_StatusCode::OPEN:
                     //do nothing
                     break;
                 case Icepay_StatusCode::SUCCESS:
                     tep_db_query('UPDATE temp_orders SET orders_status = 2 WHERE orders_id = "' . $temp_orders_id . '"');
                     break;
                 case Icepay_StatusCode::ERROR:
                     //Redirect to cart
                     tep_db_query('UPDATE temp_orders SET orders_status = 53 WHERE orders_id = "' . $temp_orders_id . '"');
                     Checkout::send_order_error_mail(Translate('Ongeldige Icepay betaling voor bestelling') . ': ' . $temp_orders_id, sprintf(Translate('De betaling voor bestelling %s is ongeldig verklaard door Icepay.'), $temp_orders_id));
                     $_GET['force_checkout_step'] = Checkout::get_step_for_type($this->type);
                     $this->errors[$this->temp_data[$temp_orders_id]['orders']['payment_method']] = Translate($icepay->getStatus(true));
                     break;
             }
         }
     } catch (Exception $e) {
         echo $e->getMessage();
         $this->errors[$this->type] = Translate($e->getMessage());
     }
     return $this->errors;
 }