Awight has uploaded a new change for review.
https://gerrit.wikimedia.org/r/183752
Change subject: Move function into the base class
......................................................................
Move function into the base class
Bug: T86256
Change-Id: If9f3db5bef09342927d2c3bd509ed58e979864e2
---
M gateway_common/gateway.adapter.php
M globalcollect_gateway/globalcollect.adapter.php
2 files changed, 25 insertions(+), 24 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface
refs/changes/52/183752/1
diff --git a/gateway_common/gateway.adapter.php
b/gateway_common/gateway.adapter.php
index 7bd03d5..85dc180 100644
--- a/gateway_common/gateway.adapter.php
+++ b/gateway_common/gateway.adapter.php
@@ -3833,9 +3833,31 @@
}
/**
+ * Get payment method meta
+ *
+ * @param string|null $payment_method Defaults to the current payment
method, if null.
+ *
+ * @throws MWException
+ */
+ public function getPaymentMethodMeta( $payment_method = null ) {
+ if ( $payment_method === null ) {
+ $payment_method = $this->getPaymentMethod();
+ }
+
+ if ( isset( $this->payment_methods[ $payment_method ] ) ) {
+
+ return $this->payment_methods[ $payment_method ];
+ }
+ else {
+ $message = "The payment method [{$payment_method}] was
not found.";
+ throw new MWException( $message );
+ }
+ }
+
+ /**
* Get payment submethod meta
*
- * @param string $payment_submethod Payment submethods are
mapped to paymentproductid
+ * @param string|null $payment_submethod Payment submethods
are mapped to paymentproductid
* @throws MWException
*/
public function getPaymentSubmethodMeta( $payment_submethod = null ) {
@@ -3854,7 +3876,7 @@
return $this->payment_submethods[ $payment_submethod ];
}
else {
- throw new MWException( "The payment submethod [
{$payment_submethod} ] was not found." );
+ throw new MWException( "The payment submethod
[{$payment_submethod}] was not found." );
}
}
diff --git a/globalcollect_gateway/globalcollect.adapter.php
b/globalcollect_gateway/globalcollect.adapter.php
index 01a59d0..69863da 100644
--- a/globalcollect_gateway/globalcollect.adapter.php
+++ b/globalcollect_gateway/globalcollect.adapter.php
@@ -1069,27 +1069,6 @@
}
/**
- * Get payment method meta
- *
- * @todo
- * - These may need to move to the parent class
- *
- * @param string $payment_method Payment methods contain
payment submethods
- * @throws MWException
- */
- public function getPaymentMethodMeta( $payment_method ) {
-
- if ( isset( $this->payment_methods[ $payment_method ] ) ) {
-
- return $this->payment_methods[ $payment_method ];
- }
- else {
- $message = 'The payment method [ ' . $payment_method .
' ] was not found.';
- throw new MWException( $message );
- }
- }
-
- /**
* Because GC has some processes that involve more than one
do_transaction
* chained together, we're catching those special ones in an overload
and
* letting the rest behave normally.
@@ -1486,7 +1465,7 @@
}
//if we're of a type that sends donors off
never to return, we should record that here.
- $payment_info = $this->getPaymentMethodMeta(
$this->getPaymentMethod() );
+ $payment_info = $this->getPaymentMethodMeta();
if ( array_key_exists( 'short_circuit_at',
$payment_info ) && $payment_info['short_circuit_at'] === 'first_iop' ){
if ( array_key_exists(
'additional_success_status', $payment_info ) && is_array(
$payment_info['additional_success_status'] ) ){
foreach (
$payment_info['additional_success_status'] as $status ){
--
To view, visit https://gerrit.wikimedia.org/r/183752
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If9f3db5bef09342927d2c3bd509ed58e979864e2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Awight <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits