Files
bobsleighphotos.com/production/modules/altCheckout/PayPal_Pro/wpp-US/ReviewOrder.php
2017-03-02 20:30:40 -06:00

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&currencyCodeType='.$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;
}
}
?>