MediaWiki fundraising/REL1_35
|
Public Member Functions | |
__construct ( $options=[]) | |
Constructor. | |
addRequestData ( $dataArray) | |
A helper function to let us stash extra data after the form has been submitted. | |
addResponseData ( $dataArray) | |
Add data from the processor to staged_data and run any unstaging functions. | |
addStandardMessageFields ( $transaction) | |
For making freeform queue messages. | |
buildOrderIDSources () | |
buildOrderIDSources: Uses the 'alt_locations' array in the order id metadata, to build an array of all possible candidates for order_id. | |
buildRequestParams () | |
Build the parameters sent with the next request. | |
calculateKeyMashScore ( $stringToCheck) | |
cancel () | |
Cancel payment based on adapter and set status to cancelled. | |
checkTokens () | |
Checks the edit tokens in the user's session against the one gathered from populated form data. | |
createDonorReturnParams () | |
Takes normalized data and creates adapter specific params for processDonorReturn. | |
defineDataTransformers () | |
Sets up the $data_transformers array. | |
definePaymentMethods () | |
Sets up the $payment_methods array. | |
do_transaction ( $transaction) | |
Performs a transaction through the gateway. | |
finalizeInternalStatus ( $status) | |
Sets the final payment status. | |
findCodeAction ( $transaction, $key, $code) | |
findCodeAction | |
formatStagedData () | |
Format staged data. | |
generateOrderID ( $dataObj=null) | |
Default orderID generation This used to be done in DonationData, but gateways should control the format here. | |
getAccountConfig ( $key) | |
Get globals-based configuration setting. | |
getAvailableSubmethods () | |
Get metadata for all available submethods, given current method / country TODO: A PaymentMethod should be able to list its child options. | |
getClientSideValidationRules () | |
Returns an array of rules used to validate data before submission. | |
getConfig ( $key=null) | |
Get settings loaded from adapter's config directory. | |
getCoreDataTransformers () | |
getCurrencies ( $options=[]) | |
getCurrentTransaction () | |
Gets the currently set transaction name. | |
getData_Unstaged_Escaped ( $val='') | |
This is the ONLY getData type function anything should be using outside the adapter. | |
getDataConstraints ( $field) | |
Get any known constraints on the field's value. | |
getDataSources () | |
getDataTransformers () | |
FIXME: Not convinced we need this. | |
getDonationRules () | |
Add donation rules for the users country & currency combo. | |
getErrorMap ( $code, $options=[]) | |
getErrorMap | |
getErrorMapByCodeAndTranslate ( $code) | |
getErrorMapByCodeAndTranslate | |
getErrorState () | |
Return any errors that prevent this transaction from continuing. | |
getFinalStatus () | |
If it has been set: returns the final payment status in the $final_status member variable.This is the one we care about for switching on overall behavior. Otherwise, returns false.
| |
getFormFields ( $knownData=null) | |
Build list of form fields TODO: Determine if this ever needs to be overridden per gateway, or if all the per-country / per-gateway cases can be expressed declaratively in payment method / submethod metadata. | |
getGatewayAdapterClass () | |
getLogDebugJSON () | |
Returns some useful debugging JSON we can append to loglines for increased debugging happiness. | |
getLogMessagePrefix () | |
Get the log message prefix: $contribution_tracking_id . | |
getMerchantID () | |
For places that might need the merchant ID outside of the adapter. | |
getMonthlyConvertAmounts () | |
Add the suggested monthly donation amounts for each donation level according to the currency saved in session for this donation attempt. | |
getOrderIDMeta ( $key=false) | |
Returns information about how to manage the Order ID, either a specific value or the whole associative array. | |
getPaymentMethod () | |
Get the payment method. | |
getPaymentMethodMeta ( $payment_method=null) | |
Get metadata for the specified payment method as set in. | |
getPaymentMethods () | |
Define payment methods. | |
getPaymentSubmethod () | |
Get the name of the currently selected payment submethod. | |
getPaymentSubmethodMeta ( $payment_submethod=null) | |
Get metadata for the specified payment submethod. | |
getPaymentSubmethods () | |
Get the entire list of payment submethod definitions. | |
getRequestProcessId ( $requestValues) | |
Gateways which return true from isReturnProcessingRequired must override this with logic to get an ID from the request which will identify repeated attempts to process the same payment. | |
getRequiredFields ( $knownData=null) | |
getResponseType () | |
Default response type to be the same as communication type. | |
getScoreCountryMap () | |
This custom filter function checks the global variable: | |
getScoreEmailDomainMap () | |
This custom filter function checks the global variable: | |
getScoreName () | |
This custom filter function checks the global variable: wgDonationInterfaceNameFilterRules Each entry in that array has keys KeyMapA, KeyMapB: define keyboard zones GibberishWeight: threshold fraction of name letters in a single zone Score: added to the total fraud score when this threshold is exceeded. | |
getScoreUtmCampaignMap () | |
This custom filter function checks the global variable: | |
getScoreUtmMediumMap () | |
This custom filter function checks the global variable: | |
getScoreUtmSourceMap () | |
This custom filter function checks the global variable: | |
getTransactionData () | |
Returns the FORMATTED data harvested from the reply, or false if it is not set. | |
getTransactionMessage () | |
getTransactionResponse () | |
Returns the response object with the details of the latest transaction, or null if the adapter has not yet performed one. | |
getTransactionSpecificValue ( $gateway_field_name) | |
This function is used exclusively by the two functions that build requests to be sent directly to external payment gateway servers. | |
getTransactionStatus () | |
Returns the transaction communication status, or false if not set present. | |
getValidationAction () | |
Returns the current validation action. | |
isBatchProcessor () | |
Lets the outside world (particularly filters that accumulate points scores) know if we are a batch processor. | |
isReturnProcessingRequired () | |
Whether donation processing depends on additional processing on-wiki at the donor's return from a payment processor. | |
loadConfig ( $variant=null) | |
localizeGlobal ( $varname) | |
Gets a global variable according to. | |
logFinalStatus ( $status) | |
Easily-child-overridable log component of setting the final transaction status, which will only ever be set at the very end of a transaction workflow. | |
logPending () | |
Dump info about a transaction in logs and pending queues before sending the donor off to complete it. | |
normalizeOrderID ( $override=null, $dataObj=null) | |
This function is meant to be run by the DonationData class, both before and after any communication has been done that might retrieve an order ID. | |
processDonorReturn ( $requestValues) | |
Default implementation sets status to complete. | |
rectifyOrphan () | |
Looks at message to see if it should be rectified Allows exit if the adapter should not rectify the orphan Then tries to see if the orphan can be matched. | |
regenerateOrderID () | |
runAntifraudFilters () | |
Runs all the fraud filters that have been enabled and configured in donationdata.php and/or LocalSettings.php This function is most likely to be called through executeFunctionIfExists, early on in do_transaction. | |
sendFinalStatusMessage ( $status) | |
Build and send a message to the payments-init queue, once the initial workflow is complete. | |
session_addDonorData () | |
Removes any old donor data from the session, and adds the current set. | |
session_ensure () | |
session_ensure Ensure that we have a session set for the current user. | |
session_getData ( $key, $subkey=null) | |
Retrieve data from the session if it's set, and null if it's not. | |
session_hasDonorData () | |
Checks to see if we have donor data in our session. | |
session_killAllEverything () | |
This should kill the session as hard as possible. | |
session_resetForNewAttempt ( $force=false) | |
For those times you want to have the user functionally start over without, you know, cutting your entire head off like you do with session_unsetAllData(). | |
session_setDonorBackupData (array $donorData) | |
Saves a backup of the Donor Data in session. | |
session_unsetAllData () | |
Destroys the session completely. | |
session_unsetDonorData () | |
Unsets the session data, in the case that we've saved it for gateways like GlobalCollect that require it to persist over here through their iframe experience. | |
setCurrentTransaction ( $transaction_name) | |
Sets the transaction you are about to send to the payment gateway. | |
setHash ( $hashval) | |
Set a value used to determine whether data has changed. | |
setOrderIDMeta ( $key, $value) | |
sets more orderID Meta, so we can remember things about what we chose to go with in later logic. | |
setRiskScore ( $score) | |
Set the adapter's fraud score. | |
setValidationAction ( $action, $reset=false) | |
Sets the current validation action. | |
shouldRectifyOrphan () | |
Allows adapters to specify logic as to whether an orphan can be rectified. | |
showMonthlyConvert () | |
token_getSaltedSessionToken () | |
Establish an 'edit' token to help prevent CSRF, etc. | |
unsetHash () | |
Clear the data hash value. | |
unstageKeys ( $processor_data, $key_map=null) | |
Change the keys on this data from processor API names to normalized names. | |
validate () | |
Check donation data for validity and set errors. | |
validatedOK () | |
Public Member Functions inherited from GatewayType | |
doPayment () | |
Attempt the default transaction for the current DonationData. | |
getCommunicationType () | |
Data format for outgoing requests to the processor. | |
Static Public Member Functions | |
static | getEnabledGateways (Config $mwConfig) |
Return an array of all the currently enabled gateways. | |
static | getGatewayName () |
Gets the name of the payment processor, e.g. | |
static | getGlobal ( $varname) |
This function is important. | |
static | getGlobalPrefix () |
static | getIdentifier () |
Get a general purpose identifier for this processor, e.g. | |
static | getLogIdentifier () |
Get a tag to use to identify this adapter in logs, e.g. | |
static | token_generateToken ( $padding='') |
token_generateToken Generate a random string to be used as an edit token. | |
Public Attributes | |
string[] | $debugarray |
bool | $log_outbound = false |
This should be set to true for gateways that don't return the request in the response. | |
bool | $posted = false |
A boolean that will tell us if we've posted to ourselves. | |
const | COMPLETED_PREFACE = 'Completed donation: ' |
const | DONOR = 'Donor' |
const | DONOR_BKUP = 'Donor_BKUP' |
const | GATEWAY_NAME = 'Donation Gateway' |
const | GLOBAL_PREFIX = 'wgDonationGateway' |
const | IDENTIFIER = 'donation' |
const | REDIRECT_PREFACE = 'Redirecting for transaction: ' |
Don't change these strings without fixing cross-repo usages. | |
Protected Member Functions | |
addCodeRange ( $transaction, $key, $action, $lower, $upper=null) | |
addCodeRange is used to define ranges of response codes for major gateway transactions, that let us know what status bucket to sort them into. | |
addContactMessageFields ( $message) | |
IMPORTANT: only add the contact_id to a message if the contact_hash is preset. | |
appendNodeIfValue ( $value, &$node) | |
appendNodeIfValue is a helper function for buildTransactionNodes, which is used by buildRequestXML to construct an XML transaction. | |
buildRequestArray () | |
buildRequestNameValueString () | |
Builds a set of transaction data in name/value format *)The current transaction must be set before you call this function. | |
buildRequestXML ( $rootElement='XML', $encoding='UTF-8') | |
Builds a set of transaction data in XML format *)The current transaction must be set before you call this function. | |
buildTransactionNodes ( $structure, &$node) | |
buildRequestXML helper function. | |
cleanTransactionStructureForLogs ( $structure, $never_log) | |
Recursively sink through a transaction structure array to remove all nodes that we can't have showing up in the server logs. | |
curl_errno ( $ch) | |
Wrapper for the real curl_errno so we can override with magic for unit tests. | |
curl_exec ( $ch) | |
Wrapper for the real curl_exec so we can override with magic for unit tests. | |
curl_getinfo ( $ch) | |
Wrapper for the real curl_getinfo so we can override with magic for unit tests. | |
curl_transaction ( $data) | |
Sends a curl request to the gateway server, and gets a response. | |
curlResponseIsValidFormat ( $curl_response) | |
Allows adapters to specify curl response format requirements (e.g. | |
defineAccountInfo () | |
defineAccountInfo needs to set up the $accountInfo array. | |
defineDataConstraints () | |
TODO: see comment on definePaymentMethods. | |
defineErrorMap () | |
Define the message keys used to display errors to the user. | |
defineOrderIDMeta () | |
Sets up the $order_id_meta array. | |
defineReturnValueMap () | |
defineReturnValueMap sets up the $return_value_map array. | |
defineTransactions () | |
defineTransactions will define the $transactions array. | |
defineVarMap () | |
defineVarMap needs to set up the $var_map array. | |
doQueueTransaction () | |
Sends a queue message to the configured server and queue, based on the outcome of our current transaction. | |
ensureUniqueOrderID () | |
executeIfFunctionExists ( $function_name, $parameter=null) | |
Executes the specified function in $this, if one exists. | |
fallbackToDefaultCurrency () | |
Called when a currency code error exists. | |
findAccount () | |
Determine which account to use for this session. | |
formatXmlString ( $xml) | |
To avoid reinventing the wheel: taken from http://recursive-design.com/blog/2007/04/05/format-xml-with-php/. | |
getCurlBaseHeaders () | |
getCurlBaseOpts () | |
getData_Staged ( $val='') | |
Returns staged data from the adapter object, or null if a key was specified and no value exists. | |
getFailedValidationResponse () | |
getFormattedResponse ( $rawResponse) | |
Take the entire response string, and strip everything we don't care about. | |
getProcessorUrl () | |
Return the base URL to use for the current transaction. | |
getQueueContactMessage () | |
getQueueDonationMessage () | |
Collect donation details and normalize keys for pending or donations queue. | |
getTransactionRequestStructure () | |
Returns the current transaction request structure if it exists, otherwise returns false. | |
incrementNumAttempt () | |
Adds one to the 'numAttempt' field we use to keep track of how many times a donor has attempted a payment, in a session. | |
incrementSequenceNumber () | |
Some payment gateways require a distinct identifier for each API call or for each new payment attempt, even if retrying an attempt that failed validation. | |
isMonthlyConvertCountry () | |
Check if currency is in the list for $wgDonationInterfaceMonthlyConvertCountries. | |
logCompletedPayment () | |
logPaymentDetails ( $preface=self::REDIRECT_PREFACE) | |
parseResponseCommunicationStatus ( $response) | |
Check the response for general sanity - e.g. | |
parseResponseData ( $response) | |
Harvest the data we need back from the gateway. | |
parseResponseErrors ( $response) | |
Parse the response to get the errors in a format we can log and otherwise deal with. | |
postProcessDonation () | |
Runs all the post-process logic that has been enabled and configured in donationdata.php and/or LocalSettings.php, including the queue message. | |
processResponse ( $response) | |
Process the API response obtained from the payment processor and set properties of transaction_response. | |
pushMessage ( $queue, $contactOnly=false) | |
NOTE: Adyen Checkout has it's own pushMessage that does not push recurring iDEALs to the donations queue. | |
refreshGatewayValueFromSource ( $val) | |
Instead of pulling all the DonationData back through to update one local value, use this. | |
runSessionVelocityFilter () | |
sendPendingMessage () | |
session_resetOnSwitch () | |
Check to see if donor is making a repeated attempt that is incompatible with the previous attempt, such as a gateway changes. | |
setGatewayDefaults ( $options=[]) | |
Called in the constructor, this function should be used to define pieces of default data particular to the gateway. | |
stageData () | |
Run any staging DataTransformers configured for the adapter. | |
stripXMLResponseHeaders ( $rawResponse) | |
token_checkTokens () | |
token_checkTokens The main function to check the salted and MD5'd token we should have saved and gathered from the request, against the clear-text token we should have saved to the user's session. | |
token_matchEditToken ( $val) | |
token_matchEditToken Determine the validity of a token by checking it against the salted version of the clear-text token we have already stored in the session. | |
token_refreshAllTokenEverything () | |
token_refreshAllTokenEverything In the case where we have an expired session (token mismatch), we go ahead and fix it for 'em for their next post. | |
transaction_option ( $option_value) | |
If there are things about a transaction that we need to stash in the transaction's definition (defined in a local defineTransactions() ), we can recall them here. | |
trimFieldToConstraints ( $value, $field) | |
Trims a single field according to length constraints in data_constraints.yaml. | |
unstageData () | |
Run any unstaging functions to decode processor responses. | |
validateDataConstraintsMet ( $field, $value) | |
Validates that the gateway-specific data constraints for this field have been met. | |
xmlChildrenToArray ( $xml, $nodename) | |
Static Protected Member Functions | |
static | token_applyMD5AndSalt ( $clear_token) |
token_applyMD5AndSalt Takes a clear-text token, and returns the MD5'd result of the token plus the configured gateway salt. | |
Protected Attributes | |
$account_config | |
$account_name | |
$accountInfo | |
string | $action |
$batch = false | |
array | $config = [] |
config tree | |
string | $current_transaction |
Name of the current transaction. | |
StagingHelper ValidationHelper[] | $data_transformers = [] |
Data transformation helpers. | |
array | $dataConstraints = [] |
$dataConstraints provides information on how to handle variables. | |
DonationData | $dataObj |
array | $error_map = [] |
$error_map Reference map from gateway error to client error. | |
ErrorState | $errorState |
List of errors preventing this transaction from continuing. | |
string | $final_status |
When the smoke clears, this should be set to one of the constants defined in. | |
Psr Log LoggerInterface | $logger |
Standard logger, logs to {type}_gateway. | |
$order_id_candidates | |
$order_id_meta | |
Psr Log LoggerInterface | $payment_init_logger |
Logs to {type}_gateway_payment_init. | |
array | $payment_methods = [] |
$payment_methods will be defined by the adapter. | |
array | $payment_submethods = [] |
$payment_submethods will be defined by the adapter (or will default to an empty array if none are defined). | |
DonationProfiler | $profiler |
Times and logs various operations. | |
$return_value_map | |
int | $risk_score = 0 |
$staged_data | |
PaymentTransactionResponse | $transaction_response |
$transaction_response is the member var that keeps track of the results of the latest discrete transaction with the gateway. | |
$transactions | |
$unstaged_data | |
array | $var_map = [] |
$var_map maps gateway variables to client variables | |
DomDocument | $xmlDoc |
For gateways that speak XML, we use this variable to hold the document while we build the outgoing request. | |
Private Member Functions | |
do_transaction_internal ( $transaction, &$retryVars=null) | |
Called from do_transaction() in order to be able to deal with transactions that had recoverable errors but that do require the entire transaction to be repeated. | |
Definition at line 37 of file gateway.adapter.php.
GatewayAdapter::__construct | ( | $options = [] | ) |
Constructor.
array | $options | OPTIONAL - You may set options for testing
|
Reimplemented in AmazonAdapter.
Definition at line 216 of file gateway.adapter.php.
References $unstaged_data, defineAccountInfo(), defineDataConstraints(), defineDataTransformers(), defineErrorMap(), defineOrderIDMeta(), definePaymentMethods(), defineReturnValueMap(), defineTransactions(), defineVarMap(), findAccount(), DonationLoggerFactory\getLogger(), DonationLoggerFactory\getProfiler(), loadConfig(), BannerHistoryLogIdProcessor\onGatewayReady(), session_resetOnSwitch(), setGatewayDefaults(), stageData(), and validate().
|
protected |
addCodeRange is used to define ranges of response codes for major gateway transactions, that let us know what status bucket to sort them into.
DO NOT DEFINE OVERLAPPING RANGES! TODO: Make sure it won't let you add overlapping ranges. That would probably necessitate the sort moving to here, too.
string | $transaction | The transaction these codes map to. |
string | $key | The (incoming) field name containing the numeric codes we're defining here. |
string | $action | One of the constants defined in |
int | $lower | The integer value of the lower-bound in this code range. |
int | null | $upper | Optional: The integer value of the upper-bound in the code range. If omitted, it will make a range of one value: The lower bound. |
UnexpectedValueException |
Definition at line 1843 of file gateway.adapter.php.
Referenced by AstroPayAdapter\defineReturnValueMap(), GlobalCollectAdapter\defineReturnValueMap(), PaypalExpressAdapter\defineReturnValueMap(), GlobalCollectAdapter\parseResponseData(), and GlobalCollectAdapter\transactionConfirm_CreditCard().
|
protected |
IMPORTANT: only add the contact_id to a message if the contact_hash is preset.
We don't want to allow overwriting arbitrary CiviCRM contacts.
array | $message |
Definition at line 2046 of file gateway.adapter.php.
GatewayAdapter::addRequestData | ( | $dataArray | ) |
A helper function to let us stash extra data after the form has been submitted.
array | $dataArray | An associative array of data. |
Definition at line 543 of file gateway.adapter.php.
References refreshGatewayValueFromSource(), and stageData().
Referenced by AmazonAdapter\__construct(), AmazonAdapter\addDonorDetails(), GlobalCollectAdapter\doPayment(), GlobalCollectAdapter\parseResponseData(), PaypalExpressAdapter\processDonorReturn(), GlobalCollectAdapter\processResponse(), GlobalCollectAdapter\setGatewayDefaults(), IngenicoAdapter\setGatewayDefaults(), and PaypalExpressAdapter\setGatewayDefaults().
GatewayAdapter::addResponseData | ( | $dataArray | ) |
Add data from the processor to staged_data and run any unstaging functions.
array | $dataArray | An associative array of data, with normalized keys and raw processor values. |
Only keys that are included in $dataArray will be persisted to the stored normalized data. This prevents us from overwriting items which should only ever hold data determined in this extension, not data from the processor or return querystring.
Definition at line 569 of file gateway.adapter.php.
References $unstaged_data, and unstageData().
Referenced by AmazonAdapter\authorizeAndCapturePayment(), AdyenCheckoutAdapter\doPayment(), AstroPayAdapter\processDonorReturn(), GlobalCollectAdapter\processResponse(), and PaypalExpressAdapter\processResponse().
GatewayAdapter::addStandardMessageFields | ( | $transaction | ) |
For making freeform queue messages.
As these are all non-critical, we don't need to be as strict as we have been with the other stuff. But, we've got to have some standards.
array | $transaction | The fields that we are interested in sending. |
Implements GatewayType.
Definition at line 2056 of file gateway.adapter.php.
|
protected |
appendNodeIfValue is a helper function for buildTransactionNodes, which is used by buildRequestXML to construct an XML transaction.
This function will append an XML node to the transaction being built via the passed-in parent node, only if the current node would have a non-empty value.
string | $value | The GATEWAY's field name for the current node. |
DOMElement | &$node | The parent node this node will be contained in, if it is determined to have a non-empty value. |
Definition at line 948 of file gateway.adapter.php.
References getTransactionSpecificValue().
Referenced by buildTransactionNodes().
GatewayAdapter::buildOrderIDSources | ( | ) |
buildOrderIDSources: Uses the 'alt_locations' array in the order id metadata, to build an array of all possible candidates for order_id.
This will also weed out candidates that do not meet the gateway-specific data constraints for that field, and are therefore invalid.
Definition at line 3430 of file gateway.adapter.php.
References $source.
|
protected |
Definition at line 829 of file gateway.adapter.php.
References ArrayHelper\buildRequestArray(), and getTransactionRequestStructure().
Referenced by buildRequestNameValueString(), do_transaction_internal(), and AdyenCheckoutAdapter\doPayment().
|
protected |
Builds a set of transaction data in name/value format *)The current transaction must be set before you call this function.
*)Uses getTransactionSpecificValue to assign staged values to the fields required by the gateway. Look there for more insight into the heirarchy of all possible data sources.
Definition at line 823 of file gateway.adapter.php.
References buildRequestArray().
Referenced by do_transaction_internal().
GatewayAdapter::buildRequestParams | ( | ) |
Build the parameters sent with the next request.
Implements GatewayType.
Definition at line 2171 of file gateway.adapter.php.
|
protected |
Builds a set of transaction data in XML format *)The current transaction must be set before you call this function.
*)(eventually) uses getTransactionSpecificValue to assign staged values to the fields required by the gateway. Look there for more insight into the heirarchy of all possible data sources.
string | $rootElement | Name of root element |
string | $encoding | Character set to use for tag values |
Definition at line 850 of file gateway.adapter.php.
References buildTransactionNodes(), cleanTransactionStructureForLogs(), getCurrentTransaction(), and getTransactionRequestStructure().
Referenced by do_transaction_internal().
|
protected |
buildRequestXML helper function.
Builds the XML transaction by recursively crawling the transaction structure and adding populated nodes by reference.
array | $structure | Current transaction's more leafward structure, from the point of view of the current XML node. |
DOMElement | &$node | The current XML node. |
Definition at line 895 of file gateway.adapter.php.
References appendNodeIfValue(), and buildTransactionNodes().
Referenced by buildRequestXML(), and buildTransactionNodes().
GatewayAdapter::calculateKeyMashScore | ( | $stringToCheck | ) |
string | $stringToCheck |
Definition at line 1597 of file gateway.adapter.php.
GatewayAdapter::cancel | ( | ) |
Cancel payment based on adapter and set status to cancelled.
Reimplemented in IngenicoAdapter.
Definition at line 3897 of file gateway.adapter.php.
References PaymentResult\newFailure().
GatewayAdapter::checkTokens | ( | ) |
Checks the edit tokens in the user's session against the one gathered from populated form data.
Adds a string to the debugarray, to make it a little easier to tell what happened if we turn the debug results on. Only called from the .body pages
Definition at line 494 of file gateway.adapter.php.
References refreshGatewayValueFromSource(), and token_checkTokens().
|
protected |
Recursively sink through a transaction structure array to remove all nodes that we can't have showing up in the server logs.
Mostly for CVV: If we log those, we are all fired.
array | $structure | The transaction structure that we want to clean. |
array | $never_log | An array of values we should never log. These values should be the gateway's transaction nodes, rather than our normal values. |
Definition at line 925 of file gateway.adapter.php.
References cleanTransactionStructureForLogs().
Referenced by buildRequestXML(), and cleanTransactionStructureForLogs().
GatewayAdapter::createDonorReturnParams | ( | ) |
Takes normalized data and creates adapter specific params for processDonorReturn.
Reimplemented in PaypalExpressAdapter.
Definition at line 3881 of file gateway.adapter.php.
|
protected |
Wrapper for the real curl_errno so we can override with magic for unit tests.
resource | $ch | curl handle (returned from curl_init) |
Definition at line 1532 of file gateway.adapter.php.
|
protected |
Wrapper for the real curl_exec so we can override with magic for unit tests.
resource | $ch | curl handle (returned from curl_init) |
Definition at line 1514 of file gateway.adapter.php.
|
protected |
Wrapper for the real curl_getinfo so we can override with magic for unit tests.
resource | $ch | curl handle (returned from curl_init) |
Definition at line 1523 of file gateway.adapter.php.
|
protected |
Sends a curl request to the gateway server, and gets a response.
Saves that response to the transaction_response's rawResponse;
string | $data | the raw data we want to curl up to a server somewhere. Should have been constructed with either buildRequestNameValueString, or buildRequestXML. |
Reimplemented in IngenicoAdapter.
Definition at line 1366 of file gateway.adapter.php.
Referenced by do_transaction_internal().
|
protected |
Allows adapters to specify curl response format requirements (e.g.
xml, json, other custom format)
Defaults to true to allow any response format where check not needed.
mixed | $curl_response |
Reimplemented in GlobalCollectAdapter.
Definition at line 3961 of file gateway.adapter.php.
|
abstractprotected |
defineAccountInfo needs to set up the $accountInfo array.
Keys = the name (or node name) value in the gateway transaction Values = The actual values for those keys. Probably have to access a global or two. (use getGlobal()!)
Reimplemented in AdyenCheckoutAdapter, AmazonAdapter, AstroPayAdapter, BraintreeAdapter, DlocalAdapter, GlobalCollectAdapter, and PaypalExpressAdapter.
Referenced by __construct().
|
protected |
TODO: see comment on definePaymentMethods.
Definition at line 408 of file gateway.adapter.php.
Referenced by __construct().
GatewayAdapter::defineDataTransformers | ( | ) |
Sets up the $data_transformers array.
Definition at line 430 of file gateway.adapter.php.
Referenced by __construct().
|
protected |
Define the message keys used to display errors to the user.
Should set
Reimplemented in AmazonAdapter, and AstroPayAdapter.
Definition at line 421 of file gateway.adapter.php.
Referenced by __construct().
|
abstractprotected |
Sets up the $order_id_meta array.
In general, $order_id_meta contains default data about how we handle/create/gather order_id, which needs to be defined on a per-gateway basis. Once $order_id_meta has been used to decide the order_id for the current request, it will also be used to keep information about the origin and state of the order_id data.
Should contain the following keys/values: 'alt_locations' => [ $dataset_name, $dataset_key ] ** alt_locations is intended to contain a list of arrays that are always available (or should be), from which we can pull the order_id. ** Examples of valid things to throw in $dataset_name are 'request' and 'session' ** $dataset_key : The key in the associated dataset that is expected to contain the order_id. Probably going to be order_id if we are generating the dataset internally. Probably something else if a gateway is posting or getting back to us in a resultswitcher situation. ** These should be expressed in $order_id_meta in order of preference / authority. 'generate' => boolean value. True if we will be generating our own order IDs, false if we are deferring order_id generation to the gateway. 'ct_id' => boolean value. If True, when generating order ID use the contribution tracking ID with the sequence number appended
Will eventually contain the following keys/values: 'final'=> The value that we have chosen as the valid order ID for this request. 'final_source' => Where we ultimately decided to grab the value we chose to stuff in 'final'.
Reimplemented in AdyenCheckoutAdapter, AmazonAdapter, AstroPayAdapter, BraintreeAdapter, DlocalAdapter, GlobalCollectAdapter, IngenicoAdapter, and PaypalExpressAdapter.
Referenced by __construct().
GatewayAdapter::definePaymentMethods | ( | ) |
Sets up the $payment_methods array.
Keys = unique name for this method Values = metadata about the method 'validation' should be an array whose keys are field names and whose values indicate whether the field is required For legacy support. TODO replace with access to config structure
Reimplemented in AstroPayAdapter.
Definition at line 384 of file gateway.adapter.php.
Referenced by __construct().
|
abstractprotected |
defineReturnValueMap sets up the $return_value_map array.
Keys = The different constants that may be contained as values in the gateway's response. Values = what that string constant means to mediawiki.
Reimplemented in AdyenCheckoutAdapter, AmazonAdapter, AstroPayAdapter, BraintreeAdapter, DlocalAdapter, GlobalCollectAdapter, and PaypalExpressAdapter.
Referenced by __construct().
|
abstractprotected |
defineTransactions will define the $transactions array.
The array will contain everything we need to know about the request structure for all the transactions we care about, for the current gateway. First array key: Some way for us to id the transaction. Doesn't actually have to be the gateway's name for it, but I'm going with that until I have a reason not to. Second array key: 'request' contains the structure of that request. Leaves in the array tree will eventually be mapped to actual values of ours, according to the precedence established in the getTransactionSpecificValue function. 'values' contains default values for the transaction. Things that are typically not overridden should go here. 'check_required' should be set to true for transactions that require donor information, like initial payment setup. TODO: different required fields per transaction
Reimplemented in AdyenCheckoutAdapter, AmazonAdapter, AstroPayAdapter, BraintreeAdapter, DlocalAdapter, GlobalCollectAdapter, IngenicoAdapter, and PaypalExpressAdapter.
Referenced by __construct().
|
protected |
defineVarMap needs to set up the $var_map array.
Keys = the name (or node name) value in the gateway transaction Values = the mediawiki field name for the corresponding piece of data. TODO: see comment on definePaymentMethods
Definition at line 399 of file gateway.adapter.php.
Referenced by __construct().
GatewayAdapter::do_transaction | ( | $transaction | ) |
Performs a transaction through the gateway.
Optionally may reattempt the transaction if a recoverable gateway error occurred.
This function provides all functionality to the external world to communicate with a properly constructed gateway and handle all the return data in an appropriate manner. – Appropriateness is determined by the requested $transaction structure and definition.
string | $transaction | The specific transaction type, like 'INSERT_ORDERWITHPAYMENT', that maps to a first-level key in the $transactions array. |
Reimplemented in GlobalCollectAdapter, and IngenicoAdapter.
Definition at line 973 of file gateway.adapter.php.
References $unstaged_data, do_transaction_internal(), getFailedValidationResponse(), getGlobal(), regenerateOrderID(), session_addDonorData(), setCurrentTransaction(), stageData(), validate(), and validatedOK().
Referenced by PaypalExpressAdapter\cancelSubscription(), AstroPayAdapter\doPayment(), PaypalExpressAdapter\doPayment(), PaypalExpressAdapter\doRefund(), and PaypalExpressAdapter\processDonorReturn().
|
private |
Called from do_transaction() in order to be able to deal with transactions that had recoverable errors but that do require the entire transaction to be repeated.
This function has the following extension hooks:
string | $transaction | Name of the transaction being performed |
string | null | &$retryVars | Reference to an array of variables that caused the transaction to fail. |
UnexpectedValueException |
Definition at line 1047 of file gateway.adapter.php.
References $transaction_response, buildRequestArray(), buildRequestNameValueString(), buildRequestXML(), curl_transaction(), executeIfFunctionExists(), GatewayType\getCommunicationType(), ResponseProcessingException\getErrorCode(), getErrorMapByCodeAndTranslate(), getFormattedResponse(), ResponseProcessingException\getRetryVars(), getValidationAction(), isBatchProcessor(), Gateway_Extras_CustomFilters\onGatewayReady(), processResponse(), session_getData(), and setValidationAction().
Referenced by do_transaction().
|
protected |
Sends a queue message to the configured server and queue, based on the outcome of our current transaction.
The big tricky thing here, is that we DO NOT SET a FinalStatus, unless we have just learned what happened to a donation in progress, through performing the current transaction. To put it another way, getFinalStatus should always return false, unless it's new data about a new transaction. In that case, the outcome will be assigned and the proper queue selected.
Probably called in postProcessDonation(), which is itself most likely to be called through executeFunctionIfExists, later on in do_transaction.
Definition at line 1923 of file gateway.adapter.php.
|
protected |
Definition at line 3686 of file gateway.adapter.php.
Referenced by IngenicoAdapter\do_transaction(), AdyenCheckoutAdapter\doPayment(), AmazonAdapter\doPayment(), and AstroPayAdapter\doPayment().
|
protected |
Executes the specified function in $this, if one exists.
NOTE: THIS WILL LCASE YOUR FUNCTION_NAME. ...I like to keep the voodoo functions tidy.
string | $function_name | The name of the function you're hoping to execute. |
mixed | null | $parameter | That's right: For now you only get one. |
Definition at line 2084 of file gateway.adapter.php.
Referenced by do_transaction_internal().
|
protected |
Called when a currency code error exists.
If a fallback currency conversion is enabled for this adapter, convert intended amount to default currency.
TODO: In the future, we might want to switch gateways.
DomainException |
Definition at line 2736 of file gateway.adapter.php.
GatewayAdapter::finalizeInternalStatus | ( | $status | ) |
Sets the final payment status.
This is the one we care about for switching on behavior. DO NOT SET THE FINAL STATUS unless you've just taken an entire donation process to completion: This status being set at all, denotes the very end of the donation process on our end. Further attempts by the same user will be seen as starting over.
string | $status | The final status of one discrete donation attempt, can be one of constants defined in |
UnexpectedValueException |
Definition at line 2229 of file gateway.adapter.php.
Referenced by AmazonAdapter\authorizeAndCapturePayment(), GlobalCollectAdapter\cancelCreditCardPayment(), AstroPayAdapter\doPayment(), GlobalCollectAdapter\finalizeCreditCardPayment(), AmazonAdapter\handleErrors(), GlobalCollectAdapter\parseResponseData(), AstroPayAdapter\processDonorReturn(), GlobalCollectAdapter\processDonorReturn(), PaypalExpressAdapter\processDonorReturn(), AstroPayAdapter\processNewInvoiceResponse(), PaypalExpressAdapter\processResponse(), GlobalCollectAdapter\transactionDirect_Debit(), and GlobalCollectAdapter\transactionRecurring_Charge().
|
protected |
Determine which account to use for this session.
Definition at line 453 of file gateway.adapter.php.
References $account_name, and getGlobal().
Referenced by __construct().
GatewayAdapter::findCodeAction | ( | $transaction, | |
$key, | |||
$code ) |
findCodeAction
string | $transaction | |
string | $key | The key to lookup in the transaction such as STATUSID |
int | string | $code | This gets converted to an integer if the values is numeric. FIXME: We should be pulling $code out of the current transaction fields, internally. FIXME: Rename to reflect that these are Final Status values, not validation actions |
Definition at line 1861 of file gateway.adapter.php.
Referenced by GlobalCollectAdapter\doRefund(), GlobalCollectAdapter\parseResponseData(), AstroPayAdapter\processDonorReturn(), PaypalExpressAdapter\processResponse(), GlobalCollectAdapter\transactionConfirm_CreditCard(), and GlobalCollectAdapter\transactionRecurring_Charge().
GatewayAdapter::formatStagedData | ( | ) |
Format staged data.
Formatting:
Definition at line 2132 of file gateway.adapter.php.
|
protected |
To avoid reinventing the wheel: taken from http://recursive-design.com/blog/2007/04/05/format-xml-with-php/.
string | $xml |
Definition at line 1733 of file gateway.adapter.php.
GatewayAdapter::generateOrderID | ( | $dataObj = null | ) |
Default orderID generation This used to be done in DonationData, but gateways should control the format here.
Override this in child classes.
DonationData | null | $dataObj | Reference to the donation data object when we are forced to create the order ID during construction of it and thus do not already have a reference. THIS IS A HACK! /me vomits |
Reimplemented in AmazonAdapter, and GlobalCollectAdapter.
Definition at line 3638 of file gateway.adapter.php.
References DonationData\getVal(), and DonationData\saveContributionTrackingData().
GatewayAdapter::getAccountConfig | ( | $key | ) |
Get globals-based configuration setting.
string | $key | setting to retrieve |
Implements GatewayType.
Definition at line 3041 of file gateway.adapter.php.
GatewayAdapter::getAvailableSubmethods | ( | ) |
Get metadata for all available submethods, given current method / country TODO: A PaymentMethod should be able to list its child options.
Probably still need some gateway-specific logic to prune the list by country and currency. TODO: Make it possible to override availability by currency and currency in LocalSettings. Idea: same metadata array structure as used in definePaymentMethods, overrides cascade from methodMeta -> submethodMeta -> settingsMethodMeta -> settingsSubmethodMeta
Reimplemented in AmazonAdapter.
Definition at line 3772 of file gateway.adapter.php.
GatewayAdapter::getClientSideValidationRules | ( | ) |
Returns an array of rules used to validate data before submission.
Each entry's key should correspond to the id of the target field, and the value should be a list of rules with keys as described in
Definition at line 3852 of file gateway.adapter.php.
GatewayAdapter::getConfig | ( | $key = null | ) |
Get settings loaded from adapter's config directory.
string | null | $key | setting to retrieve, or null for all |
Implements GatewayType.
Definition at line 348 of file gateway.adapter.php.
References $config.
Referenced by Gateway_Form_Mustache\setGateway().
GatewayAdapter::getCoreDataTransformers | ( | ) |
Definition at line 526 of file gateway.adapter.php.
|
protected |
Definition at line 1250 of file gateway.adapter.php.
References GatewayType\getCommunicationType(), and getData_Staged().
|
protected |
Reimplemented in PaypalExpressAdapter.
Definition at line 1224 of file gateway.adapter.php.
References $path, getGlobal(), getProcessorUrl(), transaction_option(), and true.
GatewayAdapter::getCurrencies | ( | $options = [] | ) |
array | $options | If given, try to filter supported currencies by: 'country' ISO 3166 2 letter country code 'payment_method' 'payment_submethod' |
Implements GatewayType.
Reimplemented in AstroPayAdapter.
Definition at line 1352 of file gateway.adapter.php.
GatewayAdapter::getCurrentTransaction | ( | ) |
Gets the currently set transaction name.
This value should only ever be set with setCurrentTransaction: A function that ensures the current transaction maps to a first-level key that is known to exist in the $transactions array, defined in the child gateway.
Implements GatewayType.
Definition at line 1285 of file gateway.adapter.php.
References $current_transaction.
Referenced by buildRequestXML(), IngenicoAdapter\curl_transaction(), getTransactionRequestStructure(), getTransactionSpecificValue(), GlobalCollectAdapter\parseResponseData(), AstroPayAdapter\processResponse(), GlobalCollectAdapter\processResponse(), PaypalExpressAdapter\processResponse(), and AstroPayAdapter\verifyStatusSignature().
|
protected |
Returns staged data from the adapter object, or null if a key was specified and no value exists.
string | $val | An optional specific key you want returned. |
Definition at line 514 of file gateway.adapter.php.
References $staged_data.
Referenced by AmazonAdapter\authorizeOnBillingAgreement(), AmazonAdapter\authorizeOnOrderReference(), AmazonAdapter\confirmBillingAgreement(), AmazonAdapter\confirmOrderReference(), PaypalExpressAdapter\createDonorReturnParams(), GlobalCollectAdapter\doPayment(), IngenicoAdapter\doPayment(), getCurlBaseHeaders(), getTransactionSpecificValue(), AstroPayAdapter\processNewInvoiceResponse(), AmazonAdapter\setBillingAgreementDetailsIfUnset(), and AmazonAdapter\setOrderReferenceDetailsIfUnset().
GatewayAdapter::getData_Unstaged_Escaped | ( | $val = '' | ) |
This is the ONLY getData type function anything should be using outside the adapter.
Short explanation of the data population up to now: *) When the gateway adapter is constructed, it constructs a DonationData object. *) On construction, the DonationData object pulls donation data from an appropriate source, and normalizes the entire data set for storage. *) The gateway adapter pulls normalized, html escaped data out of the DonationData object, as the base of its own data set.
string | $val | The specific key you're looking for (if any) |
Implements GatewayType.
Definition at line 618 of file gateway.adapter.php.
References $unstaged_data.
Referenced by AmazonAdapter\__construct(), IngenicoAdapter\curl_transaction(), AmazonAdapter\doPayment(), GlobalCollectAdapter\doPayment(), PaypalExpressAdapter\doPayment(), GlobalCollectAdapter\doRefund(), GlobalCollectAdapter\getAVSResult(), GlobalCollectAdapter\getBankList(), AstroPayAdapter\getCurrencies(), GlobalCollectAdapter\getCVVResult(), GlobalCollectAdapter\getGatewayTransactionId(), IngenicoAdapter\getGatewayTransactionId(), getPaymentMethod(), IngenicoAdapter\getPaymentProvider(), getPaymentSubmethod(), IngenicoAdapter\getStatusCode(), localizeGlobal(), GlobalCollectAdapter\parseResponseData(), GlobalCollectAdapter\post_process_get_orderstatus(), GlobalCollectAdapter\processDonorReturn(), PaypalExpressAdapter\processDonorReturn(), PaypalExpressAdapter\processResponse(), AstroPayAdapter\processStatusResponse(), PaypalExpressAdapter\setGatewayDefaults(), GlobalCollectAdapter\transactionConfirm_CreditCard(), GlobalCollectAdapter\tuneForCountry(), GlobalCollectAdapter\tuneForMethod(), GlobalCollectAdapter\tuneForRecurring(), and IngenicoAdapter\tuneForRecurring().
GatewayAdapter::getDataConstraints | ( | $field | ) |
Get any known constraints on the field's value.
string | $field |
Implements GatewayType.
Definition at line 3511 of file gateway.adapter.php.
GatewayAdapter::getDataSources | ( | ) |
Definition at line 630 of file gateway.adapter.php.
GatewayAdapter::getDataTransformers | ( | ) |
FIXME: Not convinced we need this.
Definition at line 446 of file gateway.adapter.php.
References $data_transformers.
GatewayAdapter::getDonationRules | ( | ) |
Add donation rules for the users country & currency combo.
Implements GatewayType.
Definition at line 1341 of file gateway.adapter.php.
|
static |
Return an array of all the currently enabled gateways.
Definition at line 1802 of file gateway.adapter.php.
GatewayAdapter::getErrorMap | ( | $code, | |
$options = [] ) |
getErrorMap
This will also return an error message if a $code is passed.
If the error code does not exist, the default message will be returned.
A default message should always exist with an index of 0.
NOTE: This method will check to see if the message exists in translation and use that message instead of the default. This would override error_map.
string | $code | The error code to look up in the map |
array | $options |
Definition at line 679 of file gateway.adapter.php.
References getGlobal(), and getIdentifier().
Referenced by GlobalCollectAdapter\checkDoBankValidation(), and getErrorMapByCodeAndTranslate().
GatewayAdapter::getErrorMapByCodeAndTranslate | ( | $code | ) |
getErrorMapByCodeAndTranslate
This will take an error code and translate the message.
string | $code | The error code to look up in the map |
Definition at line 724 of file gateway.adapter.php.
References getErrorMap().
Referenced by do_transaction_internal().
GatewayAdapter::getErrorState | ( | ) |
Return any errors that prevent this transaction from continuing.
Definition at line 2379 of file gateway.adapter.php.
|
protected |
Definition at line 3941 of file gateway.adapter.php.
Referenced by do_transaction().
GatewayAdapter::getFinalStatus | ( | ) |
If it has been set: returns the final payment status in the $final_status member variable.This is the one we care about for switching on overall behavior. Otherwise, returns false.
Implements GatewayType.
Definition at line 2210 of file gateway.adapter.php.
Referenced by IngenicoAdapter\do_transaction(), AmazonAdapter\doPayment(), AstroPayAdapter\doPayment(), GlobalCollectAdapter\doPayment(), PaypalExpressAdapter\doPayment(), GlobalCollectAdapter\processDonorReturn(), IngenicoAdapter\processDonorReturn(), PaypalExpressAdapter\processDonorReturn(), and GlobalCollectAdapter\transactionDirect_Debit().
|
protected |
Take the entire response string, and strip everything we don't care about.
For instance: If it's XML, we only want correctly-formatted XML. Headers must be killed off.
string | $rawResponse | hot off the curl |
InvalidArgumentException | |
LogicException |
Definition at line 1671 of file gateway.adapter.php.
Referenced by do_transaction_internal().
GatewayAdapter::getFormFields | ( | $knownData = null | ) |
Build list of form fields TODO: Determine if this ever needs to be overridden per gateway, or if all the per-country / per-gateway cases can be expressed declaratively in payment method / submethod metadata.
If that's the case, move this function (to DataValidator?)
array | null | $knownData | if provided, used to determine fields that depend on country or payment method. Falls back to unstaged data. |
Reimplemented in AdyenCheckoutAdapter.
Definition at line 2587 of file gateway.adapter.php.
References Subdivisions\getByCountry().
GatewayAdapter::getGatewayAdapterClass | ( | ) |
Definition at line 2371 of file gateway.adapter.php.
|
static |
Gets the name of the payment processor, e.g.
Adyen
Implements GatewayType.
Definition at line 1776 of file gateway.adapter.php.
Referenced by getTransactionRequestStructure(), getTransactionSpecificValue(), and setCurrentTransaction().
|
static |
This function is important.
All the globals in Donation Interface should be accessed in this manner if they are meant to have a default value, but can be overridden by any of the gateways. It will check to see if a gateway-specific global exists, and if one is not set, it will pull the default from the wgDonationInterface definitions. Through this function, it is no longer necessary to define gateway-specific globals in LocalSettings unless you wish to override the default value for all gateways. If the variable exists in {prefix}AccountInfo[currentAccountName], that value will override the default settings.
string | $varname | The global value we're looking for. It will first look for a global named for the instantiated gateway's GLOBAL_PREFIX, plus the $varname value. If that doesn't come up with anything that has been set, it will use the default value for all of donation interface, stored in $wgDonationInterface . $varname. |
Implements GatewayType.
Definition at line 634 of file gateway.adapter.php.
References getGlobalPrefix().
Referenced by AmazonAdapter\callPwaClient(), AmazonAdapter\defineErrorMap(), do_transaction(), findAccount(), GlobalCollectAdapter\getAVSResult(), getCurlBaseOpts(), GlobalCollectAdapter\getCVVResult(), getErrorMap(), getProcessorUrl(), PaypalExpressAdapter\getProcessorUrl(), localizeGlobal(), CountryValidation\lookUpCountry(), and GlobalCollectAdapter\processResponse().
|
static |
Definition at line 1781 of file gateway.adapter.php.
Referenced by getGlobal().
|
static |
Get a general purpose identifier for this processor, e.g.
paypal
Implements GatewayType.
Definition at line 1786 of file gateway.adapter.php.
Referenced by getErrorMap().
GatewayAdapter::getLogDebugJSON | ( | ) |
Returns some useful debugging JSON we can append to loglines for increased debugging happiness.
This is working pretty well for debugging GatewayChooser problems, so let's use it other places. Still, this should probably still be used sparingly...
Definition at line 3802 of file gateway.adapter.php.
Referenced by GlobalCollectAdapter\processResponse().
|
static |
Get a tag to use to identify this adapter in logs, e.g.
amazon_gateway
Implements GatewayType.
Definition at line 1791 of file gateway.adapter.php.
GatewayAdapter::getLogMessagePrefix | ( | ) |
Get the log message prefix: $contribution_tracking_id .
':' . $order_id . ' '
Now, going to the DonationData object to handle this, because it will always have less stale data (and we need messages to come out of there before data exists here)
Implements LogPrefixProvider.
Definition at line 478 of file gateway.adapter.php.
GatewayAdapter::getMerchantID | ( | ) |
For places that might need the merchant ID outside of the adapter.
Definition at line 3049 of file gateway.adapter.php.
GatewayAdapter::getMonthlyConvertAmounts | ( | ) |
Add the suggested monthly donation amounts for each donation level according to the currency saved in session for this donation attempt.
For currencies that are neither in the config nor these fallback rules, we leave the variable unset here and the JavaScript just redirects the donor to the Thank You page. Defaults include rules for USD, GBP, and JPY
Definition at line 3983 of file gateway.adapter.php.
GatewayAdapter::getOrderIDMeta | ( | $key = false | ) |
Returns information about how to manage the Order ID, either a specific value or the whole associative array.
string | false | $key | The key to retrieve. Optional. |
Implements GatewayType.
Definition at line 3700 of file gateway.adapter.php.
Referenced by GlobalCollectAdapter\parseResponseData().
GatewayAdapter::getPaymentMethod | ( | ) |
Get the payment method.
Definition at line 1298 of file gateway.adapter.php.
References getData_Unstaged_Escaped().
Referenced by AdyenCheckoutAdapter\doPayment(), and GlobalCollectAdapter\doPayment().
GatewayAdapter::getPaymentMethodMeta | ( | $payment_method = null | ) |
Get metadata for the specified payment method as set in.
string | null | $payment_method | Defaults to the current method |
OutOfBoundsException |
Implements GatewayType.
Definition at line 3727 of file gateway.adapter.php.
Referenced by GlobalCollectAdapter\parseResponseData().
GatewayAdapter::getPaymentMethods | ( | ) |
Define payment methods.
Not all payment methods are available within an adapter
Definition at line 1310 of file gateway.adapter.php.
References $payment_methods.
GatewayAdapter::getPaymentSubmethod | ( | ) |
Get the name of the currently selected payment submethod.
Implements GatewayType.
Definition at line 1314 of file gateway.adapter.php.
References getData_Unstaged_Escaped().
Referenced by GlobalCollectAdapter\doPayment().
GatewayAdapter::getPaymentSubmethodMeta | ( | $payment_submethod = null | ) |
Get metadata for the specified payment submethod.
string | null | $payment_submethod | Defaults to the current submethod |
OutOfBoundsException |
Implements GatewayType.
Definition at line 3740 of file gateway.adapter.php.
GatewayAdapter::getPaymentSubmethods | ( | ) |
Get the entire list of payment submethod definitions.
Not all payment submethods are available within an adapter
Implements GatewayType.
Definition at line 1318 of file gateway.adapter.php.
References $payment_submethods.
|
protected |
Return the base URL to use for the current transaction.
Some adapters will append a path component and query parameters. That variation should be handled by the request controller. Customize things like varying server endpoints by overriding this function.
Reimplemented in PaypalExpressAdapter.
Definition at line 366 of file gateway.adapter.php.
References getGlobal().
Referenced by getCurlBaseOpts().
|
protected |
Definition at line 1949 of file gateway.adapter.php.
References DonationData\getContactFields().
|
protected |
Collect donation details and normalize keys for pending or donations queue.
Definition at line 1964 of file gateway.adapter.php.
References DonationData\getMessageFields(), and Amount\round().
Referenced by AmazonAdapter\addDonorDetails().
GatewayAdapter::getRequestProcessId | ( | $requestValues | ) |
Gateways which return true from isReturnProcessingRequired must override this with logic to get an ID from the request which will identify repeated attempts to process the same payment.
array | $requestValues |
Reimplemented in IngenicoAdapter, and PaypalExpressAdapter.
Definition at line 1563 of file gateway.adapter.php.
GatewayAdapter::getRequiredFields | ( | $knownData = null | ) |
null | $knownData |
Reimplemented in AdyenCheckoutAdapter.
Definition at line 2665 of file gateway.adapter.php.
GatewayAdapter::getResponseType | ( | ) |
Default response type to be the same as communication type.
Implements GatewayType.
Reimplemented in AstroPayAdapter, IngenicoAdapter, and PaypalExpressAdapter.
Definition at line 204 of file gateway.adapter.php.
References GatewayType\getCommunicationType().
GatewayAdapter::getScoreCountryMap | ( | ) |
This custom filter function checks the global variable:
CountryMap
How the score is tabulated:
Definition at line 2847 of file gateway.adapter.php.
GatewayAdapter::getScoreEmailDomainMap | ( | ) |
This custom filter function checks the global variable:
EmailDomainMap
How the score is tabulated:
Definition at line 2886 of file gateway.adapter.php.
GatewayAdapter::getScoreName | ( | ) |
This custom filter function checks the global variable: wgDonationInterfaceNameFilterRules Each entry in that array has keys KeyMapA, KeyMapB: define keyboard zones GibberishWeight: threshold fraction of name letters in a single zone Score: added to the total fraud score when this threshold is exceeded.
How the score is tabulated:
Definition at line 2824 of file gateway.adapter.php.
GatewayAdapter::getScoreUtmCampaignMap | ( | ) |
This custom filter function checks the global variable:
UtmCampaignMap
How the score is tabulated:
Definition at line 2929 of file gateway.adapter.php.
GatewayAdapter::getScoreUtmMediumMap | ( | ) |
This custom filter function checks the global variable:
UtmMediumMap
How the score is tabulated:
Definition at line 2972 of file gateway.adapter.php.
GatewayAdapter::getScoreUtmSourceMap | ( | ) |
This custom filter function checks the global variable:
UtmSourceMap
How the score is tabulated:
Definition at line 3014 of file gateway.adapter.php.
References $source.
GatewayAdapter::getTransactionData | ( | ) |
Returns the FORMATTED data harvested from the reply, or false if it is not set.
Definition at line 2364 of file gateway.adapter.php.
Referenced by GlobalCollectAdapter\getTransactionDataFormAction(), GlobalCollectAdapter\transactionConfirm_CreditCard(), GlobalCollectAdapter\transactionDirect_Debit(), and GlobalCollectAdapter\transactionRecurring_Charge().
GatewayAdapter::getTransactionMessage | ( | ) |
|
protected |
Returns the current transaction request structure if it exists, otherwise returns false.
Fails nicely if the current transaction is simply not set yet.
LogicException | if the transaction is set, but no structure is defined. |
Definition at line 796 of file gateway.adapter.php.
References getCurrentTransaction(), and getGatewayName().
Referenced by buildRequestArray(), and buildRequestXML().
GatewayAdapter::getTransactionResponse | ( | ) |
Returns the response object with the details of the latest transaction, or null if the adapter has not yet performed one.
Implements GatewayType.
Definition at line 2191 of file gateway.adapter.php.
Referenced by PaypalExpressAdapter\processDonorReturn().
GatewayAdapter::getTransactionSpecificValue | ( | $gateway_field_name | ) |
This function is used exclusively by the two functions that build requests to be sent directly to external payment gateway servers.
Those two functions are buildRequestNameValueString, and (perhaps less obviously) buildRequestXML. As such, unless a valid current transaction has already been set, this will error out rather hard. In other words: In all likelihood, this is not the function you're looking for.
string | $gateway_field_name | The GATEWAY's field name that we are hoping to populate. Probably not even remotely the way we name the same data internally. |
LogicException |
Definition at line 742 of file gateway.adapter.php.
References getCurrentTransaction(), getData_Staged(), getGatewayName(), and trimFieldToConstraints().
Referenced by appendNodeIfValue().
GatewayAdapter::getTransactionStatus | ( | ) |
Returns the transaction communication status, or false if not set present.
Definition at line 2200 of file gateway.adapter.php.
Referenced by GlobalCollectAdapter\parseResponseData().
GatewayAdapter::getValidationAction | ( | ) |
Returns the current validation action.
This will typically get set and altered by the fraud filters.
Implements GatewayType.
Definition at line 2566 of file gateway.adapter.php.
Referenced by do_transaction_internal(), AdyenCheckoutAdapter\doPayment(), AstroPayAdapter\doPayment(), PaypalExpressAdapter\processResponse(), and GlobalCollectAdapter\transactionConfirm_CreditCard().
|
protected |
Adds one to the 'numAttempt' field we use to keep track of how many times a donor has attempted a payment, in a session.
When they first show up (or get their token/session reset), it should be set to '0'.
Definition at line 2389 of file gateway.adapter.php.
|
protected |
Some payment gateways require a distinct identifier for each API call or for each new payment attempt, even if retrying an attempt that failed validation.
This is slightly different from numAttempt, which is only incremented when setting a final status for a payment attempt. It is the child class's responsibility to increment this at the appropriate time.
Definition at line 2413 of file gateway.adapter.php.
Referenced by IngenicoAdapter\do_transaction(), AmazonAdapter\doPayment(), and AstroPayAdapter\processNewInvoiceResponse().
GatewayAdapter::isBatchProcessor | ( | ) |
Lets the outside world (particularly filters that accumulate points scores) know if we are a batch processor.
Implements GatewayType.
Definition at line 2573 of file gateway.adapter.php.
Referenced by do_transaction_internal(), PaypalExpressAdapter\processDonorReturn(), PaypalExpressAdapter\processResponse(), and GlobalCollectAdapter\transactionConfirm_CreditCard().
|
protected |
Check if currency is in the list for $wgDonationInterfaceMonthlyConvertCountries.
Definition at line 3969 of file gateway.adapter.php.
GatewayAdapter::isReturnProcessingRequired | ( | ) |
Whether donation processing depends on additional processing on-wiki at the donor's return from a payment processor.
This is used to determine whether we should show fail pages on session timeouts.
Reimplemented in PaypalExpressAdapter.
Definition at line 1551 of file gateway.adapter.php.
GatewayAdapter::loadConfig | ( | $variant = null | ) |
Definition at line 341 of file gateway.adapter.php.
References ConfigurationReader\createForGateway().
Referenced by __construct().
GatewayAdapter::localizeGlobal | ( | $varname | ) |
Gets a global variable according to.
string | $varname | Name of setting to retrieve |
Definition at line 654 of file gateway.adapter.php.
References getData_Unstaged_Escaped(), and getGlobal().
Referenced by AmazonAdapter\defineErrorMap(), and AstroPayAdapter\processNewInvoiceResponse().
|
protected |
Definition at line 3829 of file gateway.adapter.php.
GatewayAdapter::logFinalStatus | ( | $status | ) |
Easily-child-overridable log component of setting the final transaction status, which will only ever be set at the very end of a transaction workflow.
string | $status | one of the constants defined in |
Definition at line 2285 of file gateway.adapter.php.
References $keys.
|
protected |
Definition at line 3823 of file gateway.adapter.php.
Referenced by AdyenCheckoutAdapter\doPayment().
GatewayAdapter::logPending | ( | ) |
Dump info about a transaction in logs and pending queues before sending the donor off to complete it.
Implements GatewayType.
Definition at line 1536 of file gateway.adapter.php.
GatewayAdapter::normalizeOrderID | ( | $override = null, | |
$dataObj = null ) |
This function is meant to be run by the DonationData class, both before and after any communication has been done that might retrieve an order ID.
To put it another way: If we are meant to be getting the OrderID from a piece of gateway communication that hasn't been done yet, this should return NULL. I think.
string | null | $override | The pre-determined value of order_id. When you want to normalize an order_id to something you have already sorted out (anything running in batch mode is a good candidate - you have probably grabbed a preexisting order_id from some external data source in that case), short-circuit the hunting process and just take the override's word for order_id's final value. Also used when receiving the order_id from external sources (example: An API response) |
DonationData | null | $dataObj | Reference to the donation data object when we're creating the order ID in the constructor of the object (and thus do not yet have a reference to it.) |
Definition at line 3582 of file gateway.adapter.php.
References $source.
Referenced by GlobalCollectAdapter\parseResponseData().
|
protected |
Check the response for general sanity - e.g.
correct data format, keys exists
mixed | $response | Whatever came back from the API call |
Reimplemented in GlobalCollectAdapter, and IngenicoAdapter.
Definition at line 1638 of file gateway.adapter.php.
|
protected |
Harvest the data we need back from the gateway.
mixed | $response | Whatever came back from the API call |
Reimplemented in GlobalCollectAdapter, and IngenicoAdapter.
Definition at line 1658 of file gateway.adapter.php.
|
protected |
Parse the response to get the errors in a format we can log and otherwise deal with.
mixed | $response | Whatever came back from the API call |
Reimplemented in GlobalCollectAdapter, IngenicoAdapter, and PaypalExpressAdapter.
Definition at line 1649 of file gateway.adapter.php.
|
protected |
Runs all the post-process logic that has been enabled and configured in donationdata.php and/or LocalSettings.php, including the queue message.
This function is most likely to be called through executeFunctionIfExists, later on in do_transaction.
Definition at line 2457 of file gateway.adapter.php.
References Gateway_Extras_ConversionLog\onPostProcess(), and Gateway_Extras_CustomFilters_IP_Velocity\onPostProcess().
Referenced by AmazonAdapter\authorizeAndCapturePayment(), GlobalCollectAdapter\finalizeCreditCardPayment(), AstroPayAdapter\processDonorReturn(), and PaypalExpressAdapter\processResponse().
GatewayAdapter::processDonorReturn | ( | $requestValues | ) |
Default implementation sets status to complete.
array | $requestValues | all GET and POST values from the request |
Implements GatewayType.
Reimplemented in AdyenCheckoutAdapter, AstroPayAdapter, GlobalCollectAdapter, IngenicoAdapter, and PaypalExpressAdapter.
Definition at line 1588 of file gateway.adapter.php.
References PaymentResult\newSuccess().
|
protected |
Process the API response obtained from the payment processor and set properties of transaction_response.
Default implementation just says we got a response.
array | DomDocument | $response | Cleaned-up response returned from |
ResponseProcessingException | with an actionable error code and any variables to retry |
TODO: Move response parsing to a separate class.
Reimplemented in AstroPayAdapter, GlobalCollectAdapter, and PaypalExpressAdapter.
Definition at line 1579 of file gateway.adapter.php.
Referenced by do_transaction_internal().
|
protected |
NOTE: Adyen Checkout has it's own pushMessage that does not push recurring iDEALs to the donations queue.
string | $queue | What queue to send the message to |
bool | $contactOnly | If we only have the donor's contact information |
Reimplemented in AdyenCheckoutAdapter.
Definition at line 2477 of file gateway.adapter.php.
References $queue.
GatewayAdapter::rectifyOrphan | ( | ) |
Looks at message to see if it should be rectified Allows exit if the adapter should not rectify the orphan Then tries to see if the orphan can be matched.
Definition at line 3907 of file gateway.adapter.php.
References PaymentResult\newEmpty().
|
protected |
Instead of pulling all the DonationData back through to update one local value, use this.
It updates both staged_data (which is intended to be staged and used just by the gateway) and unstaged_data, which is actually just normalized and sanitized form data as entered by the user. You should restage the data after running this.
Not doing this right now, though, because it's not yet necessary for anything we have at the moment.
string | $val | The field name that we are looking to retrieve from our DonationData object. |
Definition at line 2529 of file gateway.adapter.php.
Referenced by addRequestData(), and checkTokens().
GatewayAdapter::regenerateOrderID | ( | ) |
Definition at line 3662 of file gateway.adapter.php.
References $source.
Referenced by do_transaction().
GatewayAdapter::runAntifraudFilters | ( | ) |
Runs all the fraud filters that have been enabled and configured in donationdata.php and/or LocalSettings.php This function is most likely to be called through executeFunctionIfExists, early on in do_transaction.
Definition at line 2439 of file gateway.adapter.php.
References Gateway_Extras_CustomFilters\onValidate().
Referenced by AstroPayAdapter\doPayment(), GlobalCollectAdapter\post_process_get_orderstatus(), and PaypalExpressAdapter\processResponse().
|
protected |
Definition at line 3835 of file gateway.adapter.php.
References Gateway_Extras_SessionVelocityFilter\onProcessorApiCall().
Referenced by IngenicoAdapter\curl_transaction(), and AdyenCheckoutAdapter\doPayment().
GatewayAdapter::sendFinalStatusMessage | ( | $status | ) |
Build and send a message to the payments-init queue, once the initial workflow is complete.
string | $status | one of the constants in |
Definition at line 2318 of file gateway.adapter.php.
References $keys.
|
protected |
Definition at line 2487 of file gateway.adapter.php.
Referenced by AmazonAdapter\addDonorDetails().
GatewayAdapter::session_addDonorData | ( | ) |
Removes any old donor data from the session, and adds the current set.
This will be used internally every time we call do_transaction.
Definition at line 3113 of file gateway.adapter.php.
References DonationData\getSessionFields().
Referenced by AmazonAdapter\__construct(), do_transaction(), GlobalCollectAdapter\do_transaction(), IngenicoAdapter\do_transaction(), AdyenCheckoutAdapter\doPayment(), and GlobalCollectAdapter\parseResponseData().
GatewayAdapter::session_ensure | ( | ) |
session_ensure Ensure that we have a session set for the current user.
If we do not have a session set for the current user, start the session.
Implements GatewayType.
Definition at line 3053 of file gateway.adapter.php.
GatewayAdapter::session_getData | ( | $key, | |
$subkey = null ) |
Retrieve data from the session if it's set, and null if it's not.
string | $key | The array key to return from the session. |
string | null | $subkey | Optional: The subkey to return from the session. Only really makes sense if $key is an array. |
Definition at line 3064 of file gateway.adapter.php.
Referenced by do_transaction_internal(), GlobalCollectAdapter\processDonorReturn(), AmazonAdapter\setBillingAgreementDetailsIfUnset(), and AmazonAdapter\setOrderReferenceDetailsIfUnset().
GatewayAdapter::session_hasDonorData | ( | ) |
Checks to see if we have donor data in our session.
This can be useful for determining if a user should be at a certain point in the workflow for certain gateways. For example: This is used on the outside of the adapter in resultswitcher pages, to determine if the user is actually in the process of making a credit card transaction.
Definition at line 3085 of file gateway.adapter.php.
GatewayAdapter::session_killAllEverything | ( | ) |
This should kill the session as hard as possible.
It will leave the cookie behind, but everything it could possibly reference will be gone.
Definition at line 3134 of file gateway.adapter.php.
GatewayAdapter::session_resetForNewAttempt | ( | $force = false | ) |
For those times you want to have the user functionally start over without, you know, cutting your entire head off like you do with session_unsetAllData().
bool | $force | Behavior Description: $force = true: Reset for potential totally new payment, but keep numAttempt and other antifraud things (velocity data) around. $force = false: Keep all donor data around unless numAttempt has hit its max, but kill the ctid (in the likely case that it was an honest mistake) |
Definition at line 3165 of file gateway.adapter.php.
|
protected |
Check to see if donor is making a repeated attempt that is incompatible with the previous attempt, such as a gateway changes.
Reset certain things if so. Prevents order_id leakage, log spam, and recur problems. FIXME: this all has to be special cases because we need to compare session values with request values that are normalized by DonationData, and DonationData's idea of normalization includes some stuff we don't want to do yet, like assigning order ID and saving contribution tracking.
Definition at line 3232 of file gateway.adapter.php.
Referenced by __construct().
GatewayAdapter::session_setDonorBackupData | ( | array | $donorData | ) |
Saves a backup of the Donor Data in session.
array | $donorData |
Definition at line 3094 of file gateway.adapter.php.
GatewayAdapter::session_unsetAllData | ( | ) |
Destroys the session completely.
...including session velocity data, and the form stack. So, you probably just shouldn't. Please consider session_reset instead. Please. Note: This will leave the cookie behind! It just won't go to anything at all. FIXME: This is silly and redundant and should probably be killed.
Definition at line 3149 of file gateway.adapter.php.
GatewayAdapter::session_unsetDonorData | ( | ) |
Unsets the session data, in the case that we've saved it for gateways like GlobalCollect that require it to persist over here through their iframe experience.
Definition at line 3103 of file gateway.adapter.php.
GatewayAdapter::setCurrentTransaction | ( | $transaction_name | ) |
Sets the transaction you are about to send to the payment gateway.
This will throw an exception if you try to set it to something that has no transaction definition.
string | $transaction_name | This is a specific transaction type like 'INSERT_ORDERWITHPAYMENT' (if you're GlobalCollect) that maps to a first-level key in the $transactions array. |
UnexpectedValueException |
Definition at line 1272 of file gateway.adapter.php.
References getGatewayName().
Referenced by do_transaction(), AdyenCheckoutAdapter\doPayment(), and AstroPayAdapter\processDonorReturn().
|
protected |
Called in the constructor, this function should be used to define pieces of default data particular to the gateway.
It will be up to the child class to poke the data through to the data object (probably with $this->addRequestData()). DO NOT set default payment informati on here (or anywhere, really). That would be naughty.
array | $options | associative array of values as given to the GateWayType constructor. |
Reimplemented in GlobalCollectAdapter, IngenicoAdapter, and PaypalExpressAdapter.
Definition at line 1333 of file gateway.adapter.php.
Referenced by __construct().
GatewayAdapter::setHash | ( | $hashval | ) |
Set a value used to determine whether data has changed.
string | $hashval |
Implements GatewayType.
Definition at line 2425 of file gateway.adapter.php.
GatewayAdapter::setOrderIDMeta | ( | $key, | |
$value ) |
sets more orderID Meta, so we can remember things about what we chose to go with in later logic.
string | $key | The key to set. |
mixed | $value | The value to set. |
Definition at line 3723 of file gateway.adapter.php.
GatewayAdapter::setRiskScore | ( | $score | ) |
Set the adapter's fraud score.
float | $score |
Implements GatewayType.
Definition at line 2540 of file gateway.adapter.php.
GatewayAdapter::setValidationAction | ( | $action, | |
$reset = false ) |
Sets the current validation action.
This is meant to be used by the fraud filters, and as such, by default, only worse news than was already being stored will be retained for the final result.
string | $action | the value you want to set as the action. |
bool | $reset | set to true to do a hard set on the action value. Otherwise, the status will only change if it fails harder than it already was. |
UnexpectedValueException |
Implements GatewayType.
Definition at line 2544 of file gateway.adapter.php.
Referenced by do_transaction_internal().
GatewayAdapter::shouldRectifyOrphan | ( | ) |
Allows adapters to specify logic as to whether an orphan can be rectified.
Reimplemented in IngenicoAdapter, and PaypalExpressAdapter.
Definition at line 3889 of file gateway.adapter.php.
GatewayAdapter::showMonthlyConvert | ( | ) |
Implements GatewayType.
Definition at line 4010 of file gateway.adapter.php.
Referenced by AdyenCheckoutAdapter\doPayment(), and IngenicoAdapter\tuneForRecurring().
|
protected |
Run any staging DataTransformers configured for the adapter.
Reimplemented in GlobalCollectAdapter.
Definition at line 2097 of file gateway.adapter.php.
Referenced by __construct(), addRequestData(), do_transaction(), and PaypalExpressAdapter\doPayment().
|
protected |
Definition at line 1713 of file gateway.adapter.php.
|
staticprotected |
token_applyMD5AndSalt Takes a clear-text token, and returns the MD5'd result of the token plus the configured gateway salt.
string | $clear_token | The original, unsalted, unencoded edit token. |
Definition at line 3303 of file gateway.adapter.php.
|
protected |
token_checkTokens The main function to check the salted and MD5'd token we should have saved and gathered from the request, against the clear-text token we should have saved to the user's session.
token_getSaltedSessionToken() will start off the process if this is a first load, and there's no saved token in the session yet.
Definition at line 3393 of file gateway.adapter.php.
Referenced by checkTokens().
|
static |
token_generateToken Generate a random string to be used as an edit token.
string | $padding | A string with which we could pad out the random hex further. |
Definition at line 3321 of file gateway.adapter.php.
GatewayAdapter::token_getSaltedSessionToken | ( | ) |
Establish an 'edit' token to help prevent CSRF, etc.
We use this in place of User::editToken() b/c currently User::editToken() is broken (apparently by design) for anonymous users. Using User::editToken() currently exposes a security risk for non-authenticated users. Until this is resolved, we'll use our own methods for token handling.
Public so the api can get to it.
Implements GatewayType.
Definition at line 3326 of file gateway.adapter.php.
|
protected |
token_matchEditToken Determine the validity of a token by checking it against the salted version of the clear-text token we have already stored in the session.
On failure, it resets the edit token both in the session and in the form, so they will match on the user's next load.
string | $val |
Definition at line 3368 of file gateway.adapter.php.
|
protected |
token_refreshAllTokenEverything In the case where we have an expired session (token mismatch), we go ahead and fix it for 'em for their next post.
We do this by refreshing everything that has to do with the edit token.
Definition at line 3348 of file gateway.adapter.php.
|
protected |
If there are things about a transaction that we need to stash in the transaction's definition (defined in a local defineTransactions() ), we can recall them here.
Currently, this is only being used to determine if we have a transaction whose transmission would require multiple attempts to wait for a certain status (or set of statuses), but we could do more with this mechanism if we need to.
string | $option_value | the name of the key we're looking for in the transaction definition. |
Definition at line 2504 of file gateway.adapter.php.
Referenced by getCurlBaseOpts(), AstroPayAdapter\getResponseType(), and GlobalCollectAdapter\processResponse().
|
protected |
Trims a single field according to length constraints in data_constraints.yaml.
mixed | $value | |
string | $field | the name of the field specified in data_constraints |
Definition at line 2146 of file gateway.adapter.php.
Referenced by getTransactionSpecificValue().
GatewayAdapter::unsetHash | ( | ) |
Clear the data hash value.
Implements GatewayType.
Definition at line 2429 of file gateway.adapter.php.
|
protected |
Run any unstaging functions to decode processor responses.
Definition at line 2115 of file gateway.adapter.php.
Referenced by addResponseData().
GatewayAdapter::unstageKeys | ( | $processor_data, | |
$key_map = null ) |
Change the keys on this data from processor API names to normalized names.
array | $processor_data | Response data with raw API keys |
array | null | $key_map | map processor keys to our keys, defaults to $this->var_map |
TODO: Figure out why this isn't the default behavior in addResponseData. Once that's resolved, we might operate on member fields rather than do this as a function.
Definition at line 602 of file gateway.adapter.php.
References $staged_data, and $var_map.
Referenced by GlobalCollectAdapter\processResponse(), and PaypalExpressAdapter\processResponse().
GatewayAdapter::validate | ( | ) |
Check donation data for validity and set errors.
This function will go through all the data we have pulled from wherever we've pulled it, and make sure it's safe and expected and everything. If it is not, it will return an array of errors ready for any DonationInterface form class derivative to display.
Definition at line 2684 of file gateway.adapter.php.
References DataValidator\validate().
Referenced by __construct(), and do_transaction().
|
protected |
Validates that the gateway-specific data constraints for this field have been met.
string | $field | The field name we're checking |
mixed | $value | The candidate value of the field we want to check |
Definition at line 3525 of file gateway.adapter.php.
References $type.
GatewayAdapter::validatedOK | ( | ) |
Definition at line 2723 of file gateway.adapter.php.
Referenced by do_transaction().
|
protected |
Definition at line 1814 of file gateway.adapter.php.
Referenced by GlobalCollectAdapter\parseResponseData().
|
protected |
Definition at line 87 of file gateway.adapter.php.
Referenced by AstroPayAdapter\defineAccountInfo().
|
protected |
Definition at line 86 of file gateway.adapter.php.
Referenced by findAccount().
|
protected |
Definition at line 88 of file gateway.adapter.php.
|
protected |
Definition at line 170 of file gateway.adapter.php.
|
protected |
Definition at line 182 of file gateway.adapter.php.
|
protected |
|
protected |
Name of the current transaction.
Set via
Definition at line 168 of file gateway.adapter.php.
Referenced by getCurrentTransaction().
|
protected |
Data transformation helpers.
These implement the StagingHelper interface for now, and are responsible for staging and unstaging data.
Definition at line 115 of file gateway.adapter.php.
Referenced by getDataTransformers().
|
protected |
$dataConstraints provides information on how to handle variables.
<code> 'account_holder' => [ 'type' => 'alphanumeric', 'length' => 50, ] </code>
Definition at line 59 of file gateway.adapter.php.
|
protected |
Definition at line 128 of file gateway.adapter.php.
Referenced by AmazonAdapter\generateOrderID(), and GlobalCollectAdapter\generateOrderID().
string [] GatewayAdapter::$debugarray |
Definition at line 174 of file gateway.adapter.php.
|
protected |
$error_map Reference map from gateway error to client error.
The key of each error should map to a i18n message key or a callable By convention, the following three keys have these meanings: 'internal-0000' => 'message-key-1', // Failed failed pre-process checks. 'internal-0001' => 'message-key-2', // Transaction could not be processed due to an internal error. 'internal-0002' => 'message-key-3', // Communication failure A callable should return the translated error message. Any undefined key will map to 'donate_interface-processing-error' When formatted, each message key will be given the ProblemEmail global as a first parameter. Error messages that use other parameters should use the callable.
Definition at line 77 of file gateway.adapter.php.
|
protected |
List of errors preventing this transaction from continuing.
Definition at line 162 of file gateway.adapter.php.
|
protected |
When the smoke clears, this should be set to one of the constants defined in.
Definition at line 158 of file gateway.adapter.php.
Referenced by GlobalCollectAdapter\doRefund().
bool GatewayAdapter::$log_outbound = false |
This should be set to true for gateways that don't return the request in the response.
Definition at line 195 of file gateway.adapter.php.
|
protected |
Standard logger, logs to {type}_gateway.
Definition at line 134 of file gateway.adapter.php.
|
protected |
Definition at line 197 of file gateway.adapter.php.
|
protected |
Definition at line 198 of file gateway.adapter.php.
|
protected |
Logs to {type}_gateway_payment_init.
Definition at line 140 of file gateway.adapter.php.
|
protected |
$payment_methods will be defined by the adapter.
Definition at line 96 of file gateway.adapter.php.
Referenced by getPaymentMethods().
|
protected |
$payment_submethods will be defined by the adapter (or will default to an empty array if none are defined).
Definition at line 104 of file gateway.adapter.php.
Referenced by getPaymentSubmethods().
bool GatewayAdapter::$posted = false |
A boolean that will tell us if we've posted to ourselves.
A little more telling than WebRequest->wasPosted(), as something else could have posted to us.
Definition at line 181 of file gateway.adapter.php.
|
protected |
Times and logs various operations.
Definition at line 146 of file gateway.adapter.php.
|
protected |
Definition at line 106 of file gateway.adapter.php.
|
protected |
Definition at line 172 of file gateway.adapter.php.
|
protected |
Definition at line 107 of file gateway.adapter.php.
Referenced by getData_Staged(), and unstageKeys().
|
protected |
$transaction_response is the member var that keeps track of the results of the latest discrete transaction with the gateway.
Definition at line 153 of file gateway.adapter.php.
Referenced by do_transaction_internal().
|
protected |
Definition at line 89 of file gateway.adapter.php.
|
protected |
Definition at line 108 of file gateway.adapter.php.
Referenced by __construct(), addResponseData(), do_transaction(), and getData_Unstaged_Escaped().
|
protected |
$var_map maps gateway variables to client variables
Definition at line 84 of file gateway.adapter.php.
Referenced by unstageKeys().
|
protected |
For gateways that speak XML, we use this variable to hold the document while we build the outgoing request.
TODO: move XML functions out of the main gateway classes.
Definition at line 123 of file gateway.adapter.php.
const GatewayAdapter::COMPLETED_PREFACE = 'Completed donation: ' |
Definition at line 42 of file gateway.adapter.php.
const GatewayAdapter::DONOR = 'Donor' |
Definition at line 188 of file gateway.adapter.php.
Referenced by RecurringConversionApi\restoreDonorSessionFromBackup().
const GatewayAdapter::DONOR_BKUP = 'Donor_BKUP' |
Definition at line 189 of file gateway.adapter.php.
Referenced by RecurringConversionApi\restoreDonorSessionFromBackup().
const GatewayAdapter::GATEWAY_NAME = 'Donation Gateway' |
Definition at line 185 of file gateway.adapter.php.
const GatewayAdapter::GLOBAL_PREFIX = 'wgDonationGateway' |
Definition at line 187 of file gateway.adapter.php.
const GatewayAdapter::IDENTIFIER = 'donation' |
Definition at line 186 of file gateway.adapter.php.
const GatewayAdapter::REDIRECT_PREFACE = 'Redirecting for transaction: ' |
Don't change these strings without fixing cross-repo usages.
Definition at line 41 of file gateway.adapter.php.