Yellowpay
in package
PostFinance online payment
Tags
Table of Contents
Properties
- $arrError : array<string|int, mixed>
- Error messages
- $arrWarning : array<string|int, mixed>
- Warning messages
- $arrFieldMandatory : mixed
- $arrFieldShasignIn : array<string|int, mixed>
- Parameter names used for computing the SHASign IN
- $arrFieldShasignOut : array<string|int, mixed>
- Parameter names used for computing the SHASign OUT
- $arrKnownPaymentMethod : array<string|int, mixed>
- Known payment method names
- $sectionName : string
- section name
Methods
- checkIn() : bool
- Verifies the parameters posted back by e-commerce
- concatenateFields() : string
- Returns a string formed by concatenating all fields
- errorHandler() : mixed
- Handles errors ocurring in this class
- getAcceptedPaymentMethodMenuOptions() : string
- UNUSED (for the time being) -- Returns the HTML menu options for selecting from the currently accepted payment methods.
- getAcceptedPaymentMethodsString() : string
- Returns a string with all currently accepted payment methods.
- getAuthorizationMenuoptions() : string
- Returns HTML code for the authorization menuoptions
- getForm() : string
- Creates and returns the HTML Form for requesting the payment service.
- getOrderId() : int
- Returns the order id from the request, if present
- prependSectionNameToOrderId() : mixed
- Prepend section name to the field "ORDERID".
- setFields() : bool
- Sets the parameters with name/value pairs from the given array
- signature() : string
- Returns the current SHA signature
- verifyParameter() : bool
- Verifies a name/value pair
Properties
$arrError
Error messages
public
static array<string|int, mixed>
$arrError
= array()
Tags
$arrWarning
Warning messages
public
static array<string|int, mixed>
$arrWarning
= array()
Tags
$arrFieldMandatory
private
static mixed
$arrFieldMandatory
= array(
'PSPID',
'ORDERID',
'AMOUNT',
'CURRENCY',
// Not mandatory, but needed for SHA-1 anyway
'OPERATION',
// The following parameters are not mandatory, but we're being nice to customers
'LANGUAGE',
// post payment redirection: see chapter 8.2
'ACCEPTURL',
'DECLINEURL',
'EXCEPTIONURL',
'CANCELURL',
// needed for payment redirection
'PARAMPLUS',
)
$arrFieldShasignIn
Parameter names used for computing the SHASign IN
private
static array<string|int, mixed>
$arrFieldShasignIn
= array('ACCEPTANCE', 'ACCEPTURL', 'ADDMATCH', 'ADDRMATCH', 'AIAGIATA', 'AIAIRNAME', 'AIAIRTAX', 'AIBOOKIND*XX*', 'AICARRIER*XX*', 'AICHDET', 'AICLASS*XX*', 'AICONJTI', 'AIDEPTCODE', 'AIDESTCITY*XX*', 'AIDESTCITYL*XX*', 'AIEXTRAPASNAME*XX*', 'AIEYCD', 'AIFLDATE*XX*', 'AIFLNUM*XX*', 'AIGLNUM', 'AIINVOICE', 'AIIRST', 'AIORCITY*XX*', 'AIORCITYL*XX*', 'AIPASNAME', 'AIPROJNUM', 'AISTOPOV*XX*', 'AITIDATE', 'AITINUM', 'AITINUML*XX*', 'AITYPCH', 'AIVATAMNT', 'AIVATAPPL', 'ALIAS', 'ALIASOPERATION', 'ALIASUSAGE', 'ALLOWCORRECTION', 'AMOUNT', 'AMOUNT*XX*', 'AMOUNTHTVA', 'AMOUNTTVA', 'BACKURL', 'BATCHID', 'BGCOLOR', 'BLVERNUM', 'BRAND', 'BRANDVISUAL', 'BUTTONBGCOLOR', 'BUTTONTXTCOLOR', 'CANCELURL', 'CARDNO', 'CATALOGURL', 'CAVV_3D', 'CAVVALGORITHM_3D', 'CERTID', 'CHECK_AAV', 'CIVILITY', 'CN', 'COM', 'COMPLUS', 'COSTCENTER', 'COSTCODE', 'CREDITCODE', 'CUID', 'CURRENCY', 'CVC', 'CVCFLAG', 'DATA', 'DATATYPE', 'DATEIN', 'DATEOUT', 'DECLINEURL', 'DEVICE', 'DISCOUNTRATE', 'DISPLAYMODE', 'ECI', 'ECI_3D', 'ECOM_BILLTO_POSTAL_CITY', 'ECOM_BILLTO_POSTAL_COUNTRYCODE', 'ECOM_BILLTO_POSTAL_NAME_FIRST', 'ECOM_BILLTO_POSTAL_NAME_LAST', 'ECOM_BILLTO_POSTAL_POSTALCODE', 'ECOM_BILLTO_POSTAL_STREET_LINE1', 'ECOM_BILLTO_POSTAL_STREET_LINE2', 'ECOM_BILLTO_POSTAL_STREET_NUMBER', 'ECOM_CONSUMERID', 'ECOM_CONSUMER_GENDER', 'ECOM_CONSUMEROGID', 'ECOM_CONSUMERORDERID', 'ECOM_CONSUMERUSERALIAS', 'ECOM_CONSUMERUSERPWD', 'ECOM_CONSUMERUSERID', 'ECOM_PAYMENT_CARD_EXPDATE_MONTH', 'ECOM_PAYMENT_CARD_EXPDATE_YEAR', 'ECOM_PAYMENT_CARD_NAME', 'ECOM_PAYMENT_CARD_VERIFICATION', 'ECOM_SHIPTO_COMPANY', 'ECOM_SHIPTO_DOB', 'ECOM_SHIPTO_ONLINE_EMAIL', 'ECOM_SHIPTO_POSTAL_CITY', 'ECOM_SHIPTO_POSTAL_COUNTRYCODE', 'ECOM_SHIPTO_POSTAL_NAME_FIRST', 'ECOM_SHIPTO_POSTAL_NAME_LAST', 'ECOM_SHIPTO_POSTAL_NAME_PREFIX', 'ECOM_SHIPTO_POSTAL_POSTALCODE', 'ECOM_SHIPTO_POSTAL_STREET_LINE1', 'ECOM_SHIPTO_POSTAL_STREET_LINE2', 'ECOM_SHIPTO_POSTAL_STREET_NUMBER', 'ECOM_SHIPTO_TELECOM_FAX_NUMBER', 'ECOM_SHIPTO_TELECOM_PHONE_NUMBER', 'ECOM_SHIPTO_TVA', 'ED', 'EMAIL', 'EXCEPTIONURL', 'EXCLPMLIST', 'EXECUTIONDATE*XX*', 'FACEXCL*XX*', 'FACTOTAL*XX*', 'FIRSTCALL', 'FLAG3D', 'FONTTYPE', 'FORCECODE1', 'FORCECODE2', 'FORCECODEHASH', 'FORCEPROCESS', 'FORCETP', 'GENERIC_BL', 'GIROPAY_ACCOUNT_NUMBER', 'GIROPAY_BLZ', 'GIROPAY_OWNER_NAME', 'GLOBORDERID', 'GUID', 'HDFONTTYPE', 'HDTBLBGCOLOR', 'HDTBLTXTCOLOR', 'HEIGHTFRAME', 'HOMEURL', 'HTTP_ACCEPT', 'HTTP_USER_AGENT', 'INCLUDE_BIN', 'INCLUDE_COUNTRIES', 'INVDATE', 'INVDISCOUNT', 'INVLEVEL', 'INVORDERID', 'ISSUERID', 'IST_MOBILE', 'ITEM_COUNT', 'ITEMATTRIBUTES*XX*', 'ITEMCATEGORY*XX*', 'ITEMCOMMENTS*XX*', 'ITEMDESC*XX*', 'ITEMDISCOUNT*XX*', 'ITEMID*XX*', 'ITEMNAME*XX*', 'ITEMPRICE*XX*', 'ITEMQUANT*XX*', 'ITEMUNITOFMEASURE*XX*', 'ITEMVAT*XX*', 'ITEMVATCODE*XX*', 'ITEMWEIGHT*XX*', 'LANGUAGE', 'LEVEL1AUTHCPC', 'LIDEXCL*XX*', 'LIMITCLIENTSCRIPTUSAGE', 'LINE_REF', 'LINE_REF1', 'LINE_REF2', 'LINE_REF3', 'LINE_REF4', 'LINE_REF5', 'LINE_REF6', 'LIST_BIN', 'LIST_COUNTRIES', 'LOGO', 'MAXITEMQUANT*XX*', 'MERCHANTID', 'MODE', 'MTIME', 'MVER', 'NETAMOUNT', 'OPERATION', 'ORDERID', 'ORDERSHIPCOST', 'ORDERSHIPTAX', 'ORDERSHIPTAXCODE', 'ORIG', 'OR_INVORDERID', 'OR_ORDERID', 'OWNERADDRESS', 'OWNERADDRESS2', 'OWNERCTY', 'OWNERTELNO', 'OWNERTOWN', 'OWNERZIP', 'PAIDAMOUNT', 'PARAMPLUS', 'PARAMVAR', 'PAYID', 'PAYMETHOD', 'PM', 'PMLIST', 'PMLISTPMLISTTYPE', 'PMLISTTYPE', 'PMLISTTYPEPMLIST', 'PMTYPE', 'POPUP', 'POST', 'PSPID', 'PSWD', 'REF', 'REFER', 'REFID', 'REFKIND', 'REF_CUSTOMERID', 'REF_CUSTOMERREF', 'REGISTRED', 'REMOTE_ADDR', 'REQGENFIELDS', 'RTIMEOUT', 'RTIMEOUTREQUESTEDTIMEOUT', 'SCORINGCLIENT', 'SETT_BATCH', 'SID', 'STATUS_3D', 'SUBSCRIPTION_ID', 'SUB_AM', 'SUB_AMOUNT', 'SUB_COM', 'SUB_COMMENT', 'SUB_CUR', 'SUB_ENDDATE', 'SUB_ORDERID', 'SUB_PERIOD_MOMENT', 'SUB_PERIOD_MOMENT_M', 'SUB_PERIOD_MOMENT_WW', 'SUB_PERIOD_NUMBER', 'SUB_PERIOD_NUMBER_D', 'SUB_PERIOD_NUMBER_M', 'SUB_PERIOD_NUMBER_WW', 'SUB_PERIOD_UNIT', 'SUB_STARTDATE', 'SUB_STATUS', 'TAAL', 'TAXINCLUDED*XX*', 'TBLBGCOLOR', 'TBLTXTCOLOR', 'TID', 'TITLE', 'TOTALAMOUNT', 'TP', 'TRACK2', 'TXTBADDR2', 'TXTCOLOR', 'TXTOKEN', 'TXTOKENTXTOKENPAYPAL', 'TYPE_COUNTRY', 'UCAF_AUTHENTICATION_DATA', 'UCAF_PAYMENT_CARD_CVC2', 'UCAF_PAYMENT_CARD_EXPDATE_MONTH', 'UCAF_PAYMENT_CARD_EXPDATE_YEAR', 'UCAF_PAYMENT_CARD_NUMBER', 'USERID', 'USERTYPE', 'VERSION', 'WBTU_MSISDN', 'WBTU_ORDERID', 'WEIGHTUNIT', 'WIN3DS', 'WITHROOT')
$arrFieldShasignOut
Parameter names used for computing the SHASign OUT
private
static array<string|int, mixed>
$arrFieldShasignOut
= array('AAVADDRESS', 'AAVCHECK', 'AAVZIP', 'ACCEPTANCE', 'ALIAS', 'AMOUNT', 'BIN', 'BRAND', 'CARDNO', 'CCCTY', 'CN', 'COMPLUS', 'CREATION_STATUS', 'CURRENCY', 'CVCCHECK', 'DCC_COMMPERCENTAGE', 'DCC_CONVAMOUNT', 'DCC_CONVCCY', 'DCC_EXCHRATE', 'DCC_EXCHRATESOURCE', 'DCC_EXCHRATETS', 'DCC_INDICATOR', 'DCC_MARGINPERCENTAGE', 'DCC_VALIDHOURS', 'DIGESTCARDNO', 'ECI', 'ED', 'ENCCARDNO', 'IP', 'IPCTY', 'NBREMAILUSAGE', 'NBRIPUSAGE', 'NBRIPUSAGE_ALLTX', 'NBRUSAGE', 'NCERROR', 'ORDERID', 'PAYID', 'PM', 'SCO_CATEGORY', 'SCORING', 'STATUS', 'SUBBRAND', 'SUBSCRIPTION_ID', 'TRXDATE', 'VC')
$arrKnownPaymentMethod
Known payment method names
private
static array<string|int, mixed>
$arrKnownPaymentMethod
= array(1 => 'PostFinanceCard', 2 => 'yellownet', 3 => 'Master', 4 => 'Visa', 5 => 'Amex', 6 => 'Diners')
Note that these correspond to the names used for dynamically choosing the payment methods using the txtPM_*_Status" parameters and must thus be spelt exactly as specified.
Tags
$sectionName
section name
private
static string
$sectionName
= \null
Tags
Methods
checkIn()
Verifies the parameters posted back by e-commerce
public
static checkIn(string $passphrase) : bool
Parameters
- $passphrase : string
-
The SHA-OUT passphrase
Return values
bool —True on success, false otherwise
concatenateFields()
Returns a string formed by concatenating all fields
public
static concatenateFields(array<string|int, mixed> $fields, string $passphrase[, bool $out = false ]) : string
Name/value pairs are separated by an equals sign, and individual pairs separated by the passphrase (in or out). Mind that according to the new specification, all field names must be all uppercase, thus the array is reindexed using uppercase only keys before it is sorted and concatenated.
Parameters
- $fields : array<string|int, mixed>
-
The parameter array
- $passphrase : string
-
The passphrase
- $out : bool = false
-
Create the OUT signature if true. Defaults to false (IN)
Tags
Return values
string —The signature string on success, null otherwise
errorHandler()
Handles errors ocurring in this class
public
static errorHandler() : mixed
Applies to the section (module) SettingsDb has been initialized with. In particular, tries to add missing Settings using the defaults. However, you will have to set them to their correct values after this. Note that you MUST call \Cx\Core\Setting\Controller\Setting::init() using the proper section and group parameters beforehand. Otherwise, no settings will be added.
getAcceptedPaymentMethodMenuOptions()
UNUSED (for the time being) -- Returns the HTML menu options for selecting from the currently accepted payment methods.
public
static getAcceptedPaymentMethodMenuOptions(string $indices[, int $selected = null ]) : string
The functionality had been in use in the egov module only, where it has become obsolete.
Parameters
- $indices : string
-
The comma separated list of payment type indices
- $selected : int = null
-
The optional preselected payment type index
Return values
string —The HTML menu options
getAcceptedPaymentMethodsString()
Returns a string with all currently accepted payment methods.
public
static getAcceptedPaymentMethodsString(string $indices) : string
This string is ready to be used in the PMLIST field of the payment form.
Parameters
- $indices : string
-
The comma separated list of payment type indices
Return values
string —The payment type string
getAuthorizationMenuoptions()
Returns HTML code for the authorization menuoptions
public
static getAuthorizationMenuoptions(string $authorization) : string
Parameters
- $authorization : string
-
The selected authorization method
Tags
Return values
string —The HTML menuoptions
getForm()
Creates and returns the HTML Form for requesting the payment service.
public
static getForm(array<string|int, mixed> $arrFields[, string $submitValue = 'Send' ][, bool $autopost = false ][, array<string|int, mixed> $arrSettings = null ][, object $landingPage = null ]) : string
The parameters in $uriparam are appended to the base index URI. If empty, this defaults to "section=Shop&cmd=success".
Parameters
- $arrFields : array<string|int, mixed>
-
The parameter array
- $submitValue : string = 'Send'
-
The optional label for the submit button
- $autopost : bool = false
-
If true, the form is automatically submitted. Defaults to false.
- $arrSettings : array<string|int, mixed> = null
-
Settings from \Cx\Core\Setting
- $landingPage : object = null
-
The optional URI parameter string
Tags
Return values
string —The HTML form code
getOrderId()
Returns the order id from the request, if present
public
static getOrderId() : int
Return values
int —The order id, or false
prependSectionNameToOrderId()
Prepend section name to the field "ORDERID".
public
static prependSectionNameToOrderId([array<string|int, mixed> &$arrField = null ]) : mixed
This is needed to avoid id conflicts (since multiple modules use the same Yellowpay account).
Parameters
- $arrField : array<string|int, mixed> = null
-
The parameter array, by reference
setFields()
Sets the parameters with name/value pairs from the given array
public
static setFields([array<string|int, mixed> &$arrField = null ]) : bool
If $arrField is missing mandatory fields, or contains invalid values, this method fails and returns false.
Parameters
- $arrField : array<string|int, mixed> = null
-
The parameter array, by reference
Return values
bool —True on success, false otherwise
signature()
Returns the current SHA signature
public
static signature(array<string|int, mixed> $fields, string $passphrase[, bool $out = false ]) : string
Concatenates the values of all fields, separating them with the secret passphrase (in or out).
Parameters
- $fields : array<string|int, mixed>
-
The parameter array
- $passphrase : string
-
The passphrase
- $out : bool = false
-
Create the OUT signature if true. Defaults to false (IN)
Return values
string —The signature hash on success, null otherwise
verifyParameter()
Verifies a name/value pair
public
static verifyParameter(string $name, string $value) : bool
May change the value before returning it. Use the value returned when adding to the form in any case.
Parameters
- $name : string
-
The name of the parameter
- $value : string
-
The value of the parameter
Tags
Return values
bool —The verified value on success, null otherwise