MediaWiki fundraising/REL1_35
|
Public Member Functions | |
__construct ( $options=[]) | |
Constructor. | |
doPayment () | |
Note that the Amazon adapter is somewhat unique in that it uses a third party SDK to make all processor API calls. | |
generateOrderID ( $dataObj=null) | |
Replace decimal point with a dash to comply with Amazon's restrictions on seller reference ID format. | |
getAvailableSubmethods () | |
Override default behavior. | |
getCommunicationType () | |
Data format for outgoing requests to the processor. | |
handleErrors ( $exception, $resultData) | |
FIXME: this synthesized 'TransactionResponse' is increasingly silly Maybe make this adapter more normal by adding an 'SDK' communication type that just creates an array of $data, then overriding curl_transaction to use the PwaClient. | |
Public Member Functions inherited from GatewayAdapter | |
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. | |
getAccountConfig ( $key) | |
Get globals-based configuration setting. | |
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 Attributes | |
const | GATEWAY_NAME = 'Amazon' |
const | GLOBAL_PREFIX = 'wgAmazonGateway' |
const | IDENTIFIER = 'amazon' |
Public Attributes inherited from GatewayAdapter | |
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 | |
addDonorDetails ( $donorDetails) | |
authorizeAndCapturePayment ( $recurring=false) | |
Once the order reference or billing agreement is finalized, we can authorize a payment against it and capture the funds. | |
authorizeOnBillingAgreement () | |
authorizeOnOrderReference () | |
callPwaClient ( $functionName, $parameters) | |
Wraps calls to Amazon SDK client with timing and error handling. | |
confirmBillingAgreement () | |
confirmOrderReference () | |
Amazon's widget has made calls to create an order reference object and has provided us the ID. | |
defineAccountInfo () | |
defineAccountInfo needs to set up the $accountInfo array. | |
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. | |
getPwaClient () | |
Gets a Pay with Amazon client or facsimile thereof. | |
setBillingAgreementDetailsIfUnset ( $billingAgreementId) | |
setOrderReferenceDetailsIfUnset ( $orderReferenceId) | |
Set the order reference details if they haven't been set yet. | |
Protected Member Functions inherited from GatewayAdapter | |
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. | |
defineDataConstraints () | |
TODO: see comment on definePaymentMethods. | |
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 | checkErrors ( $response) |
Static Protected Member Functions inherited from GatewayAdapter | |
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 | |
string[] | $capture_status_map |
FIXME: return_value_map should handle non-numeric return values. | |
PwaClientInterface | $client |
$pending_reasons | |
string[] | $retry_reasons |
When an authorization or capture is declined, some reason codes indicate a situation where the donor can retry later or try a different card. | |
Protected Attributes inherited from GatewayAdapter | |
$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. | |
Additional Inherited Members | |
Static Public Member Functions inherited from GatewayAdapter | |
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. | |
Wikimedia Foundation.
LICENSE
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Uses Login and Pay with Amazon widgets and a fork of the associated SDK to charge donors.
See https://payments.amazon.com/documentation and https://github.com/ejegg/login-and-pay-with-amazon-sdk-php
Definition at line 34 of file amazon.adapter.php.
AmazonAdapter::__construct | ( | $options = [] | ) |
Constructor.
array | $options | OPTIONAL - You may set options for testing
|
Reimplemented from GatewayAdapter.
Definition at line 72 of file amazon.adapter.php.
References GatewayAdapter\addRequestData(), GatewayAdapter\getData_Unstaged_Escaped(), and GatewayAdapter\session_addDonorData().
|
protected |
Definition at line 202 of file amazon.adapter.php.
References GatewayAdapter\addRequestData(), GatewayAdapter\getQueueDonationMessage(), and GatewayAdapter\sendPendingMessage().
Referenced by confirmBillingAgreement(), and confirmOrderReference().
|
protected |
Once the order reference or billing agreement is finalized, we can authorize a payment against it and capture the funds.
We combine both steps in a single authorize call. If the authorization is successful, we can check on the capture status. TODO: determine if capture status check is really needed. According to our tech contact, Amazon guarantees that the capture will eventually succeed if the authorization succeeds.
bool | $recurring | whether the payment is recurring |
ResponseProcessingException |
Definition at line 224 of file amazon.adapter.php.
References GatewayAdapter\addResponseData(), authorizeOnBillingAgreement(), authorizeOnOrderReference(), callPwaClient(), GatewayAdapter\finalizeInternalStatus(), and GatewayAdapter\postProcessDonation().
Referenced by doPayment().
|
protected |
Definition at line 364 of file amazon.adapter.php.
References callPwaClient(), and GatewayAdapter\getData_Staged().
Referenced by authorizeAndCapturePayment().
|
protected |
Definition at line 310 of file amazon.adapter.php.
References callPwaClient(), and GatewayAdapter\getData_Staged().
Referenced by authorizeAndCapturePayment().
|
protected |
Wraps calls to Amazon SDK client with timing and error handling.
Yes, dynamic calls are slower, but these are all web service calls in the first place.
string | $functionName | |
array | $parameters |
ResponseProcessingException | on call failure or error code |
Definition at line 180 of file amazon.adapter.php.
References $client, checkErrors(), and GatewayAdapter\getGlobal().
Referenced by authorizeAndCapturePayment(), authorizeOnBillingAgreement(), authorizeOnOrderReference(), confirmBillingAgreement(), confirmOrderReference(), setBillingAgreementDetailsIfUnset(), and setOrderReferenceDetailsIfUnset().
|
staticprotected |
ResponseProcessingException | if response contains an error |
array | $response |
Definition at line 396 of file amazon.adapter.php.
Referenced by callPwaClient().
|
protected |
Definition at line 330 of file amazon.adapter.php.
References addDonorDetails(), callPwaClient(), GatewayAdapter\getData_Staged(), and setBillingAgreementDetailsIfUnset().
Referenced by doPayment().
|
protected |
Amazon's widget has made calls to create an order reference object and has provided us the ID.
We make one API call to set amount, currency, and our note and local reference ID. A second call confirms that the details are valid and moves it out of draft state. Once it is out of draft state, we can retrieve the donor's name and email address with a third API call.
Definition at line 266 of file amazon.adapter.php.
References addDonorDetails(), callPwaClient(), GatewayAdapter\getData_Staged(), and setOrderReferenceDetailsIfUnset().
Referenced by doPayment().
|
protected |
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 from GatewayAdapter.
Definition at line 96 of file amazon.adapter.php.
|
protected |
Define the message keys used to display errors to the user.
Should set
Reimplemented from GatewayAdapter.
Definition at line 111 of file amazon.adapter.php.
References GatewayAdapter\getGlobal(), and GatewayAdapter\localizeGlobal().
|
protected |
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 from GatewayAdapter.
Definition at line 104 of file amazon.adapter.php.
|
protected |
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 from GatewayAdapter.
Definition at line 101 of file amazon.adapter.php.
|
protected |
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 from GatewayAdapter.
Definition at line 126 of file amazon.adapter.php.
AmazonAdapter::doPayment | ( | ) |
Note that the Amazon adapter is somewhat unique in that it uses a third party SDK to make all processor API calls.
Since we're never calling do_transaction and friends, we synthesize a PaymentTransactionResponse to hold any errors returned from the SDK.
Implements GatewayType.
Definition at line 137 of file amazon.adapter.php.
References authorizeAndCapturePayment(), confirmBillingAgreement(), confirmOrderReference(), GatewayAdapter\ensureUniqueOrderID(), PaymentResult\fromResults(), GatewayAdapter\getData_Unstaged_Escaped(), GatewayAdapter\getFinalStatus(), getPwaClient(), handleErrors(), and GatewayAdapter\incrementSequenceNumber().
AmazonAdapter::generateOrderID | ( | $dataObj = null | ) |
Replace decimal point with a dash to comply with Amazon's restrictions on seller reference ID format.
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 from GatewayAdapter.
Definition at line 387 of file amazon.adapter.php.
References GatewayAdapter\$dataObj.
AmazonAdapter::getAvailableSubmethods | ( | ) |
Override default behavior.
Reimplemented from GatewayAdapter.
Definition at line 409 of file amazon.adapter.php.
AmazonAdapter::getCommunicationType | ( | ) |
Data format for outgoing requests to the processor.
Must be one of 'xml', 'namevalue' (for POST), or 'redirect'. May depend on current transaction.
Implements GatewayType.
Definition at line 92 of file amazon.adapter.php.
|
protected |
Gets a Pay with Amazon client or facsimile thereof.
Definition at line 167 of file amazon.adapter.php.
Referenced by doPayment().
AmazonAdapter::handleErrors | ( | $exception, | |
$resultData ) |
FIXME: this synthesized 'TransactionResponse' is increasingly silly Maybe make this adapter more normal by adding an 'SDK' communication type that just creates an array of $data, then overriding curl_transaction to use the PwaClient.
ResponseProcessingException | $exception | |
PaymentTransactionResponse | $resultData |
Definition at line 421 of file amazon.adapter.php.
References GatewayAdapter\finalizeInternalStatus().
Referenced by doPayment().
|
protected |
Definition at line 349 of file amazon.adapter.php.
References callPwaClient(), GatewayAdapter\getData_Staged(), and GatewayAdapter\session_getData().
Referenced by confirmBillingAgreement().
|
protected |
Set the order reference details if they haven't been set yet.
Track which ones have been set in session.
string | $orderReferenceId |
Definition at line 293 of file amazon.adapter.php.
References callPwaClient(), GatewayAdapter\getData_Staged(), and GatewayAdapter\session_getData().
Referenced by confirmOrderReference().
|
protected |
FIXME: return_value_map should handle non-numeric return values.
Definition at line 49 of file amazon.adapter.php.
|
protected |
Definition at line 43 of file amazon.adapter.php.
Referenced by callPwaClient().
|
protected |
Definition at line 68 of file amazon.adapter.php.
|
protected |
When an authorization or capture is declined, some reason codes indicate a situation where the donor can retry later or try a different card.
Definition at line 60 of file amazon.adapter.php.
const AmazonAdapter::GATEWAY_NAME = 'Amazon' |
Definition at line 36 of file amazon.adapter.php.
const AmazonAdapter::GLOBAL_PREFIX = 'wgAmazonGateway' |
Definition at line 38 of file amazon.adapter.php.
const AmazonAdapter::IDENTIFIER = 'amazon' |
Definition at line 37 of file amazon.adapter.php.