MediaWiki fundraising/REL1_35
AstroPayFinancialNumbers.php
Go to the documentation of this file.
1<?php
2
4 public function stage( GatewayType $adapter, $normalized, &$stagedData ) {
5 $this->stage_donor_id( $adapter, $normalized, $stagedData );
6 $this->stage_bank_code( $adapter, $normalized, $stagedData );
7 }
8
14 protected function stage_donor_id( GatewayType $adapter, $normalized, &$stagedData ) {
15 if ( !isset( $stagedData['email'] ) ) {
16 return;
17 }
18 // We use these to look up donations by email, so strip out the trailing
19 // spam-tracking sub-address to get the email we'd see complaints from.
20 $email = preg_replace( '/\+[^@]*/', '', $stagedData['email'] );
21 $stagedData['donor_id'] = substr( $email, 0, 20 );
22 }
23
24 protected function stage_bank_code( GatewayType $adapter, $normalized, &$stagedData ) {
25 $submethod = $adapter->getPaymentSubmethod();
26 if ( $submethod ) {
27 $meta = $adapter->getPaymentSubmethodMeta( $submethod );
28 if ( isset( $meta['bank_code'] ) ) {
29 $stagedData['bank_code'] = $meta['bank_code'];
30 }
31 }
32 }
33}
stage(GatewayType $adapter, $normalized, &$stagedData)
Transform a subset of normalized data into the "staged" data expected by a payment processor.
stage_bank_code(GatewayType $adapter, $normalized, &$stagedData)
stage_donor_id(GatewayType $adapter, $normalized, &$stagedData)
They need a 20 char string for a customer ID - give them the first 20 characters of the email address...
GatewayType Interface.
getPaymentSubmethodMeta( $payment_submethod=null)
Get metadata for the specified payment submethod.
getPaymentSubmethod()
Get the name of the currently selected payment submethod.
Used to mark any class which implements an staging method, for transforming data into the form expect...