78 lines
2.2 KiB
PHP
78 lines
2.2 KiB
PHP
<?php
|
|
if (!defined('CC_INI_SET')) die("Access Denied");
|
|
|
|
require_once 'CallerService.php';
|
|
|
|
require_once 'constants.php';
|
|
|
|
session_start();
|
|
|
|
$token = $_REQUEST['token'];
|
|
$TRXTYPE = $module['paymentAction'] == "Sale" ? "S" : "A";
|
|
|
|
if(!isset($token)) {
|
|
|
|
$parts = explode(",",base64_decode($_GET['ccb']));
|
|
$paymentAmount = $parts[0];
|
|
$currencyCodeType = $parts[1];
|
|
$paymentType = $module['paymentAction'];
|
|
|
|
$returnURL = $glob['storeURL'].'/index.php?_g=rm&type=altCheckout&cmd=process&module=PayPal_Pro¤cyCodeType='.$currencyCodeType.'&paymentType='.$paymentType.'&paymentAmount='.$paymentAmount;
|
|
|
|
$cancelURL = $glob['storeURL']."/index.php?_g=rm&type=altCheckout&cmd=process&module=PayPal_Pro&paymentType=".$paymentType;
|
|
|
|
$AMT = sprintf("%.2f",$paymentAmount);
|
|
|
|
$nvpStr = "&ACTION[1]=S".
|
|
"&AMT[".strlen($AMT)."]=".$AMT.
|
|
"&RETURNURL[".strlen($returnURL)."]=".$returnURL.
|
|
"&CANCELURL[".strlen($cancelURL)."]=".$cancelURL;
|
|
|
|
if($module['confAddress']==1) {
|
|
$nvpStr.="&REQCONFIRMSHIPPING[1]=1";
|
|
} else {
|
|
$nvpStr.="&REQCONFIRMSHIPPING[1]=0";
|
|
}
|
|
|
|
$BUTTONSOURCE = "CubeCart_Cart_PRO2EC";
|
|
|
|
$nvpStr.="&BUTTONSOURCE[".strlen($BUTTONSOURCE)."]=".$BUTTONSOURCE;
|
|
$request_id = md5($_POST['ACCT'].$paymentAmount.date('YmdGis')."1");
|
|
//$resArray = hash_call("SetExpressCheckout",$nvpStr);
|
|
$resArray = hash_call("P",$TRXTYPE,$nvpStr,$request_id);
|
|
|
|
$_SESSION['reshash'] = $resArray;
|
|
|
|
if($resArray["RESULT"]==0){
|
|
// Redirect to paypal.com here
|
|
$token = urldecode($resArray["TOKEN"]);
|
|
$payPalURL = PAYPAL_URL.$token;
|
|
header("Location: ".$payPalURL);
|
|
exit;
|
|
} else {
|
|
include("APIError.php");
|
|
exit;
|
|
}
|
|
|
|
} else {
|
|
|
|
|
|
$nvpStr = "&ACTION[1]=G&TOKEN[".strlen($token)."]=".$token;
|
|
$request_id = md5($token.date('YmdGis')."1");
|
|
//$resArray=hash_call("GetExpressCheckoutDetails",$nvpStr);
|
|
$resArray = hash_call("P",$TRXTYPE,$nvpStr,$request_id);
|
|
|
|
$_SESSION['reshash']=$resArray;
|
|
$_SESSION['PAYERSTATUS'] = $resArray['PAYERSTATUS'];
|
|
|
|
if($resArray["RESULT"]==0){
|
|
require_once "GetExpressCheckoutDetails.php";
|
|
exit;
|
|
} else {
|
|
include("APIError.php");
|
|
exit;
|
|
}
|
|
}
|
|
?>
|
|
|