MediaWiki fundraising/REL1_35
PaymentMethod Class Reference

Describes payment methods. More...

Collaboration diagram for PaymentMethod:

Public Member Functions

 getFamily ()
 Get the high-level family for this method.
 
 getMethodMeta ()
 Get the gateway's specification for this payment method.
 
 getUtmSourceName ()
 
 isCompletelySpecified ()
 TODO: implement this function.
 
 isInstanceOf ( $ancestor)
 

Static Public Member Functions

static newFromCompoundName (GatewayType $gateway, $method_name, $submethod_name, $is_recurring)
 Build a new PaymentMethod object from an name pair.
 
static parseCompoundMethod ( $bareMethod, $subMethod)
 Process an old-style payment method/submethod name into the unique form.
 

Protected Member Functions

 getParent ()
 

Protected Attributes

GatewayType $gateway
 
bool $is_recurring
 
string $name
 
array $spec
 Gateway definition for this payment method.
 

Detailed Description

Describes payment methods.

This currently bridges old and new code, by allowing payment methods to be referenced by legacy (method, submethod) strings, or by a new, unique name for each method. Examples of how these will compare:

Compound (old)     Unique (new)   Family (new)
ew, ew_yandex      ew_yandex      ew
cc, visa           cc_visa        cc
paypal, paypal     paypal         paypal

We are deprecating the "submethod" distinction, dealing with methods should be simplified by referring to a single PaymentMethod object. The concept of a "family" becomes more important, this roughly maps to the donor's intended payment experience, and is the field we use for most reporting.

Definition at line 21 of file PaymentMethod.php.

Member Function Documentation

◆ getFamily()

PaymentMethod::getFamily ( )

Get the high-level family for this method.

Returns
PaymentMethod the most general ancestor of this method

Definition at line 148 of file PaymentMethod.php.

Referenced by getUtmSourceName().

◆ getMethodMeta()

PaymentMethod::getMethodMeta ( )

Get the gateway's specification for this payment method.

Returns
array method specification data

Definition at line 114 of file PaymentMethod.php.

References $spec.

◆ getParent()

PaymentMethod::getParent ( )
protected
Returns
PaymentMethod|null parent method or null if there is no parent

Definition at line 159 of file PaymentMethod.php.

References newFromCompoundName().

◆ getUtmSourceName()

PaymentMethod::getUtmSourceName ( )
Returns
string normalized utm_source payment method component

Definition at line 169 of file PaymentMethod.php.

References $source, and getFamily().

◆ isCompletelySpecified()

PaymentMethod::isCompletelySpecified ( )

TODO: implement this function.

Returns
true if this payment method is complete enough to begin a transaction

Definition at line 122 of file PaymentMethod.php.

◆ isInstanceOf()

PaymentMethod::isInstanceOf ( $ancestor)
Parameters
string$ancestor
Returns
bool if the $method descends from a more general $ancestor method, or if they are equal.

Definition at line 132 of file PaymentMethod.php.

◆ newFromCompoundName()

static PaymentMethod::newFromCompoundName ( GatewayType $gateway,
$method_name,
$submethod_name,
$is_recurring )
static

Build a new PaymentMethod object from an name pair.

Parameters
GatewayType$gateway
string$method_name
string$submethod_name
bool$is_recurring
Returns
PaymentMethod

Definition at line 53 of file PaymentMethod.php.

References $gateway, $is_recurring, $spec, GatewayType\getPaymentMethodMeta(), GatewayType\getPaymentSubmethodMeta(), and parseCompoundMethod().

Referenced by getParent(), and DonationData\setUtmSource().

◆ parseCompoundMethod()

static PaymentMethod::parseCompoundMethod ( $bareMethod,
$subMethod )
static

Process an old-style payment method/submethod name into the unique form.

For now, this just eliminates duplicated method-submethods.

Parameters
string$bareMethodold-style payment method
string$subMethodold-style payment submethod
Returns
string unique method id

Definition at line 95 of file PaymentMethod.php.

Referenced by newFromCompoundName().

Member Data Documentation

◆ $gateway

GatewayType PaymentMethod::$gateway
protected

Definition at line 25 of file PaymentMethod.php.

Referenced by newFromCompoundName().

◆ $is_recurring

bool PaymentMethod::$is_recurring
protected

Definition at line 35 of file PaymentMethod.php.

Referenced by newFromCompoundName().

◆ $name

string PaymentMethod::$name
protected

Definition at line 30 of file PaymentMethod.php.

◆ $spec

array PaymentMethod::$spec
protected

Gateway definition for this payment method.

Definition at line 41 of file PaymentMethod.php.

Referenced by getMethodMeta(), and newFromCompoundName().


The documentation for this class was generated from the following file: