72 lines
1.9 KiB
PHP
72 lines
1.9 KiB
PHP
<?php
|
|
if (!defined('CC_INI_SET')) die("Access Denied");
|
|
|
|
require_once 'CallerService.php';
|
|
|
|
require_once 'constants.php';
|
|
|
|
session_start();
|
|
|
|
|
|
$token = $_REQUEST['token'];
|
|
|
|
if(! isset($token)) {
|
|
|
|
$parts = explode(",",base64_decode($_GET['ccb']));
|
|
$paymentAmount = $parts[0];
|
|
$currencyCodeType = $parts[1];
|
|
$paymentType = $module['paymentAction'];
|
|
|
|
$returnURL =urlencode($glob['storeURL'].'/index.php?_g=rm&type=altCheckout&cmd=process&module=PayPal_Pro¤cyCodeType='.$currencyCodeType.'&paymentType='.$paymentType.'&paymentAmount='.$paymentAmount);
|
|
|
|
$cancelURL =urlencode($glob['storeURL']."/index.php?_g=rm&type=altCheckout&cmd=process&module=PayPal_Pro&paymentType=".$paymentType);
|
|
|
|
$nvpStr="&Amt=".sprintf("%.2f",$paymentAmount)."&PAYMENTACTION=".$paymentType."&ReturnUrl=".$returnURL."&CANCELURL=".$cancelURL ."&CURRENCYCODE=".$currencyCodeType;
|
|
|
|
$resArray=hash_call("SetExpressCheckout",$nvpStr);
|
|
|
|
$_SESSION['reshash']=$resArray;
|
|
|
|
$ack = strtoupper($resArray["ACK"]);
|
|
|
|
|
|
if($ack=="SUCCESS"){
|
|
// Redirect to paypal.com here
|
|
$token = urldecode($resArray["TOKEN"]);
|
|
$payPalURL = PAYPAL_URL.$token;
|
|
header("Location: ".$payPalURL);
|
|
exit;
|
|
} else {
|
|
include("APIError.php");
|
|
exit;
|
|
}
|
|
|
|
} else {
|
|
|
|
$token = urlencode( $_REQUEST['token']);
|
|
|
|
$nvpStr="&TOKEN=".$token;
|
|
|
|
$resArray=hash_call("GetExpressCheckoutDetails",$nvpStr);
|
|
|
|
$_SESSION['reshash']=$resArray;
|
|
$_SESSION['PAYERSTATUS'] = $resArray['PAYERSTATUS'];
|
|
$_SESSION['ADDRESSSTATUS'] = $resArray["ADDRESSSTATUS"];
|
|
|
|
$ack = strtoupper($resArray["ACK"]);
|
|
|
|
if($module['confAddress']==1 && strtoupper($resArray["ADDRESSSTATUS"])!=="CONFIRMED") {
|
|
httpredir("index.php?_g=co&_a=error&code=10003");
|
|
}
|
|
|
|
if($ack=="SUCCESS"){
|
|
require_once "GetExpressCheckoutDetails.php";
|
|
exit;
|
|
} else {
|
|
include("APIError.php");
|
|
exit;
|
|
}
|
|
}
|
|
?>
|
|
|