本文整理匯總了PHP中Orders::Complete方法的典型用法代碼示例。如果您正苦於以下問題:PHP Orders::Complete方法的具體用法?PHP Orders::Complete怎麽用?PHP Orders::Complete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Orders
的用法示例。
在下文中一共展示了Orders::Complete方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Response
/**
* Response
* Create the Order, Invoice and send an email to the customer
* @param $response from the Gateway Server
* @return order_id or false
*/
public function Response($response)
{
if (!empty($response['status']) && $response['status'] == 2) {
if (!empty($response['item_number'])) {
$product = array('id' => $response['item_number'], 'name' => $response['item_name']);
if (!empty($response['transaction_id'])) {
$orderid = trim($response['transaction_id']);
// Complete the order with the payment details
if (Orders::Complete($orderid)) {
return $orderid;
}
}
}
}
return false;
}
示例2: CallBack
/**
* CallBack
* This function is called by the bank server in order to confirm the transaction previously executed
* @param $response from the Gateway Server
* @return boolean
*/
public function CallBack($response)
{
$bank = self::getModule();
$url = $bank['test_mode'] ? $bank['url_test'] : $bank['url_official'];
// Resend all the variables to paypal to confirm the receipt message
$result = self::processIPN($response);
if (!empty($response['custom'])) {
// Get the orderid back from the bank post variables
$orderid = trim($response['custom']);
if (!empty($orderid) && is_numeric($orderid)) {
//check the ipn result received back from paypal
if ($result) {
Orders::Complete($orderid, true);
// Complete the order information and it executes all the tasks to do
Payments::confirm($orderid, true);
// Set the payment confirm
} else {
Payments::confirm($orderid, false);
}
}
}
die;
}
示例3: CallBack
/**
* CallBack
* This function is called by the bank server in order to confirm the transaction previously executed
* @param $response from the Gateway Server
* @return boolean
*/
public function CallBack($response)
{
Shineisp_Commons_Utilities::logs("Start callback", "iwbank.log");
// Get the orderid back from the bank post variables
$orderid = trim($response['custom']);
$ret = "";
$payer_id = $response["payer_id"];
$thx_id = $response["thx_id"];
$verify_sign = $response["verify_sign"];
$amount = $response["amount"];
$code = '2E121E96A508BDBA39782E43D2ACC12274A991A7EDE25502F42D99542D26CF3D';
//Inserire il merchant_key indicato all'interno del sito IWSMILE su POS VIRTUALE/Configurazione/Notifica Pagamento.
$str = "thx_id=" . $thx_id . "&amount=" . $amount . "&verify_sign=" . $verify_sign;
$str .= "&payer_id=" . $payer_id;
$str .= "&merchant_key=" . $code;
Shineisp_Commons_Utilities::logs("Callback parameters: {$str}", "iwbank.log");
$url = "https://checkout.iwsmile.it/Pagamenti/trx.check";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $str);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_POST, TRUE);
$content = curl_exec($ch);
$c_error = "NONE";
$ret = 'NON DISPONIBILE';
if (curl_errno($ch) != 0) {
$c_error = curl_error($ch);
} else {
if (strstr($content, "OK")) {
$ret = "VERIFICATO";
Shineisp_Commons_Utilities::logs("Order Completed: {$orderid}", "iwbank.log");
// Complete the order
Orders::Complete($orderid, true);
// Complete the order information and it executes all the tasks to do
Shineisp_Commons_Utilities::logs("Confirm the payment for the order: {$orderid}", "iwbank.log");
Payments::confirm($orderid);
// Set the payment confirm
} elseif (strstr($content, "KO")) {
// Order not verified
$ret = 'NON VERIFICATO';
} elseif (strstr($content, "IR")) {
// Request is not valid
$ret = 'RICHIESTA NON VALIDA';
} elseif (strstr($content, "EX")) {
// Request expired
$ret = 'RICHIESTA SCADUTA';
}
}
curl_close($ch);
Shineisp_Commons_Utilities::logs("Callback Payment Result: {$ret}", "iwbank.log");
Shineisp_Commons_Utilities::logs("End callback", "iwbank.log");
return true;
}