/**
  * Update the Order ID with the response from PayZippy Charging API
  *
  * @param \WC_Order $order Order to update
  * @param \ChargingResponse $pz_response PayZippy Charging Response
  */
 private function update_order_info(WC_Order $order, ChargingResponse $pz_response)
 {
     $pz_order_note = "PayZippy Response Summary : {";
     $pz_order_note .= " 'PayZippy Transaction ID' : '" . $pz_response->get_payzippy_transaction_id() . "', ";
     switch ($pz_response->get_payment_method()) {
         case PZ_Constants::PAYMENT_MODE_NET:
             $payment_method = PZ_Constants::BANK_NAMES($pz_response->get_bank_name()) . ' ' . PZ_Constants::PAYMENT_METHODS($pz_response->get_payment_method());
             break;
         case PZ_Constants::PAYMENT_MODE_EMI:
             $payment_method = PZ_Constants::BANK_NAMES($pz_response->get_bank_name()) . ' ' . $pz_response->get_emi_months() . ' ' . PZ_Constants::PAYMENT_METHODS($pz_response->get_payment_method());
             break;
         default:
             $payment_method = $pz_response->get_payment_method();
     }
     $pz_order_note .= " 'Payment Method' : '" . $payment_method . "', ";
     update_post_meta($order->id, 'Payment Method', mysql_real_escape_string($payment_method));
     $pz_order_note .= " 'Transaction Status' : '" . $pz_response->get_transaction_status() . "', ";
     update_post_meta($order->id, 'Transaction Status', mysql_real_escape_string($pz_response->get_transaction_status()));
     $pz_order_note .= " 'Transaction Response Code' : '" . $pz_response->get_transaction_response_code() . "', ";
     update_post_meta($order->id, 'Transaction Response Code', mysql_real_escape_string($pz_response->get_transaction_response_code()));
     $pz_order_note .= " 'Transaction Response Message' : '" . $pz_response->get_transaction_response_message() . "', ";
     update_post_meta($order->id, 'Transaction Response Message', mysql_real_escape_string($pz_response->get_transaction_response_message()));
     $pz_order_note .= " 'Is International' : '" . $pz_response->get_is_international() . "', ";
     update_post_meta($order->id, 'Is International', mysql_real_escape_string($pz_response->get_is_international()));
     $pz_order_note .= " 'Fraud Action' : '" . $pz_response->get_fraud_action() . "' }";
     update_post_meta($order->id, 'Fraud Action', mysql_real_escape_string($pz_response->get_fraud_action()));
     $order->add_order_note(mysql_real_escape_string($pz_order_note));
 }
Exemplo n.º 2
0
echo "Transaction Response Code : {$transaction_response_code}<br/>";
echo "Transaction Response Message : {$transaction_response_message}<br/>";
echo "</b></p>";
// To check the validity of the response, call the validate function on
// the ChargingResponse object. It verifies the hash returned in the response.
$hash_match = $pz_charging_response->validate();
if ($hash_match) {
    echo "<p class='text-success'><b>Hash matches. The response is valid.</b></p>";
} else {
    echo "<p class='text-error'><b>Hash mismatch. Response is invalid</b></p>";
}
echo "<h4>Charging Response</h4>";
echo "Merchant ID: {$pz_charging_response->get_merchant_id()}<br/>";
echo "Merchant Key ID: {$pz_charging_response->get_merchant_key_id()}<br/>";
echo "Merchant Transaction ID: {$pz_charging_response->get_merchant_transaction_id()}<br/>";
echo "PayZippy Transaction ID: {$pz_charging_response->get_payzippy_transaction_id()}<br/>";
echo "Transaction Status: {$pz_charging_response->get_transaction_status()}<br/>";
echo "Transaction Response Code: {$pz_charging_response->get_transaction_response_code()}<br/>";
echo "Transaction Response Message: {$pz_charging_response->get_transaction_response_message()}<br/>";
echo "Payment Method: {$pz_charging_response->get_payment_method()}<br/>";
echo "Bank Name: {$pz_charging_response->get_bank_name()}<br/>";
echo "EMI Months: {$pz_charging_response->get_emi_months()}<br/>";
echo "Transaction Amount: {$pz_charging_response->get_transaction_amount()}<br/>";
echo "Transaction Currency: {$pz_charging_response->get_transaction_currency()}<br/>";
echo "Transaction Time: {$pz_charging_response->get_transaction_time()}<br/>";
echo "Fraud Action: {$pz_charging_response->get_fraud_action()}<br/>";
echo "Fraud Details: {$pz_charging_response->get_fraud_details()}<br/>";
echo "is international : {$pz_charging_response->get_is_international()}<br/>";
echo "Version: {$pz_charging_response->get_version()}<br/>";
echo "UDF1: {$pz_charging_response->get_udf1()}<br/>";
echo "UDF2: {$pz_charging_response->get_udf2()}<br/>";