Ejegg has submitted this change and it was merged.
Change subject: WmfTransaction bugfixes
......................................................................
WmfTransaction bugfixes
Change-Id: If454813ffc397135bcc770e33290fc7193ba283e
---
M sites/all/modules/wmf_civicrm/WmfTransaction.php
M sites/all/modules/wmf_civicrm/wmf_civicrm.module
2 files changed, 10 insertions(+), 7 deletions(-)
Approvals:
Ejegg: Looks good to me, approved
diff --git a/sites/all/modules/wmf_civicrm/WmfTransaction.php
b/sites/all/modules/wmf_civicrm/WmfTransaction.php
index dfc27c6..f0c6718 100644
--- a/sites/all/modules/wmf_civicrm/WmfTransaction.php
+++ b/sites/all/modules/wmf_civicrm/WmfTransaction.php
@@ -59,20 +59,16 @@
static function from_unique_id( $unique_id ) {
$transaction = new WmfTransaction();
- $parts = explode( ' ', $unique_id );
-
- if ( count( $parts ) === 0 ) {
- throw new WmfException( 'INVALID_MESSAGE', "Missing ID." );
- }
+ $parts = explode( ' ', trim( $unique_id ) );
$transaction->is_refund = false;
- while ( $parts[0] === "RFD" or $parts[0] === "REFUND" ) {
+ while ( $parts and in_array( $parts[0], array( 'RFD', 'REFUND' ) ) ) {
$transaction->is_refund = true;
array_shift( $parts );
}
$transaction->is_recurring = false;
- while ( $parts[0] === "RECURRING" ) {
+ while ( $parts and $parts[0] === 'RECURRING' ) {
$transaction->is_recurring = true;
array_shift( $parts );
}
@@ -94,6 +90,9 @@
// Note that this sucks in effort_id and any other stuff we're
// using to maintain an actually-unique per-gateway natural key.
$transaction->gateway_txn_id = array_shift( $parts );
+ if ( empty( $transaction->gateway_txn_id ) ) {
+ throw new WmfException( 'INVALID_MESSAGE', "Empty gateway
transaction id" );
+ }
break;
default:
throw new WmfException( 'INVALID_MESSAGE', "Malformed unique id
(too many terms)" );
diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.module
b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
index def6a93..e017889 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.module
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
@@ -498,6 +498,10 @@
break;
case 'cc':
$payment_instrument = 'Credit Card';
+ if ( empty( $msg['payment_submethod'] ) ) {
+ watchdog( 'wmf_civicrm', 'No credit card submethod given',
NULL, WATCHDOG_WARNING );
+ break;
+ }
switch ( strtolower( $msg['payment_submethod'] ) ){
case 'visa':
$payment_instrument .= ': Visa';
--
To view, visit https://gerrit.wikimedia.org/r/149509
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If454813ffc397135bcc770e33290fc7193ba283e
Gerrit-PatchSet: 5
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Awight <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Ejegg <[email protected]>
Gerrit-Reviewer: Katie Horn <[email protected]>
Gerrit-Reviewer: Mwalker <[email protected]>
Gerrit-Reviewer: Ssmith <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits