本文整理汇总了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;
}