Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add support for Accelerated Boarding

  • Loading branch information...
commit c5b28a6e5261ca157e1bb31b42f7a40efff05543 1 parent d84ecfc
@haraldpdl haraldpdl authored
Showing with 33 additions and 16 deletions.
  1. +33 −16 catalog/includes/modules/payment/paypal_express.php
View
49 catalog/includes/modules/payment/paypal_express.php
@@ -17,7 +17,8 @@ class paypal_express {
function paypal_express() {
global $order;
- $this->signature = 'paypal|paypal_express|1.1|2.2';
+ $this->signature = 'paypal|paypal_express|1.2|2.2';
+ $this->api_version = '60.0';
$this->code = 'paypal_express';
$this->title = MODULE_PAYMENT_PAYPAL_EXPRESS_TEXT_TITLE;
@@ -222,6 +223,7 @@ function install() {
}
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable PayPal Express Checkout', 'MODULE_PAYMENT_PAYPAL_EXPRESS_STATUS', 'False', 'Do you want to accept PayPal Express Checkout payments?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
+ tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Seller Account', 'MODULE_PAYMENT_PAYPAL_EXPRESS_SELLER_ACCOUNT', '', 'The email address of the seller account if no API credentials has been setup.', '6', '0', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('API Username', 'MODULE_PAYMENT_PAYPAL_EXPRESS_API_USERNAME', '', 'The username to use for the PayPal API service', '6', '0', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('API Password', 'MODULE_PAYMENT_PAYPAL_EXPRESS_API_PASSWORD', '', 'The password to use for the PayPal API service', '6', '0', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('API Signature', 'MODULE_PAYMENT_PAYPAL_EXPRESS_API_SIGNATURE', '', 'The signature to use for the PayPal API service', '6', '0', now())");
@@ -241,7 +243,7 @@ function remove() {
}
function keys() {
- return array('MODULE_PAYMENT_PAYPAL_EXPRESS_STATUS', 'MODULE_PAYMENT_PAYPAL_EXPRESS_API_USERNAME', 'MODULE_PAYMENT_PAYPAL_EXPRESS_API_PASSWORD', 'MODULE_PAYMENT_PAYPAL_EXPRESS_API_SIGNATURE', 'MODULE_PAYMENT_PAYPAL_EXPRESS_TRANSACTION_SERVER', 'MODULE_PAYMENT_PAYPAL_EXPRESS_TRANSACTION_METHOD', 'MODULE_PAYMENT_PAYPAL_EXPRESS_ACCOUNT_OPTIONAL', 'MODULE_PAYMENT_PAYPAL_EXPRESS_INSTANT_UPDATE', 'MODULE_PAYMENT_PAYPAL_EXPRESS_ZONE', 'MODULE_PAYMENT_PAYPAL_EXPRESS_ORDER_STATUS_ID', 'MODULE_PAYMENT_PAYPAL_EXPRESS_TRANSACTIONS_ORDER_STATUS_ID', 'MODULE_PAYMENT_PAYPAL_EXPRESS_SORT_ORDER', 'MODULE_PAYMENT_PAYPAL_EXPRESS_CURL');
+ return array('MODULE_PAYMENT_PAYPAL_EXPRESS_STATUS', 'MODULE_PAYMENT_PAYPAL_EXPRESS_SELLER_ACCOUNT', 'MODULE_PAYMENT_PAYPAL_EXPRESS_API_USERNAME', 'MODULE_PAYMENT_PAYPAL_EXPRESS_API_PASSWORD', 'MODULE_PAYMENT_PAYPAL_EXPRESS_API_SIGNATURE', 'MODULE_PAYMENT_PAYPAL_EXPRESS_TRANSACTION_SERVER', 'MODULE_PAYMENT_PAYPAL_EXPRESS_TRANSACTION_METHOD', 'MODULE_PAYMENT_PAYPAL_EXPRESS_ACCOUNT_OPTIONAL', 'MODULE_PAYMENT_PAYPAL_EXPRESS_INSTANT_UPDATE', 'MODULE_PAYMENT_PAYPAL_EXPRESS_ZONE', 'MODULE_PAYMENT_PAYPAL_EXPRESS_ORDER_STATUS_ID', 'MODULE_PAYMENT_PAYPAL_EXPRESS_TRANSACTIONS_ORDER_STATUS_ID', 'MODULE_PAYMENT_PAYPAL_EXPRESS_SORT_ORDER', 'MODULE_PAYMENT_PAYPAL_EXPRESS_CURL');
}
function sendTransactionToGateway($url, $parameters) {
@@ -303,15 +305,20 @@ function setExpressCheckout($parameters) {
$api_url = 'https://api-3t.sandbox.paypal.com/nvp';
}
- $params = array('USER' => MODULE_PAYMENT_PAYPAL_EXPRESS_API_USERNAME,
- 'PWD' => MODULE_PAYMENT_PAYPAL_EXPRESS_API_PASSWORD,
- 'VERSION' => '57.0',
- 'SIGNATURE' => MODULE_PAYMENT_PAYPAL_EXPRESS_API_SIGNATURE,
+ $params = array('VERSION' => '60.0',
'METHOD' => 'SetExpressCheckout',
- 'PAYMENTACTION' => ((MODULE_PAYMENT_PAYPAL_EXPRESS_TRANSACTION_METHOD == 'Sale') ? 'Sale' : 'Authorization'),
+ 'PAYMENTACTION' => ((MODULE_PAYMENT_PAYPAL_EXPRESS_TRANSACTION_METHOD == 'Sale') || (!tep_not_null(MODULE_PAYMENT_PAYPAL_EXPRESS_API_USERNAME)) ? 'Sale' : 'Authorization'),
'RETURNURL' => tep_href_link('ext/modules/payment/paypal/express.php', 'osC_Action=retrieve', 'SSL', true, false),
'CANCELURL' => tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL', true, false));
+ if (tep_not_null(MODULE_PAYMENT_PAYPAL_EXPRESS_API_USERNAME)) {
+ $params['USER'] = MODULE_PAYMENT_PAYPAL_EXPRESS_API_USERNAME;
+ $params['PWD'] = MODULE_PAYMENT_PAYPAL_EXPRESS_API_PASSWORD;
+ $params['SIGNATURE'] = MODULE_PAYMENT_PAYPAL_EXPRESS_API_SIGNATURE;
+ } else {
+ $params['SUBJECT'] = MODULE_PAYMENT_PAYPAL_EXPRESS_SELLER_ACCOUNT;
+ }
+
if (MODULE_PAYMENT_PAYPAL_EXPRESS_ACCOUNT_OPTIONAL == 'True') {
$params['SOLUTIONTYPE'] = 'Sole';
}
@@ -342,13 +349,18 @@ function getExpressCheckoutDetails($token) {
$api_url = 'https://api-3t.sandbox.paypal.com/nvp';
}
- $params = array('USER' => MODULE_PAYMENT_PAYPAL_EXPRESS_API_USERNAME,
- 'PWD' => MODULE_PAYMENT_PAYPAL_EXPRESS_API_PASSWORD,
- 'VERSION' => '57.0',
- 'SIGNATURE' => MODULE_PAYMENT_PAYPAL_EXPRESS_API_SIGNATURE,
+ $params = array('VERSION' => '60.0',
'METHOD' => 'GetExpressCheckoutDetails',
'TOKEN' => $token);
+ if (tep_not_null(MODULE_PAYMENT_PAYPAL_EXPRESS_API_USERNAME)) {
+ $params['USER'] = MODULE_PAYMENT_PAYPAL_EXPRESS_API_USERNAME;
+ $params['PWD'] = MODULE_PAYMENT_PAYPAL_EXPRESS_API_PASSWORD;
+ $params['SIGNATURE'] = MODULE_PAYMENT_PAYPAL_EXPRESS_API_SIGNATURE;
+ } else {
+ $params['SUBJECT'] = MODULE_PAYMENT_PAYPAL_EXPRESS_SELLER_ACCOUNT;
+ }
+
$post_string = '';
foreach ($params as $key => $value) {
@@ -371,14 +383,19 @@ function doExpressCheckoutPayment($parameters) {
$api_url = 'https://api-3t.sandbox.paypal.com/nvp';
}
- $params = array('USER' => MODULE_PAYMENT_PAYPAL_EXPRESS_API_USERNAME,
- 'PWD' => MODULE_PAYMENT_PAYPAL_EXPRESS_API_PASSWORD,
- 'VERSION' => '57.0',
- 'SIGNATURE' => MODULE_PAYMENT_PAYPAL_EXPRESS_API_SIGNATURE,
+ $params = array('VERSION' => '60.0',
'METHOD' => 'DoExpressCheckoutPayment',
- 'PAYMENTACTION' => ((MODULE_PAYMENT_PAYPAL_EXPRESS_TRANSACTION_METHOD == 'Sale') ? 'Sale' : 'Authorization'),
+ 'PAYMENTACTION' => ((MODULE_PAYMENT_PAYPAL_EXPRESS_TRANSACTION_METHOD == 'Sale') || (!tep_not_null(MODULE_PAYMENT_PAYPAL_EXPRESS_API_USERNAME)) ? 'Sale' : 'Authorization'),
'BUTTONSOURCE' => 'osCommerce22_Default_EC');
+ if (tep_not_null(MODULE_PAYMENT_PAYPAL_EXPRESS_API_USERNAME)) {
+ $params['USER'] = MODULE_PAYMENT_PAYPAL_EXPRESS_API_USERNAME;
+ $params['PWD'] = MODULE_PAYMENT_PAYPAL_EXPRESS_API_PASSWORD;
+ $params['SIGNATURE'] = MODULE_PAYMENT_PAYPAL_EXPRESS_API_SIGNATURE;
+ } else {
+ $params['SUBJECT'] = MODULE_PAYMENT_PAYPAL_EXPRESS_SELLER_ACCOUNT;
+ }
+
if (is_array($parameters) && !empty($parameters)) {
$params = array_merge($params, $parameters);
}
Please sign in to comment.
Something went wrong with that request. Please try again.