46 lines
1.7 KiB
PHP
46 lines
1.7 KiB
PHP
<?php
|
|
if (!defined('CC_INI_SET')) die("Access Denied");
|
|
|
|
require_once 'CallerService.php';
|
|
|
|
session_start();
|
|
|
|
$token =urlencode($_SESSION['token']);
|
|
|
|
$paymentAmount = urlencode($orderSum['prod_total']);
|
|
$paymentType = urlencode($_SESSION['paymentType']);
|
|
$currCodeType = urlencode($_SESSION['currCodeType']);
|
|
$payerID = urlencode($_SESSION['payer_id']);
|
|
$serverName = urlencode($_SERVER['SERVER_NAME']);
|
|
|
|
$nvpStr='&TOKEN='.$token.'&PAYERID='.$payerID.'&PAYMENTACTION='.$paymentType.'&AMT='.$paymentAmount.'&CURRENCYCODE='.$currCodeType.'&IPADDRESS='.$serverName.'&INVNUM='.$_GET['cart_order_id'] ;
|
|
|
|
$nvpStr.="&BUTTONSOURCE=CubeCart_Cart_EC_US";
|
|
|
|
$resArray=hash_call("DoExpressCheckoutPayment",$nvpStr);
|
|
|
|
$ack = strtoupper($resArray["ACK"]);
|
|
|
|
$transData['customer_id'] = $orderSum["customer_id"];
|
|
$transData['gateway'] = "PayPal Website Payments Pro (".$paymentType.")";
|
|
$transData['extra'] = "P";
|
|
$transData['trans_id'] = $resArray['TRANSACTIONID'];
|
|
$transData['order_id'] = $_GET['cart_order_id'];
|
|
$transData['amount'] = $orderSum['prod_total'];
|
|
$transData['status'] = $ack;
|
|
$transData['notes'] = "Successful transaction via PayPal Express Checkout. Buyers address '".strtolower($_SESSION['ADDRESSSTATUS'])."' and payer status is '".strtolower($_SESSION['PAYERSTATUS'])."'.";
|
|
$order->storeTrans($transData);
|
|
|
|
if($ack=="SUCCESS"){
|
|
// Sale = Funds taken immediately otherwise they may be taken later
|
|
$orderStatus = ($paymentType == "Sale") ? 3 : 2; // 3 is payment complete, 2 is processing
|
|
|
|
$paymentResult = ($paymentType == "Sale") ? 2 : 3; // Just to confuse matter Al you plonker!! 2 = money taken 3 = money not yet taken (Athorized)
|
|
|
|
$order->orderStatus($orderStatus,$_GET['cart_order_id']);
|
|
} else {
|
|
$paymentResult = 1;
|
|
}
|
|
|
|
session_unset();
|
|
?>
|