Index: trunk/extensions/ContributionTracking/ContributionTracking_body.php |
— | — | @@ -90,6 +90,7 @@ |
91 | 91 | // Set the action and tracking ID fields |
92 | 92 | $repost = array(); |
93 | 93 | $action = 'http://wikimediafoundation.org/'; |
| 94 | + $amount_field_name = 'amount'; // the amount fieldname may be different depending on the service |
94 | 95 | if ( $gateway == 'paypal' ) { |
95 | 96 | $action = 'https://www.paypal.com/cgi-bin/webscr'; |
96 | 97 | |
— | — | @@ -104,17 +105,28 @@ |
105 | 106 | $repost['business'] = 'donations@wikimedia.org'; |
106 | 107 | $repost['item_name'] = 'One-time donation'; |
107 | 108 | $repost['item_number'] = 'DONATE'; |
108 | | - $repost['cmd'] = '_xclick'; |
109 | 109 | $repost['no_note'] = '0'; |
110 | | - $repost['notify_url'] = 'https://civicrm.wikimedia.org/fundcore_gateway/paypal'; |
111 | 110 | $repost['return'] = $returnto; |
112 | | - |
113 | 111 | $repost['currency_code'] = $wgRequest->getText( 'currency_code', 'USD' ); |
114 | 112 | |
115 | 113 | // additional fields to pass to PayPal from single-step credit card form |
116 | 114 | $repost[ 'first_name' ] = $wgRequest->getText( 'fname', null ); |
117 | 115 | $repost[ 'last_name' ] = $wgRequest->getText( 'lname', null ); |
118 | 116 | $repost[ 'email' ] = $wgRequest->getText( 'email', null ); |
| 117 | + |
| 118 | + // if this is a recurring donation, we have add'l fields to send to paypal |
| 119 | + if ( $wgRequest->getText( 'recurring_paypal' ) == 'true' ) { |
| 120 | + $repost[ 't3' ] = "M"; // The unit of measurement for for p3 (M = month) |
| 121 | + $repost[ 'p3' ] = '1'; // Billing cycle duration |
| 122 | + $repost[ 'srt' ] = '12'; // # of billing cycles |
| 123 | + $repost[ 'src' ] = '1'; // Make this 'recurring' |
| 124 | + $repost[ 'sra' ] = '1'; // Turn on re-attempt on failure |
| 125 | + $repost[ 'cmd' ] = '_xclick-subscriptions'; |
| 126 | + $amount_field_name = 'a3'; |
| 127 | + } else { |
| 128 | + $repost['cmd'] = '_xclick'; |
| 129 | + $repost['notify_url'] = 'https://civicrm.wikimedia.org/fundcore_gateway/paypal'; |
| 130 | + } |
119 | 131 | } |
120 | 132 | else if ( $gateway == 'moneybookers' ) { |
121 | 133 | $action = 'https://www.moneybookers.com/app/payment.pl'; |
— | — | @@ -134,9 +146,9 @@ |
135 | 147 | } |
136 | 148 | |
137 | 149 | // Normalized amount |
138 | | - $repost['amount'] = $wgRequest->getVal( 'amount' ); |
| 150 | + $repost[ $amount_field_name ] = $wgRequest->getVal( 'amount' ); |
139 | 151 | if ( $wgRequest->getVal( 'amountGiven' ) ) { |
140 | | - $repost['amount'] = $wgRequest->getVal( 'amountGiven' ); |
| 152 | + $repost[ $amount_field_name ] = $wgRequest->getVal( 'amountGiven' ); |
141 | 153 | } |
142 | 154 | |
143 | 155 | // Tracking |