1 | <?php |
||
2 | /* For license terms, see /license.txt */ |
||
3 | /** |
||
4 | * PayPal Express Checkout Module. |
||
5 | * |
||
6 | * @package chamilo.plugin.buycourses |
||
7 | */ |
||
8 | /** |
||
9 | * Init. |
||
10 | */ |
||
11 | require_once 'paypalfunctions.php'; |
||
12 | /** |
||
13 | * The paymentAmount is the total value of |
||
14 | * the shopping cart, that was set |
||
15 | * earlier in a session variable |
||
16 | * by the shopping cart page. |
||
17 | */ |
||
18 | $paymentAmount = $_SESSION["Payment_Amount"]; |
||
19 | |||
20 | /** |
||
21 | * The currencyCodeType and paymentType |
||
22 | * are set to the selections made on the Integration Assistant. |
||
23 | */ |
||
24 | $paymentType = "Sale"; |
||
25 | |||
26 | /** |
||
27 | * Calls the SetExpressCheckout API call |
||
28 | * The CallShortcutExpressCheckout function is defined in the file PayPalFunctions.php, |
||
29 | * it is included at the top of this file. |
||
30 | */ |
||
31 | $resArray = CallShortcutExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL); |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
32 | $ack = strtoupper($resArray["ACK"]); |
||
33 | if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") { |
||
34 | RedirectToPayPal($resArray["TOKEN"]); |
||
35 | } else { |
||
36 | //Display a user friendly Error on the page using any of the following error information returned by PayPal |
||
37 | $ErrorCode = urldecode($resArray["L_ERRORCODE0"]); |
||
38 | $ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]); |
||
39 | $ErrorLongMsg = urldecode($resArray["L_LONGMESSAGE0"]); |
||
40 | $ErrorSeverityCode = urldecode($resArray["L_SEVERITYCODE0"]); |
||
41 | |||
42 | echo "SetExpressCheckout API call failed. "; |
||
43 | echo "Detailed Error Message: ".$ErrorLongMsg; |
||
44 | echo "Short Error Message: ".$ErrorShortMsg; |
||
45 | echo "Error Code: ".$ErrorCode; |
||
46 | echo "Error Severity Code: ".$ErrorSeverityCode; |
||
47 | } |
||
48 |