/*
 * Order listing page. We rely on the local database
 * to retrieve the order history of this buyer. 
 */
require_once __DIR__ . '/../bootstrap.php';
if (!isset($_SESSION)) {
    session_start();
}
if (!isSignedIn()) {
    header('Location: ../user/sign_in.php');
    exit;
}
$paymentDetails = null;
try {
    if (isset($_REQUEST['payment_id']) && trim($_REQUEST['payment_id']) != '') {
        $paymentDetails = getPaymentDetails($_REQUEST['payment_id']);
    }
} catch (\PayPal\Exception\PPConnectionException $ex) {
    $message = parseApiError($ex->getData());
    $messageType = "error";
} catch (Exception $ex) {
    $message = $ex->getMessage();
    $messageType = "error";
}
?>
<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='utf-8'>
    <meta content='IE=Edge,chrome=1' http-equiv='X-UA-Compatible'>
    <meta content='width=device-width, initial-scale=1.0' name='viewport'>
Beispiel #2
0
 /**
  * Completes the payment once buyer approval has been
  * obtained. Used only when the payment method is 'paypal'
  * 
  * @param string $paymentId id of a previously created
  * 		payment that has its payment method set to 'paypal'
  * 		and has been approved by the buyer.
  * 
  * @param string $payerId PayerId as returned by PayPal post
  * 		buyer approval.
  */
 function executePayment($paymentId, $payerId)
 {
     $payment = getPaymentDetails($paymentId);
     $paymentExecution = new PaymentExecution();
     $paymentExecution->setPayerId($payerId);
     $payment = $payment->execute($paymentExecution, getApiContext());
     return $payment;
 }
Beispiel #3
0
     $rsp['info'] = mysql_error();
     respond($rsp);
 }
 error_log("salesApi: action " . $_REQUEST['action']);
 $_silent = isset($_REQUEST['silent']) && $_REQUEST['silent'] == 'true' ? true : false;
 switch ($_REQUEST['action']) {
     case 'getCustomerList':
         return getCustomerList();
     case 'getPaymentList':
         return getPaymentList();
     case 'getCustomerNames':
         return getCustomerNames();
     case 'getCustomer':
         return getCustomer();
     case 'getPaymentDetails':
         return getPaymentDetails();
     case 'getPaymentHistory':
         return getPaymentHistory();
     case 'getLastPayment':
         return getLastPayment();
     case 'newInstance':
         return newInstance($_silent);
     case 'updateInstanceData':
         return updateInstanceData();
     default:
         break;
 }
 // Respond positively
 $rsp['status'] = SL_OK;
 $rsp['error'] = SL_NO_ERROR;
 respond($rsp);