r43157 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r43156‎ | r43157 | r43158 >
Date:21:48, 3 November 2008
Author:straussd
Status:old
Tags:
Comment:
Update gateway processing to handle the new contribution tracking system (but remain backwards-compatible with the old one).
Modified paths:
  • /civicrm/trunk/sites/all/modules/fundcore/gateways/fundcore_moneybookers.module (modified) (history)
  • /civicrm/trunk/sites/all/modules/fundcore/gateways/fundcore_paypal.module (modified) (history)

Diff [purge]

Index: civicrm/trunk/sites/all/modules/fundcore/gateways/fundcore_paypal.module
@@ -61,6 +61,18 @@
6262
6363 $timestamp = strtotime($post_data['payment_date']);
6464
 65+ // Detect if we're using the new-style
 66+ if (is_numeric($post_data['option_selection1'])) {
 67+ $tracking_data = db_fetch_array(db_query('SELECT * FROM {contribution_tracking} WHERE id = %d', $post_data['option_selection1']));
 68+ $contribution['anonymous'] = $tracking_data['anonymous'];
 69+ $contribution['comment'] = $tracking_data['note'];
 70+ }
 71+ else {
 72+ $split = explode(';', $post_data['option_selection1']);
 73+ $contribution['anonymous'] = ($split[0] != 'public' && $split[0] != 'Mention my name');
 74+ $contribution['comment'] = $post_data['option_selection2'];
 75+ }
 76+
6577 $contribution['email'] = $post_data['payer_email'];
6678 $contribution['first_name'] = $post_data['first_name'];
6779 $contribution['last_name'] = $post_data['last_name'];
@@ -74,15 +86,12 @@
7587 $contribution['country'] = $post_data['address_country_code'];
7688 $contribution['postal_code'] = $post_data['address_zip'];
7789
78 - $split = explode(';', $post_data['option_selection1']);
79 - $contribution['anonymous'] = ($split[0] != 'public' && $split[0] != 'Mention my name');
8090 $contribution['gateway_txn_id'] = $post_data['txn_id'];
8191 $contribution['original_currency'] = $post_data['mc_currency'];
8292 $contribution['original_gross'] = $post_data['mc_gross'];
8393 $contribution['fee'] = exchange_rate_convert($post_data['mc_currency'], $post_data['mc_fee'], $timestamp);
8494 $contribution['gross'] = exchange_rate_convert($post_data['mc_currency'], $post_data['mc_gross'], $timestamp);
8595 $contribution['net'] = $contribution['gross'] - $contribution['fee'];
86 - $contribution['comment'] = $post_data['option_selection2'];
8796 $contribution['date'] = $timestamp;
8897
8998 drupal_set_message('<pre>' . check_plain(print_r($contribution, TRUE)) . '</pre>');
Index: civicrm/trunk/sites/all/modules/fundcore/gateways/fundcore_moneybookers.module
@@ -47,12 +47,24 @@
4848 }
4949
5050 function fundcore_moneybookers_parse($post_data, $timestamp) {
 51+ $contribution = array();
 52+
 53+ // Detect if we're using the new-style
 54+ if (is_numeric($post_data['os0'])) {
 55+ $tracking_data = db_fetch_array(db_query('SELECT * FROM {contribution_tracking} WHERE id = %d', $post_data['os0']));
 56+ $contribution['anonymous'] = $tracking_data['anonymous'];
 57+ $contribution['comment'] = $tracking_data['note'];
 58+ }
 59+ else {
 60+ $split = explode(';', $post_data['os0']);
 61+ $contribution['anonymous'] = ($split[0] != 'public' && $split[0] != 'Mention my name');
 62+ $contribution['comment'] = $post_data['os1'];
 63+ }
 64+
5165 $split = explode('@', $post_data['pay_from_email']);
5266 $contribution['first_name'] = '';
5367 $contribution['last_name'] = $split[0];
5468 $contribution['email'] = $post_data['pay_from_email'];
55 - $split = explode(';', $post_data['os0']);
56 - $contribution['anonymous'] = ($split[0] != 'public' && $split[0] != 'Mention my name');
5769 $contribution['gateway_txn_id'] = $post_data['mb_transaction_id'];
5870 $contribution['original_currency'] = $post_data['currency'];
5971 $contribution['original_gross'] = $post_data['amount'];
@@ -60,7 +72,6 @@
6173 $contribution['fee'] = 0;
6274 $contribution['net'] = $contribution['gross'] - $contribution['fee'];
6375 $contribution['date'] = $timestamp;
64 - $contribution['comment'] = $post_data['os1'];
6576
6677 return $contribution;
6778 }

Status & tagging log