security update link,module_filters,search_api_solr,ubercart,views
This commit is contained in:
@@ -4,9 +4,8 @@ dependencies[] = uc_payment
|
||||
package = Ubercart - payment
|
||||
core = 7.x
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-07-16
|
||||
version = "7.x-3.10"
|
||||
; Information added by Drupal.org packaging script on 2019-03-06
|
||||
version = "7.x-3.12"
|
||||
core = "7.x"
|
||||
project = "ubercart"
|
||||
datestamp = "1468644909"
|
||||
|
||||
datestamp = "1551862392"
|
||||
|
@@ -5,7 +5,6 @@
|
||||
* Integrates 2Checkout.com's redirected payment service.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_help().
|
||||
*/
|
||||
@@ -153,7 +152,7 @@ function uc_payment_method_2checkout($op, &$order, $form = NULL, &$form_state =
|
||||
'#title' => t('Currency for the sale'),
|
||||
'#options' => array(
|
||||
'' => t('Auto detected by 2CO'),
|
||||
'USD', 'EUR', 'ARS', 'AUD', 'BRL', 'GBP', 'CAD', 'DKK', 'HKD', 'INR', 'ILS', 'JPY', 'LTL', 'MYR', 'MXN', 'NZD', 'NOK', 'PHP', 'RON', 'RUB', 'SGD', 'ZAR', 'SEK', 'CHF', 'TRY', 'AED'
|
||||
'USD', 'EUR', 'ARS', 'AUD', 'BRL', 'GBP', 'CAD', 'DKK', 'HKD', 'INR', 'ILS', 'JPY', 'LTL', 'MYR', 'MXN', 'NZD', 'NOK', 'PHP', 'RON', 'RUB', 'SGD', 'ZAR', 'SEK', 'CHF', 'TRY', 'AED',
|
||||
),
|
||||
'#default_value' => variable_get('uc_2checkout_currency_code', ''),
|
||||
);
|
||||
@@ -227,8 +226,8 @@ function uc_2checkout_form($form, &$form_state, $order) {
|
||||
$i = 0;
|
||||
foreach ($order->products as $product) {
|
||||
$i++;
|
||||
$data['li_' . $i . '_name'] = $product->title;
|
||||
$data['li_' . $i . '_price'] = uc_currency_format($product->price, FALSE, FALSE, '.');
|
||||
$data['li_' . $i . '_name'] = $product->title;
|
||||
$data['li_' . $i . '_price'] = uc_currency_format($product->price, FALSE, FALSE, '.');
|
||||
}
|
||||
|
||||
if (variable_get('uc_2checkout_checkout_type', 'dynamic') == 'direct') {
|
||||
|
@@ -113,7 +113,6 @@ function uc_2checkout_process_notification() {
|
||||
uc_order_update_status($order_id, uc_order_state_default('canceled'));
|
||||
uc_order_comment_save($order_id, 0, t('Order have not passed 2Checkout fraud review.'));
|
||||
die('fraud');
|
||||
break;
|
||||
}
|
||||
}
|
||||
elseif ($values['message_type'] == 'REFUND_ISSUED') {
|
||||
|
@@ -5,9 +5,8 @@ dependencies[] = uc_credit
|
||||
package = Ubercart - payment
|
||||
core = 7.x
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-07-16
|
||||
version = "7.x-3.10"
|
||||
; Information added by Drupal.org packaging script on 2019-03-06
|
||||
version = "7.x-3.12"
|
||||
core = "7.x"
|
||||
project = "ubercart"
|
||||
datestamp = "1468644909"
|
||||
|
||||
datestamp = "1551862392"
|
||||
|
@@ -3,8 +3,6 @@
|
||||
/**
|
||||
* @file
|
||||
* Processes payments using Authorize.net. Supports AIM and ARB.
|
||||
*
|
||||
* Development sponsored by Digital Dollhouse - http://www.digitaldollhouse.com
|
||||
*/
|
||||
|
||||
define('UC_AUTHORIZENET_TEST_GATEWAY_URL', 'https://test.authorize.net/gateway/transact.dll');
|
||||
@@ -110,11 +108,10 @@ function uc_authorizenet_settings_form($form, &$form_state) {
|
||||
'#default_value' => variable_get('uc_authnet_response_debug', FALSE),
|
||||
);
|
||||
|
||||
|
||||
$form['arb_settings'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('ARB settings'),
|
||||
'#description' => t('These settings pertain to the Authorize.Net Automated Recurring Billing service.')
|
||||
'#description' => t('These settings pertain to the Authorize.Net Automated Recurring Billing service.'),
|
||||
);
|
||||
$form['arb_settings']['uc_authnet_arb_mode'] = array(
|
||||
'#type' => 'radios',
|
||||
@@ -144,7 +141,7 @@ function uc_authorizenet_settings_form($form, &$form_state) {
|
||||
$form['cim_settings'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('CIM settings'),
|
||||
'#description' => t('These settings pertain to the Authorize.Net Customer Information Management service.')
|
||||
'#description' => t('These settings pertain to the Authorize.Net Customer Information Management service.'),
|
||||
);
|
||||
$form['cim_settings']['uc_authnet_cim_profile'] = array(
|
||||
'#type' => 'checkbox',
|
||||
@@ -163,7 +160,6 @@ function uc_authorizenet_settings_form($form, &$form_state) {
|
||||
'#default_value' => variable_get('uc_authnet_cim_mode', 'disabled'),
|
||||
);
|
||||
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
@@ -602,14 +598,14 @@ function _uc_authorizenet_charge($order, $amount, $data) {
|
||||
/**
|
||||
* Sends an XML API Request to Authorize.Net.
|
||||
*
|
||||
* @param $server
|
||||
* @param string $server
|
||||
* The name of the server to send a request to - 'production' or 'developer'.
|
||||
* @param $xml
|
||||
* @param string $xml
|
||||
* The XML to send to Authorize.Net.
|
||||
* @param $callback
|
||||
* The name of the function that should process the response.
|
||||
*
|
||||
* @return
|
||||
* @return bool
|
||||
* TRUE or FALSE indicating the success of the API request.
|
||||
*/
|
||||
function uc_authorizenet_xml_api($server, $xml) {
|
||||
@@ -626,7 +622,7 @@ function uc_authorizenet_xml_api($server, $xml) {
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $post_url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml"));
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml"));
|
||||
curl_setopt($ch, CURLOPT_HEADER, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
@@ -649,12 +645,12 @@ function uc_authorizenet_xml_api($server, $xml) {
|
||||
*
|
||||
* @param $subscription_id
|
||||
* The ID of the subscription at Authorize.Net.
|
||||
* @param $updates
|
||||
* @param array $updates
|
||||
* An array of data to update using key/value pairs from the XML API for ARB;
|
||||
* keys should be children of the subscription element in the XML.
|
||||
* See the ARB_guide.pdf from Authorize.Net for ARBCreateSubscriptionRequests.
|
||||
*
|
||||
* @return
|
||||
* @return bool
|
||||
* TRUE or FALSE indicating the success of the cancellation.
|
||||
*/
|
||||
function uc_authorizenet_arb_update($subscription_id, $updates, $order_id = NULL) {
|
||||
@@ -666,7 +662,7 @@ function uc_authorizenet_arb_update($subscription_id, $updates, $order_id = NULL
|
||||
$data = array(
|
||||
'refId' => substr($order_id . '-' . REQUEST_TIME, 0, 20),
|
||||
'subscriptionId' => $subscription_id,
|
||||
'subscription' => $updates
|
||||
'subscription' => $updates,
|
||||
);
|
||||
|
||||
// Build the XML string.
|
||||
@@ -696,6 +692,8 @@ function uc_authorizenet_arb_update($subscription_id, $updates, $order_id = NULL
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for XML API requests.
|
||||
*
|
||||
* Wraps XML API request child elements in the request element and includes
|
||||
* the merchant authentication information.
|
||||
*/
|
||||
@@ -738,39 +736,51 @@ function _uc_authorizenet_avs($code) {
|
||||
case 'A':
|
||||
$text .= t('Address (Street) matches, ZIP does not');
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
$text .= t('Address information not provided for AVS check');
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
$text .= t('AVS error');
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
$text .= t('Non-U.S. Card Issuing Bank');
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
$text .= t('No Match on Address (Street) or ZIP');
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
$text .= t('AVS not applicable for this transaction');
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
$text .= t('Retry – System unavailable or timed out');
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
$text .= t('Service not supported by issuer');
|
||||
break;
|
||||
|
||||
case 'U':
|
||||
$text .= t('Address information is unavailable');
|
||||
break;
|
||||
|
||||
case 'W':
|
||||
$text .= t('Nine digit ZIP matches, Address (Street) does not');
|
||||
break;
|
||||
|
||||
case 'X':
|
||||
$text .= t('Address (Street) and nine digit ZIP match');
|
||||
break;
|
||||
|
||||
case 'Y':
|
||||
$text .= t('Address (Street) and five digit ZIP match');
|
||||
break;
|
||||
|
||||
case 'Z':
|
||||
$text .= t('Five digit ZIP matches, Address (Street) does not');
|
||||
break;
|
||||
@@ -789,15 +799,19 @@ function _uc_authorizenet_cvv($code) {
|
||||
case 'M':
|
||||
$text .= t('Match');
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
$text .= t('No Match');
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
$text .= t('Not Processed');
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
$text .= t('Should have been present');
|
||||
break;
|
||||
|
||||
case 'U':
|
||||
$text .= t('Issuer unable to process request');
|
||||
break;
|
||||
@@ -813,14 +827,19 @@ function _uc_authorizenet_txn_type($type) {
|
||||
switch (strtoupper($type)) {
|
||||
case 'AUTH_CAPTURE':
|
||||
return t('Authorization and capture');
|
||||
|
||||
case 'AUTH_ONLY':
|
||||
return t('Authorization only');
|
||||
|
||||
case 'PRIOR_AUTH_CAPTURE':
|
||||
return t('Prior authorization capture');
|
||||
|
||||
case 'CAPTURE_ONLY':
|
||||
return t('Capture only');
|
||||
|
||||
case 'CREDIT':
|
||||
return t('Credit');
|
||||
|
||||
case 'VOID':
|
||||
return t('Void');
|
||||
}
|
||||
@@ -833,12 +852,16 @@ function _uc_authorizenet_txn_map($type) {
|
||||
switch ($type) {
|
||||
case UC_CREDIT_AUTH_ONLY:
|
||||
return 'AUTH_ONLY';
|
||||
|
||||
case UC_CREDIT_PRIOR_AUTH_CAPTURE:
|
||||
return 'PRIOR_AUTH_CAPTURE';
|
||||
|
||||
case UC_CREDIT_AUTH_CAPTURE:
|
||||
return 'AUTH_CAPTURE';
|
||||
|
||||
case UC_CREDIT_CREDIT:
|
||||
return 'CREDIT';
|
||||
|
||||
case UC_CREDIT_VOID:
|
||||
return 'VOID';
|
||||
}
|
||||
|
@@ -5,12 +5,11 @@
|
||||
* Page callback for Authorize.Net's Silent POST feature.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Receives a payment notification and handles it appropriately.
|
||||
*/
|
||||
function uc_authorizenet_silent_post() {
|
||||
// Determine if this is an ARB notification or not
|
||||
// Determine if this is an ARB notification or not.
|
||||
$arb = (isset($_POST['x_subscription_id']) and isset($_POST['x_subscription_paynum']));
|
||||
|
||||
// Log ARB payment notification, if enabled.
|
||||
|
@@ -5,9 +5,8 @@ dependencies[] = uc_credit
|
||||
package = Ubercart - payment
|
||||
core = 7.x
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-07-16
|
||||
version = "7.x-3.10"
|
||||
; Information added by Drupal.org packaging script on 2019-03-06
|
||||
version = "7.x-3.12"
|
||||
core = "7.x"
|
||||
project = "ubercart"
|
||||
datestamp = "1468644909"
|
||||
|
||||
datestamp = "1551862392"
|
||||
|
@@ -52,7 +52,7 @@ function test_gateway_charge($order_id, $amount, $data) {
|
||||
// cc_exp_month and cc_exp_year are also validated by
|
||||
// _uc_credit_valid_card_expiration() on the checkout form.
|
||||
$month = $order->payment_details['cc_exp_month'];
|
||||
$year = $order->payment_details['cc_exp_year'];
|
||||
$year = $order->payment_details['cc_exp_year'];
|
||||
if ($year < 100) {
|
||||
$year = $year + 2000;
|
||||
}
|
||||
|
@@ -47,7 +47,6 @@ class UbercartCreditCardTestCase extends UbercartTestHelper {
|
||||
'4012888818888',
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Describes this test case.
|
||||
*/
|
||||
@@ -141,7 +140,7 @@ class UbercartCreditCardTestCase extends UbercartTestHelper {
|
||||
/**
|
||||
* Implements DrupalWebTestCase::tearDown().
|
||||
*/
|
||||
public function tearDown() {
|
||||
protected function tearDown() {
|
||||
// Cleanup keys directory after test.
|
||||
drupal_unlink('sites/default/files/simpletest.keys/' . UC_CREDIT_KEYFILE_NAME);
|
||||
drupal_rmdir('sites/default/files/simpletest.keys');
|
||||
@@ -318,4 +317,5 @@ class UbercartCreditCardTestCase extends UbercartTestHelper {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -8,9 +8,8 @@ core = 7.x
|
||||
; Test cases
|
||||
files[] = tests/uc_credit.test
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-07-16
|
||||
version = "7.x-3.10"
|
||||
; Information added by Drupal.org packaging script on 2019-03-06
|
||||
version = "7.x-3.12"
|
||||
core = "7.x"
|
||||
project = "ubercart"
|
||||
datestamp = "1468644909"
|
||||
|
||||
datestamp = "1551862392"
|
||||
|
@@ -69,7 +69,6 @@ function uc_credit_update_7000(&$sandbox) {
|
||||
$sandbox['message'] = $t('Scrubbed credit card data from order @order_id', array('@order_id' => $order->order_id));
|
||||
}
|
||||
|
||||
|
||||
if ($sandbox['progress'] < $sandbox['max']) {
|
||||
$sandbox['#finished'] = min(0.99, $sandbox['progress'] / $sandbox['max']);
|
||||
}
|
||||
|
@@ -5,39 +5,56 @@
|
||||
* Defines the credit card payment method and hooks in payment gateways.
|
||||
*/
|
||||
|
||||
|
||||
/** Just authorize an amount on a credit card account. */
|
||||
/**
|
||||
* Just authorize an amount on a credit card account.
|
||||
*/
|
||||
define('UC_CREDIT_AUTH_ONLY', 'authorize');
|
||||
|
||||
/** Capture funds from a prior authorization. */
|
||||
/**
|
||||
* Capture funds from a prior authorization.
|
||||
*/
|
||||
define('UC_CREDIT_PRIOR_AUTH_CAPTURE', 'prior_auth_capture');
|
||||
|
||||
/** Authorize and capture money all at once. */
|
||||
/**
|
||||
* Authorize and capture money all at once.
|
||||
*/
|
||||
define('UC_CREDIT_AUTH_CAPTURE', 'auth_capture');
|
||||
|
||||
/** Set up a credit card reference through the payment gateway. */
|
||||
/**
|
||||
* Set up a credit card reference through the payment gateway.
|
||||
*/
|
||||
define('UC_CREDIT_REFERENCE_SET', 'reference_set');
|
||||
|
||||
/** Capture funds using a credit card reference. */
|
||||
/**
|
||||
* Capture funds using a credit card reference.
|
||||
*/
|
||||
define('UC_CREDIT_REFERENCE_TXN', 'reference_txn');
|
||||
|
||||
/** Remove a reference from the payment gateway. */
|
||||
/**
|
||||
* Remove a reference from the payment gateway.
|
||||
*/
|
||||
define('UC_CREDIT_REFERENCE_REMOVE', 'reference_remove');
|
||||
|
||||
/** Credit funds to a reference at the payment gateway. */
|
||||
/**
|
||||
* Credit funds to a reference at the payment gateway.
|
||||
*/
|
||||
define('UC_CREDIT_REFERENCE_CREDIT', 'reference_credit');
|
||||
|
||||
/** Credit funds to a credit card account. */
|
||||
/**
|
||||
* Credit funds to a credit card account.
|
||||
*/
|
||||
define('UC_CREDIT_CREDIT', 'credit');
|
||||
|
||||
/** Void a transaction before the transaction clears. */
|
||||
/**
|
||||
* Void a transaction before the transaction clears.
|
||||
*/
|
||||
define('UC_CREDIT_VOID', 'void');
|
||||
|
||||
|
||||
/** Name of encryption key file. */
|
||||
/**
|
||||
* Name of encryption key file.
|
||||
*/
|
||||
define('UC_CREDIT_KEYFILE_NAME', 'uc_credit.key');
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_help().
|
||||
*/
|
||||
@@ -547,7 +564,9 @@ function uc_payment_method_credit_form($form, &$form_state, $order) {
|
||||
}
|
||||
|
||||
$form['cc_policy'] = array(
|
||||
'#markup' => '<p>' . variable_get('uc_credit_policy', t('Your billing information must match the billing address for the credit card entered below or we will be unable to process your payment.')) . '</p>'
|
||||
'#prefix' => '<p>',
|
||||
'#markup' => variable_get('uc_credit_policy', t('Your billing information must match the billing address for the credit card entered below or we will be unable to process your payment.')),
|
||||
'#suffix' => '</p>',
|
||||
);
|
||||
|
||||
$types = variable_get('uc_credit_accepted_types', implode("\r\n", array(t('Visa'), t('Mastercard'), t('Discover'), t('American Express'))));
|
||||
@@ -714,12 +733,12 @@ function uc_credit_display_number($number) {
|
||||
/**
|
||||
* Caches CC details on a pageload for use in various functions.
|
||||
*
|
||||
* @param $op
|
||||
* @param string $op
|
||||
* The cache operation to perform; either 'save', 'load', or 'clear'.
|
||||
* @param $data
|
||||
* @param string $data
|
||||
* The encrypted, serialized string containing the CC data.
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* An array of credit card details.
|
||||
*/
|
||||
function uc_credit_cache($op, $data = NULL, $encrypted = TRUE) {
|
||||
@@ -809,7 +828,13 @@ function _uc_credit_valid_cvv($cvv) {
|
||||
/**
|
||||
* Validates a credit card number during checkout.
|
||||
*
|
||||
* Luhn algorithm. See: http://www.merriampark.com/anatomycc.htm
|
||||
* @param string $number
|
||||
* Credit card number as a string.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if card number is valid according to the Luhn algorithm.
|
||||
*
|
||||
* @see https://en.wikipedia.org/wiki/Luhn_algorithm
|
||||
*/
|
||||
function _uc_credit_valid_card_number($number) {
|
||||
$id = substr($number, 0, 1);
|
||||
@@ -843,12 +868,12 @@ function _uc_credit_valid_card_number($number) {
|
||||
/**
|
||||
* Validates a start date on a card.
|
||||
*
|
||||
* @param $month
|
||||
* @param int $month
|
||||
* The 1 or 2-digit numeric representation of the month, i.e. 1, 6, 12.
|
||||
* @param $year
|
||||
* @param int $year
|
||||
* The 4-digit numeric representation of the year, i.e. 2008.
|
||||
*
|
||||
* @return
|
||||
* @return bool
|
||||
* TRUE for cards whose start date is blank (both month and year) or in the
|
||||
* past, FALSE otherwise.
|
||||
*/
|
||||
@@ -876,12 +901,12 @@ function _uc_credit_valid_card_start($month, $year) {
|
||||
/**
|
||||
* Validates an expiration date on a card.
|
||||
*
|
||||
* @param $month
|
||||
* @param int $month
|
||||
* The 1 or 2-digit numeric representation of the month, i.e. 1, 6, 12.
|
||||
* @param $year
|
||||
* @param int $year
|
||||
* The 4-digit numeric representation of the year, i.e. 2008.
|
||||
*
|
||||
* @return
|
||||
* @return bool
|
||||
* TRUE for non-expired cards, FALSE for expired.
|
||||
*/
|
||||
function _uc_credit_valid_card_expiration($month, $year) {
|
||||
@@ -899,6 +924,12 @@ function _uc_credit_valid_card_expiration($month, $year) {
|
||||
|
||||
/**
|
||||
* Validates an issue number on a card; returns TRUE or FALSE.
|
||||
*
|
||||
* @param string $issue
|
||||
* The issue number.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if the issue number if valid, FALSE otherwise.
|
||||
*/
|
||||
function _uc_credit_valid_card_issue($issue) {
|
||||
if (empty($issue) || (is_numeric($issue) && $issue > 0)) {
|
||||
@@ -914,8 +945,8 @@ function _uc_credit_valid_card_issue($issue) {
|
||||
* Path to key file is stored in system variable 'uc_credit_encryption_path'.
|
||||
* Key file name is stored in constant UC_CREDIT_KEYFILE_NAME.
|
||||
*
|
||||
* @return
|
||||
* FALSE if no encryption key is found.
|
||||
* @return string|false
|
||||
* Key, or FALSE if no encryption key is found.
|
||||
*/
|
||||
function uc_credit_encryption_key() {
|
||||
static $key = FALSE;
|
||||
@@ -957,6 +988,9 @@ function _uc_credit_save_cc_data_to_order($cc_data, $order_id) {
|
||||
|
||||
/**
|
||||
* Returns an array of default credit card transaction types.
|
||||
*
|
||||
* @return array
|
||||
* Associative array of transaction types, keyed by defined constant value.
|
||||
*/
|
||||
function uc_credit_transaction_types() {
|
||||
$types = array(
|
||||
@@ -972,7 +1006,7 @@ function uc_credit_transaction_types() {
|
||||
/**
|
||||
* Retrieves the ID of the default credit card gateway.
|
||||
*
|
||||
* @return
|
||||
* @return string|false
|
||||
* A string containing the ID of the default gateway or FALSE if none exists
|
||||
* or none have valid credit callbacks.
|
||||
*/
|
||||
@@ -996,14 +1030,14 @@ function uc_credit_default_gateway() {
|
||||
/**
|
||||
* Stores a credit card authorization to an order's data array.
|
||||
*
|
||||
* @param $order_id
|
||||
* @param int $order_id
|
||||
* The order associated with the credit card authorization.
|
||||
* @param $auth_id
|
||||
* @param string $auth_id
|
||||
* The payment service's ID for the authorization.
|
||||
* @param $amount
|
||||
* @param float $amount
|
||||
* The amount that was authorized on the card.
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* The entire updated data array for the order.
|
||||
*/
|
||||
function uc_credit_log_authorization($order_id, $auth_id, $amount) {
|
||||
@@ -1029,12 +1063,12 @@ function uc_credit_log_authorization($order_id, $auth_id, $amount) {
|
||||
/**
|
||||
* Logs the capture of a prior authorization to an order's data array.
|
||||
*
|
||||
* @param $order_id
|
||||
* @param int $order_id
|
||||
* The order associated with the credit card capture.
|
||||
* @param $auth_id
|
||||
* @param string $auth_id
|
||||
* The payment service's ID for the authorization that was captured.
|
||||
*
|
||||
* @return
|
||||
* @return array|false
|
||||
* The entire updated data array for the order or FALSE to indicate the
|
||||
* specified authorization was not found.
|
||||
*/
|
||||
@@ -1063,16 +1097,16 @@ function uc_credit_log_prior_auth_capture($order_id, $auth_id) {
|
||||
/**
|
||||
* Logs a credit card reference to an order's data array.
|
||||
*
|
||||
* @param $order_id
|
||||
* @param int $order_id
|
||||
* The order associated with the credit card details.
|
||||
* @param $ref_id
|
||||
* @param string $ref_id
|
||||
* The payment service's ID for the reference that may be used to charge the
|
||||
* same credit card at a later date.
|
||||
* @param $cc_number
|
||||
* @param string $cc_number
|
||||
* The credit card number associated with this reference. Only the last 4
|
||||
* digits will be stored.
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* The entire updated data array for the order.
|
||||
*/
|
||||
function uc_credit_log_reference($order_id, $ref_id, $cc_number) {
|
||||
|
@@ -7,9 +7,8 @@ core = 7.x
|
||||
; Class definitions
|
||||
files[] = uc_cybersource.soap.inc
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-07-16
|
||||
version = "7.x-3.10"
|
||||
; Information added by Drupal.org packaging script on 2019-03-06
|
||||
version = "7.x-3.12"
|
||||
core = "7.x"
|
||||
project = "ubercart"
|
||||
datestamp = "1468644909"
|
||||
|
||||
datestamp = "1551862392"
|
||||
|
@@ -13,7 +13,6 @@
|
||||
* http://growingventuresolutions.com
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_menu().
|
||||
*/
|
||||
@@ -179,12 +178,15 @@ function uc_cybersource_hop_post() {
|
||||
uc_cart_complete_sale($order);
|
||||
uc_order_comment_save($order_id, 0, t('Payment of @amount @currency submitted through CyberSource with request ID @rid.', array('@amount' => $payment_amount, '@currency' => $payment_currency, '@rid' => $request_id)), 'order', 'payment_received');
|
||||
break;
|
||||
|
||||
case 'ERROR':
|
||||
uc_order_comment_save($order_id, 0, t("Payment error:@reason with request ID @rid", array('@reason' => $reason, '@rid' => '@request_id')), 'admin');
|
||||
break;
|
||||
|
||||
case 'REJECT':
|
||||
uc_order_comment_save($order_id, 0, t("Payment is rejected:@reason with request ID @rid", array('@reason' => $reason, '@rid' => '@request_id')), 'admin');
|
||||
break;
|
||||
|
||||
case 'REVIEW':
|
||||
uc_order_update_status($order_id, 'review');
|
||||
uc_order_comment_save($order_id, 0, t('Payment is in review & not complete: @reason. Request ID @rid', array('@reason' => $reason, '@rid' => '@request_id')), 'admin');
|
||||
@@ -533,13 +535,16 @@ function uc_cybersource_charge($order_id, $amount, $data) {
|
||||
case 'american express':
|
||||
$cc_type = '003';
|
||||
break;
|
||||
|
||||
case 'visa':
|
||||
$cc_type = '001';
|
||||
break;
|
||||
|
||||
case 'mastercard':
|
||||
case 'master card':
|
||||
$cc_type = '002';
|
||||
break;
|
||||
|
||||
case 'discover':
|
||||
$cc_type = '004';
|
||||
break;
|
||||
@@ -1170,7 +1175,7 @@ function uc_cybersource_uc_calculate_tax($order) {
|
||||
if ($reply->reasonCode == '100') {
|
||||
// Add a city tax if applicable.
|
||||
if (floatval($reply->taxReply->totalCityTaxAmount) > 0) {
|
||||
$result['city'] = (object)array(
|
||||
$result['city'] = (object) array(
|
||||
'id' => 'city',
|
||||
'name' => t('@city city tax', array('@city' => floatval($reply->taxReply->city))),
|
||||
'amount' => floatval($reply->taxReply->totalCityTaxAmount),
|
||||
@@ -1179,7 +1184,7 @@ function uc_cybersource_uc_calculate_tax($order) {
|
||||
|
||||
// Add a county tax if applicable.
|
||||
if (floatval($reply->taxReply->totalCountyTaxAmount) > 0) {
|
||||
$result['county'] = (object)array(
|
||||
$result['county'] = (object) array(
|
||||
'id' => 'county',
|
||||
'name' => t('County tax'),
|
||||
'amount' => floatval($reply->taxReply->totalCountryTaxAmount),
|
||||
@@ -1188,7 +1193,7 @@ function uc_cybersource_uc_calculate_tax($order) {
|
||||
|
||||
// Add a district tax if applicable.
|
||||
if (floatval($reply->taxReply->totalDistrictTaxAmount) > 0) {
|
||||
$result['district'] = (object)array(
|
||||
$result['district'] = (object) array(
|
||||
'id' => 'district',
|
||||
'name' => t('District tax'),
|
||||
'amount' => floatval($reply->taxReply->totalDistrictTaxAmount),
|
||||
@@ -1197,7 +1202,7 @@ function uc_cybersource_uc_calculate_tax($order) {
|
||||
|
||||
// Add a state tax if applicable.
|
||||
if (floatval($reply->taxReply->totalStateTaxAmount) > 0) {
|
||||
$result['state'] = (object)array(
|
||||
$result['state'] = (object) array(
|
||||
'id' => 'state',
|
||||
'name' => t('@state state tax', array('@state' => $reply->taxReply->state)),
|
||||
'amount' => floatval($reply->taxReply->totalStateTaxAmount),
|
||||
@@ -1215,7 +1220,7 @@ function uc_cybersource_uc_calculate_tax($order) {
|
||||
watchdog('uc_cybersource', 'Tax calculation produced uneven results. Expected a total of @total, received the following: @dump', array('@total' => uc_currency_format($reply->taxReply->totalTaxAmount), '@dump' => '<pre>' . print_r($result, TRUE) . '</pre>'), WATCHDOG_ERROR);
|
||||
|
||||
$result = array(
|
||||
'total' => (object)array(
|
||||
'total' => (object) array(
|
||||
'id' => 'total',
|
||||
'name' => t('Tax'),
|
||||
'amount' => floatval($reply->taxReply->totalTaxAmount),
|
||||
@@ -1310,10 +1315,13 @@ function _uc_cybersource_card_type($cc_number) {
|
||||
else {
|
||||
return '007'; // JCB
|
||||
}
|
||||
|
||||
case '4':
|
||||
return '001'; // Visa
|
||||
|
||||
case '5':
|
||||
return '002'; // MasterCard
|
||||
|
||||
case '6':
|
||||
return '004'; // Discover
|
||||
}
|
||||
@@ -1328,58 +1336,85 @@ function _uc_cybersource_parse_reason_code($code) {
|
||||
switch ($code) {
|
||||
case '100':
|
||||
return t('Successful transaction.');
|
||||
|
||||
case '102':
|
||||
return t('One or more fields in the request are missing or invalid.<br /><b>Possible action:</b> Resend the request with the correct information.');
|
||||
|
||||
case '150':
|
||||
return t('<b>Error:</b> General system failure.<br /><b>Possible action:</b> Wait a few minutes and resend the request.');
|
||||
|
||||
case '151':
|
||||
return t('<b>Error:</b> The request was received, but a server time-out occurred. This error does not include time-outs between the client and the server.<br /><b>Possible action:</b> To avoid duplicating the order, do not resend the request until you have reviewed the order status in the Business Center.');
|
||||
|
||||
case '152':
|
||||
return t('<b>Error:</b> The request was received, but a service did not finish running in time.<br /><b>Possible action:</b> To avoid duplicating the order, do not resend the request until you have reviewed the order status in the Business Center.');
|
||||
|
||||
case '200':
|
||||
return t('The authorization request was approved by the issuing bank but declined by CyberSource because it did not pass the Address Verification Service (AVS) check.<br /><b>Possible action:</b> You can capture the authorization, but consider reviewing the order for the possibility of fraud.');
|
||||
|
||||
case '202':
|
||||
return t('Expired card.<br /><b>Possible action:</b> Request a different card or other form of payment.');
|
||||
|
||||
case '203':
|
||||
return t('General decline of the card. No other information provided by the issuing bank.<br /><b>Possible action:</b> Request a different card or other form of payment.');
|
||||
|
||||
case '204':
|
||||
return t('Insufficient funds in the account.<br /><b>Possible action:</b> Request a different card or other form of payment.');
|
||||
|
||||
case '205':
|
||||
return t("Stolen or lost card.<br /><b>Possible action:</b> Review the customer's information and determine if you want to request a different card from the customer.");
|
||||
|
||||
case '207':
|
||||
return t('Issuing bank unavailable.<br /><b>Possible action:</b> Wait a few minutes and resend the request.');
|
||||
|
||||
case '208':
|
||||
return t('Inactive card or card not authorized for card-not-present transactions.<br /><b>Possible action:</b> Request a different card or other form of payment.');
|
||||
|
||||
case '210':
|
||||
return t('The card has reached the credit limit.<br /><b>Possible action:</b> Request a different card or other form of payment.');
|
||||
|
||||
case '211':
|
||||
return t('The card verification number is invalid.<br /><b>Possible action:</b> Request a different card or other form of payment.');
|
||||
|
||||
case '220':
|
||||
return t("The processor declined the request based on a general issue with the customer's account.<br /><b>Possible action:</b> Request a different form of payment.");
|
||||
|
||||
case '221':
|
||||
return t('The customer matched an entry on the processor’s negative file.<br /><b>Possible action:</b> Review the order and contact the payment processor.');
|
||||
|
||||
case '222':
|
||||
return t("The customer's bank account is frozen.<br /><b>Possible action:</b> Review the order or request a different form of payment.");
|
||||
|
||||
case '230':
|
||||
return t('The authorization request was approved by the issuing bank but declined by CyberSource because it did not pass the card verification number check.<br /><b>Possible action:</b> You can capture the authorization, but consider reviewing the order for the possibility of fraud.');
|
||||
|
||||
case '231':
|
||||
return t('Invalid account number.<br /><b>Possible action:</b> Request a different card or other form of payment.');
|
||||
|
||||
case '232':
|
||||
return t('The card type is not accepted by the payment processor.<br /><b>Possible action:</b> Request a different card or other form of payment. Also, check with CyberSource Customer Support to make sure that your account is configured correctly.');
|
||||
|
||||
case '233':
|
||||
return t('The processor declined the request based on an issue with the request itself.<br /><b>Possible action:</b> Request a different form of payment.');
|
||||
|
||||
case '234':
|
||||
return t('There is a problem with your CyberSource merchant configuration.<br /><b>Possible action:</b> Do not resend the request. Contact Customer Support to correct the configuration problem.');
|
||||
|
||||
case '236':
|
||||
return t('Processor failure.<br /><b>Possible action:</b> Possible action: Wait a few minutes and resend the request.');
|
||||
|
||||
case '240':
|
||||
return t('The card type sent is invalid or does not correlate with the credit card number.<br /><b>Possible action:</b> Ask your customer to verify that the card is really the type indicated in your Web store, then resend the request.');
|
||||
|
||||
case '250':
|
||||
return t('<b>Error:</b> The request was received, but a time-out occurred with the payment processor.<br /><b>Possible action:</b> To avoid duplicating the transaction, do not resend the request until you have reviewed the transaction status in the Business Center.');
|
||||
|
||||
case '475':
|
||||
return t('The customer is enrolled in payer authentication.<br /><b>Possible action:</b> Authenticate the cardholder before continuing with the transaction.');
|
||||
|
||||
case '476':
|
||||
return t("The customer cannot be authenticated.<br /><b>Possible action:</b> Review the customer's order.");
|
||||
|
||||
case '520':
|
||||
return t('The authorization request was approved by the issuing bank but declined by CyberSource based on your Smart Authorization settings.<br /><b>Possible action:</b> Do not capture the authorization without further review. Review the avsCode, cvResult, and factorCode fields to determine why CyberSource rejected the request.');
|
||||
}
|
||||
@@ -1392,50 +1427,73 @@ function _uc_cybersource_parse_avs_code($code) {
|
||||
switch ($code) {
|
||||
case 'A':
|
||||
return t('Street address matches, but 5- and 9-digit postal codes do not match.');
|
||||
|
||||
case 'B':
|
||||
return t('Street address matches, but postal code not verified. Returned only for non U.S.-issued Visa cards.');
|
||||
|
||||
case 'C':
|
||||
return t('Street address and postal code do not match. Returned only for non U.S.-issued Visa cards.');
|
||||
|
||||
case 'D':
|
||||
return t('Street address and postal code match. Returned only for non U.S.-issued Visa cards.');
|
||||
|
||||
case 'E':
|
||||
return t('AVS data is invalid, or AVS is not allowed for this card type.');
|
||||
|
||||
case 'F':
|
||||
return t("Card member's name does not match, but postal code matches. Returned only for the American Express card type.");
|
||||
|
||||
case 'G':
|
||||
return t('Non-U.S. issuing bank does not support AVS.');
|
||||
|
||||
case 'H':
|
||||
return t("Card member's name does not match. Street address and postal code match. Returned only for the American Express card type.");
|
||||
|
||||
case 'I':
|
||||
return t('Address not verified. Returned only for non U.S.-issued Visa cards.');
|
||||
|
||||
case 'K':
|
||||
return t("Card member's name matches but billing address and billing postal code do not match. Returned only for the American Express card type.");
|
||||
|
||||
case 'L':
|
||||
return t("Card member's name and billing postal code match, but billing address does not match. Returned only for the American Express card type");
|
||||
|
||||
case 'N':
|
||||
return t("Street address and postal code do not match. - or - Card member's name, street address and postal code do not match. Returned only for the American Express card type.");
|
||||
|
||||
case 'O':
|
||||
return t("Card member's name and billing address match, but billing postal code does not match. Returned only for the American Express card type.");
|
||||
|
||||
case 'P':
|
||||
return t('Postal code matches, but street address not verified. Returned only for non-U.S.-issued Visa cards.');
|
||||
|
||||
case 'R':
|
||||
return t('System unavailable.');
|
||||
|
||||
case 'S':
|
||||
return t('U.S.-issuing bank does not support AVS.');
|
||||
|
||||
case 'T':
|
||||
return t("Card member's name does not match, but street address matches. Returned only for the American Express card type.");
|
||||
|
||||
case 'U':
|
||||
return t('Address information unavailable. Returned if non-U.S. AVS is not available or if the AVS in a U.S. bank is not functioning properly.');
|
||||
|
||||
case 'W':
|
||||
return t('Street address does not match, but 9-digit postal code matches.');
|
||||
|
||||
case 'X':
|
||||
return t('Exact match. Street address and 9-digit postal code match.');
|
||||
|
||||
case 'Y':
|
||||
return t('Exact match. Street address and 5-digit postal code match.');
|
||||
|
||||
case 'Z':
|
||||
return t('Street address does not match, but 5-digit postal code matches.');
|
||||
|
||||
case '1':
|
||||
return t('AVS is not supported for this processor or card type.');
|
||||
|
||||
case '2':
|
||||
return t('The processor returned an unrecognized value for the AVS response.');
|
||||
}
|
||||
@@ -1448,24 +1506,34 @@ function _uc_cybersource_parse_cvv_code($code) {
|
||||
switch ($code) {
|
||||
case 'D':
|
||||
return t('Transaction determined suspicious by issuing bank.');
|
||||
|
||||
case 'I':
|
||||
return t("Card verification number failed processor's data validation check.");
|
||||
|
||||
case 'M':
|
||||
return t('Card verification number matched.');
|
||||
|
||||
case 'N':
|
||||
return t('Card verification number not matched.');
|
||||
|
||||
case 'P':
|
||||
return t('Card verification number not processed by processor for unspecified reason.');
|
||||
|
||||
case 'S':
|
||||
return t('Card verification number is on the card but was not included in the request.');
|
||||
|
||||
case 'U':
|
||||
return t('Card verification is not supported by the issuing bank.');
|
||||
|
||||
case 'X':
|
||||
return t('Card verification is not supported by the card association.');
|
||||
|
||||
case '1':
|
||||
return t('Card verification is not supported for this processor or card type.');
|
||||
|
||||
case '2':
|
||||
return t('Unrecognized result code returned by processor for card verification response.');
|
||||
|
||||
case '3':
|
||||
return t('No result code returned by processor.');
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
class CyberSourceSoapClient extends SoapClient {
|
||||
|
||||
function __construct($wsdl, $options = NULL) {
|
||||
parent::__construct($wsdl, $options);
|
||||
}
|
||||
@@ -36,4 +37,5 @@ class CyberSourceSoapClient extends SoapClient {
|
||||
|
||||
return parent::__doRequest($request, $location, $action, $version);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -6,9 +6,8 @@ dependencies[] = uc_quote
|
||||
package = Ubercart - payment
|
||||
core = 7.x
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-07-16
|
||||
version = "7.x-3.10"
|
||||
; Information added by Drupal.org packaging script on 2019-03-06
|
||||
version = "7.x-3.12"
|
||||
core = "7.x"
|
||||
project = "ubercart"
|
||||
datestamp = "1468644909"
|
||||
|
||||
datestamp = "1551862392"
|
||||
|
@@ -2,9 +2,12 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Ubercart payment related tests
|
||||
* Ubercart payment related tests.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Tests the checkout payment pane.
|
||||
*/
|
||||
class UbercartPaymentPaneTestCase extends UbercartTestHelper {
|
||||
|
||||
public static function getInfo() {
|
||||
@@ -72,7 +75,8 @@ class UbercartPaymentPaneTestCase extends UbercartTestHelper {
|
||||
$this->assertNoText('No payment required');
|
||||
$this->assertNoText('Subtotal: $0.00');
|
||||
|
||||
// Check that a mixture of free and paid products cannot be purchased for free.
|
||||
// Check that a mixture of free and paid products
|
||||
// cannot be purchased for free.
|
||||
$this->drupalPost('node/' . $free_product->nid, array(), t('Add to cart'));
|
||||
$this->drupalGet('cart/checkout');
|
||||
$this->assertText('Check or money order');
|
||||
@@ -92,4 +96,5 @@ class UbercartPaymentPaneTestCase extends UbercartTestHelper {
|
||||
$this->assertNoText('Select a payment method from the following options.');
|
||||
$this->assertFieldByXPath("//input[@name='panes[payment][payment_method]' and @disabled='disabled']");
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,7 +5,6 @@
|
||||
* Payment administration menu items.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Displays an overview of the available payment methods.
|
||||
*
|
||||
|
@@ -10,9 +10,8 @@ files[] = tests/uc_payment.test
|
||||
|
||||
configure = admin/store/settings/payment
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-07-16
|
||||
version = "7.x-3.10"
|
||||
; Information added by Drupal.org packaging script on 2019-03-06
|
||||
version = "7.x-3.12"
|
||||
core = "7.x"
|
||||
project = "ubercart"
|
||||
datestamp = "1468644909"
|
||||
|
||||
datestamp = "1551862392"
|
||||
|
@@ -13,7 +13,6 @@
|
||||
require_once dirname(__FILE__) . '/uc_payment_checkout_pane.inc';
|
||||
require_once dirname(__FILE__) . '/uc_payment_order_pane.inc';
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_menu().
|
||||
*/
|
||||
|
@@ -75,10 +75,13 @@ function uc_payment_condition_order_balance($order, $balance_comparison, $includ
|
||||
switch ($balance_comparison) {
|
||||
case 'less':
|
||||
return $balance < 0;
|
||||
|
||||
case 'less_equal':
|
||||
return $balance <= 0.01;
|
||||
|
||||
case 'equal':
|
||||
return $balance < 0.01 && $balance > -0.01;
|
||||
|
||||
case 'greater':
|
||||
return $balance >= 0.01;
|
||||
}
|
||||
|
@@ -104,6 +104,7 @@ function uc_order_pane_payment($op, $order, &$form = NULL, &$form_state = NULL)
|
||||
return drupal_render($form['payment']);
|
||||
|
||||
case 'edit-process':
|
||||
$changes = array();
|
||||
$changes['payment_method'] = $form_state['values']['payment_method'];
|
||||
$changes['payment_details'] = isset($form_state['values']['payment_details']) ? $form_state['values']['payment_details'] : array();
|
||||
$func = _uc_payment_method_data($form_state['values']['payment_method'], 'callback');
|
||||
|
@@ -5,9 +5,8 @@ dependencies[] = uc_payment
|
||||
package = Ubercart - payment
|
||||
core = 7.x
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-07-16
|
||||
version = "7.x-3.10"
|
||||
; Information added by Drupal.org packaging script on 2019-03-06
|
||||
version = "7.x-3.12"
|
||||
core = "7.x"
|
||||
project = "ubercart"
|
||||
datestamp = "1468644909"
|
||||
|
||||
datestamp = "1551862392"
|
||||
|
@@ -5,7 +5,6 @@
|
||||
* Provides the Check/Money Order, COD, and "Other" payment methods.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_menu().
|
||||
*/
|
||||
|
@@ -5,7 +5,6 @@
|
||||
* Variable module hook implementations.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_variable_group_info().
|
||||
*/
|
||||
|
@@ -4,9 +4,8 @@ dependencies[] = uc_payment
|
||||
package = Ubercart - payment
|
||||
core = 7.x
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-07-16
|
||||
version = "7.x-3.10"
|
||||
; Information added by Drupal.org packaging script on 2019-03-06
|
||||
version = "7.x-3.12"
|
||||
core = "7.x"
|
||||
project = "ubercart"
|
||||
datestamp = "1468644909"
|
||||
|
||||
datestamp = "1551862392"
|
||||
|
@@ -8,14 +8,8 @@
|
||||
* You should turn on Instant Payment Notifications in your PayPal profile and
|
||||
* set the IPN URL to http://{yoursite.com}/uc_paypal/ipn. See
|
||||
* https://drupal.org/node/1311198 for further information.
|
||||
*
|
||||
* If you have not yet signed up for your PayPal account, please support
|
||||
* Ubercart by using the following link. Thank you!
|
||||
*
|
||||
* https://www.paypal.com/us/mrb/pal=6NXAPNGSS6DFJ
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_menu().
|
||||
*/
|
||||
@@ -208,13 +202,16 @@ function uc_paypal_wpp_charge($order_id, $amount, $data) {
|
||||
case 'american express':
|
||||
$cc_type = 'Amex';
|
||||
break;
|
||||
|
||||
case 'visa':
|
||||
$cc_type = 'Visa';
|
||||
break;
|
||||
|
||||
case 'mastercard':
|
||||
case 'master card':
|
||||
$cc_type = 'MasterCard';
|
||||
break;
|
||||
|
||||
case 'discover':
|
||||
$cc_type = 'Discover';
|
||||
break;
|
||||
@@ -247,7 +244,7 @@ function uc_paypal_wpp_charge($order_id, $amount, $data) {
|
||||
'IPADDRESS' => $ip_address,
|
||||
'AMT' => uc_currency_format($amount, FALSE, FALSE, '.'),
|
||||
'CREDITCARDTYPE' => $cc_type,
|
||||
'ACCT' => $order->payment_details['cc_number'],
|
||||
'ACCT' => $order->payment_details['cc_number'],
|
||||
'EXPDATE' => $expdate,
|
||||
'CVV2' => $order->payment_details['cc_cvv'],
|
||||
'FIRSTNAME' => substr($order->billing_first_name, 0, 25),
|
||||
@@ -338,6 +335,7 @@ function uc_paypal_wpp_charge($order_id, $amount, $data) {
|
||||
->execute();
|
||||
|
||||
break;
|
||||
|
||||
case 'FailureWithWarning':
|
||||
// Fall through.
|
||||
case 'Failure':
|
||||
@@ -348,6 +346,7 @@ function uc_paypal_wpp_charge($order_id, $amount, $data) {
|
||||
'uid' => $user->uid,
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
$message = t('Unexpected acknowledgement status: @status', array('@status' => $nvp_response['ACK']));
|
||||
$result = array(
|
||||
@@ -921,7 +920,7 @@ function uc_paypal_wps_form($form, &$form_state, $order) {
|
||||
$o = 0;
|
||||
foreach ($item->data['attributes'] as $name => $setting) {
|
||||
$data['on' . $o . '_' . $i] = $name;
|
||||
$data['os' . $o . '_' . $i] = implode(', ', (array)$setting);
|
||||
$data['os' . $o . '_' . $i] = implode(', ', (array) $setting);
|
||||
$o++;
|
||||
}
|
||||
}
|
||||
@@ -1031,10 +1030,13 @@ function _uc_paypal_card_type($cc_number) {
|
||||
switch (substr(strval($cc_number), 0, 1)) {
|
||||
case '3':
|
||||
return 'Amex';
|
||||
|
||||
case '4':
|
||||
return 'Visa';
|
||||
|
||||
case '5':
|
||||
return 'MasterCard';
|
||||
|
||||
case '6':
|
||||
return 'Discover';
|
||||
}
|
||||
@@ -1062,14 +1064,19 @@ function _uc_paypal_avscode_message($code) {
|
||||
switch ($code) {
|
||||
case '0':
|
||||
return t('All the address information matched.');
|
||||
|
||||
case '1':
|
||||
return t('None of the address information matched; transaction declined.');
|
||||
|
||||
case '2':
|
||||
return t('Part of the address information matched.');
|
||||
|
||||
case '3':
|
||||
return t('The merchant did not provide AVS information. Not processed.');
|
||||
|
||||
case '4':
|
||||
return t('Address not checked, or acquirer had no response. Service not available.');
|
||||
|
||||
default:
|
||||
return t('No AVS response was obtained.');
|
||||
}
|
||||
@@ -1079,32 +1086,43 @@ function _uc_paypal_avscode_message($code) {
|
||||
case 'A':
|
||||
case 'B':
|
||||
return t('Address matched; postal code did not');
|
||||
|
||||
case 'C':
|
||||
case 'N':
|
||||
return t('Nothing matched; transaction declined');
|
||||
|
||||
case 'D':
|
||||
case 'F':
|
||||
case 'X':
|
||||
case 'Y':
|
||||
return t('Address and postal code matched');
|
||||
|
||||
case 'E':
|
||||
return t('Not allowed for MOTO transactions; transaction declined');
|
||||
|
||||
case 'G':
|
||||
return t('Global unavailable');
|
||||
|
||||
case 'I':
|
||||
return t('International unavailable');
|
||||
|
||||
case 'P':
|
||||
case 'W':
|
||||
case 'Z':
|
||||
return t('Postal code matched; address did not');
|
||||
|
||||
case 'R':
|
||||
return t('Retry for validation');
|
||||
|
||||
case 'S':
|
||||
return t('Service not supported');
|
||||
|
||||
case 'U':
|
||||
return t('Unavailable');
|
||||
|
||||
case 'Null':
|
||||
return t('No AVS response was obtained.');
|
||||
|
||||
default:
|
||||
return t('An unknown error occurred.');
|
||||
}
|
||||
@@ -1118,14 +1136,19 @@ function _uc_paypal_cvvmatch_message($code) {
|
||||
switch ($code) {
|
||||
case '0':
|
||||
return t('Matched');
|
||||
|
||||
case '1':
|
||||
return t('No match');
|
||||
|
||||
case '2':
|
||||
return t('The merchant has not implemented CVV2 code handling.');
|
||||
|
||||
case '3':
|
||||
return t('Merchant has indicated that CVV2 is not present on card.');
|
||||
|
||||
case '4':
|
||||
return t('Service not available');
|
||||
|
||||
default:
|
||||
return t('Unkown error');
|
||||
}
|
||||
@@ -1134,16 +1157,22 @@ function _uc_paypal_cvvmatch_message($code) {
|
||||
switch ($code) {
|
||||
case 'M':
|
||||
return t('Match');
|
||||
|
||||
case 'N':
|
||||
return t('No match');
|
||||
|
||||
case 'P':
|
||||
return t('Not processed');
|
||||
|
||||
case 'S':
|
||||
return t('Service not supported');
|
||||
|
||||
case 'U':
|
||||
return t('Service not available');
|
||||
|
||||
case 'X':
|
||||
return t('No response');
|
||||
|
||||
default:
|
||||
return t('Not checked');
|
||||
}
|
||||
@@ -1156,21 +1185,29 @@ function _uc_paypal_pending_message($reason) {
|
||||
switch ($reason) {
|
||||
case 'address':
|
||||
return t('Customer did not include a confirmed shipping address per your address settings.');
|
||||
|
||||
case 'authorization':
|
||||
return t('Waiting on you to capture the funds per your authorization settings.');
|
||||
|
||||
case 'echeck':
|
||||
return t('eCheck has not yet cleared.');
|
||||
|
||||
case 'intl':
|
||||
return t('You must manually accept or deny this international payment from your Account Overview.');
|
||||
|
||||
case 'multi-currency':
|
||||
case 'multi_currency':
|
||||
return t('You must manually accept or deny a payment of this currency from your Account Overview.');
|
||||
|
||||
case 'unilateral':
|
||||
return t('Your e-mail address is not yet registered or confirmed.');
|
||||
|
||||
case 'upgrade':
|
||||
return t('You must upgrade your account to Business or Premier status to receive credit card payments.');
|
||||
|
||||
case 'verify':
|
||||
return t('You must verify your account before you can accept this payment.');
|
||||
|
||||
case 'other':
|
||||
default:
|
||||
return t('Reason "@reason" unknown; contact PayPal Customer Service for more information.', array('@reason' => $reason));
|
||||
@@ -1184,12 +1221,16 @@ function _uc_paypal_reversal_message($reason) {
|
||||
switch ($reason) {
|
||||
case 'chargeback':
|
||||
return t('The customer has initiated a chargeback.');
|
||||
|
||||
case 'guarantee':
|
||||
return t('The customer triggered a money-back guarantee.');
|
||||
|
||||
case 'buyer-complaint':
|
||||
return t('The customer filed a complaint about the transaction.');
|
||||
|
||||
case 'refund':
|
||||
return t('You gave the customer a refund.');
|
||||
|
||||
case 'other':
|
||||
default:
|
||||
return t('Reason "@reason" unknown; contact PayPal Customer Service for more information.', array('@reason' => $reason));
|
||||
|
@@ -59,34 +59,40 @@ function uc_paypal_ipn() {
|
||||
return;
|
||||
}
|
||||
|
||||
$req = '';
|
||||
|
||||
foreach ($_POST as $key => $value) {
|
||||
$value = urlencode(stripslashes($value));
|
||||
$req .= $key . '=' . $value . '&';
|
||||
$post_fields[] = $key . '=' . urlencode(stripslashes($value));
|
||||
}
|
||||
|
||||
$req .= 'cmd=_notify-validate';
|
||||
$post_fields[] = 'cmd=_notify-validate';
|
||||
|
||||
if (variable_get('uc_paypal_wpp_server', '') == 'https://api-3t.paypal.com/nvp') {
|
||||
$host = 'https://www.paypal.com/cgi-bin/webscr';
|
||||
$host = 'https://ipnpb.paypal.com/cgi-bin/webscr';
|
||||
}
|
||||
else {
|
||||
$host = variable_get('uc_paypal_wps_server', 'https://www.sandbox.paypal.com/cgi-bin/webscr');
|
||||
$host = variable_get('uc_paypal_wps_server', 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr');
|
||||
}
|
||||
|
||||
$response = drupal_http_request($host, array(
|
||||
'method' => 'POST',
|
||||
'data' => $req,
|
||||
));
|
||||
// Setup the cURL request.
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $host);
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, 0);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, implode('&', $post_fields));
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
|
||||
curl_setopt($ch, CURLOPT_NOPROGRESS, 1);
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
|
||||
$response = curl_exec($ch);
|
||||
|
||||
// TODO: Change this to property_exists when we have a PHP requirement >= 5.1.
|
||||
if (array_key_exists('error', $response)) {
|
||||
watchdog('uc_paypal', 'IPN failed with HTTP error @error, code @code.', array('@error' => $response->error, '@code' => $response->code), WATCHDOG_ERROR);
|
||||
// Log any errors to the watchdog.
|
||||
if ($error = curl_error($ch)) {
|
||||
watchdog('uc_paypal', 'IPN failed with cURL error: @error', array('@error' => $error), WATCHDOG_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp($response->data, 'VERIFIED') == 0) {
|
||||
curl_close($ch);
|
||||
|
||||
if (strcmp($response, 'VERIFIED') == 0) {
|
||||
watchdog('uc_paypal', 'IPN transaction verified.');
|
||||
|
||||
$duplicate = (bool) db_query_range('SELECT 1 FROM {uc_payment_paypal_ipn} WHERE txn_id = :id AND status <> :status', 0, 1, array(':id' => $txn_id, ':status' => 'Pending'))->fetchField();
|
||||
@@ -162,7 +168,7 @@ function uc_paypal_ipn() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
elseif (strcmp($response->data, 'INVALID') == 0) {
|
||||
elseif (strcmp($response, 'INVALID') == 0) {
|
||||
watchdog('uc_paypal', 'IPN transaction failed verification.', array(), WATCHDOG_ERROR);
|
||||
uc_order_comment_save($order_id, 0, t('An IPN transaction failed verification for this order.'), 'admin');
|
||||
}
|
||||
|
Reference in New Issue
Block a user