PaymillELVHandler
extends PaymillHandler
in package
PostFinance online payment
Tags
Table of Contents
Properties
- $arrError : array<string|int, mixed>
- Error messages
- $arrWarning : array<string|int, mixed>
- Warning messages
- $paymillJsBridge : string
- Paymill JS Bridge url
- $sectionName : string
- section name
- $formScript : mixed
Methods
- closeElement() : mixed
- fieldset() : mixed
- getElement() : mixed
- getForm() : string
- Creates and returns the HTML Form for requesting the payment service.
- getFormattedAttrbs() : mixed
- openElement() : mixed
- processRequest() : mixed
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
$paymillJsBridge
Paymill JS Bridge url
public
static string
$paymillJsBridge
= "https://bridge.paymill.com"
$sectionName
section name
public
static string
$sectionName
= \null
Tags
$formScript
private
static mixed
$formScript
= <<<FORMTEMPLATE
\$J(document).ready(function() {
\$J("#payment-form").submit(function (event) {
\$J('.submit-button').attr("disabled", "disabled");
if ("" === \$J('.elv-holdername').val()) {
logResponse(cx.variables.get('invalid-card-holder', 'shop'));
\$J(".submit-button").removeAttr("disabled");
return false;
}
if (false == paymill.validateAccountNumber(\$J('.elv-account').val())) {
logResponse(cx.variables.get('invalid-account-number', 'shop'));
\$J(".submit-button").removeAttr("disabled");
return false;
}
if (false == paymill.validateBankCode(\$J('.elv-bankcode').val())) {
logResponse(cx.variables.get('invalid-bank-code', 'shop'));
\$J(".submit-button").removeAttr("disabled");
return false;
}
var params = {
number: \$J('.elv-account').val(),
bank: \$J('.elv-bankcode').val(),
accountholder: \$J('.elv-holdername').val()
};
paymill.createToken(params, PaymillResponseHandler);
return false;
});
});
function PaymillResponseHandler(error, result) {
if (error) {
// display any error occurs
logResponse(error.apierror);
\$J(".submit-button").removeAttr("disabled");
} else {
//logResponse(result.token);
var form = \$J("#payment-form");
// Token
var token = result.token;
// Insert token into form in order to submit to server
form.append("<input type='hidden' name='paymillToken' value='" + token + "'/>");
form.get(0).submit();
}
\$J(".submit-button").removeAttr("disabled");
}
function logResponse(res) {
/*
// create console.log to avoid errors in old IE browsers
if (!window.console) console = {log:function(){}};
console.log(res);
if(PAYMILL_TEST_MODE)
\$J('.debug').text(res).show().fadeOut(8000);
*/
\$J('.paymill-error-text').text(res).show().fadeOut(8000);
}
FORMTEMPLATE
Methods
closeElement()
public
static closeElement(mixed $elm) : mixed
Parameters
- $elm : mixed
fieldset()
public
static fieldset([mixed $legend = false ][, mixed $selfClose = false ]) : mixed
Parameters
- $legend : mixed = false
- $selfClose : mixed = false
getElement()
public
static getElement(mixed $elm[, mixed $attrbs = '' ][, mixed $content = '' ]) : mixed
Parameters
- $elm : mixed
- $attrbs : mixed = ''
- $content : mixed = ''
getForm()
Creates and returns the HTML Form for requesting the payment service.
public
static getForm(mixed $arrOrder[, mixed $landingPage = null ]) : string
Parameters
- $arrOrder : mixed
- $landingPage : mixed = null
Tags
Return values
string —The HTML form code
getFormattedAttrbs()
public
static getFormattedAttrbs(mixed $attributes) : mixed
Parameters
- $attributes : mixed
openElement()
public
static openElement(mixed $elm[, mixed $attributes = '' ]) : mixed
Parameters
- $elm : mixed
- $attributes : mixed = ''
processRequest()
public
static processRequest(mixed $token, mixed $arrOrder) : mixed
Parameters
- $token : mixed
- $arrOrder : mixed