Documentation

Datatrans
in package

Datatrans PSP Interface

Tags
author

Reto Kohli reto.kohli@comvation.com

copyright

CLOUDREXX CMS - CLOUDREXX AG

subpackage

module_shop

version
3.0.0

Table of Contents

Properties

$arrErrorcode  : array<string|int, mixed>
Error codes
$arrFieldMandatory  : array<string|int, mixed>
Mandatory fields
$arrFieldOptional  : array<string|int, mixed>
Optional fields
$arrFieldReturn  : array<string|int, mixed>
Return fields
$arrLangId  : array<string|int, mixed>
Codes of supported languages
$arrPaymentmethod  : array<string|int, mixed>
Payment methods
$useTestserver  : bool
Use test server URI if true

Methods

getGatewayUri()  : mixed
getHtml()  : string
Generates the HTML code containing all available parameters with respective values in hidden input fields
getOrderId()  : string
Returns the returned order ID, if any
getPaymentResult()  : int
Returns a numeric value representing the outcome of the payment process
getReqtypeMenuoptions()  : mixed
initialize()  : bool
Set up the mandatory parameters
setCancelurl()  : mixed
setCvv()  : mixed
Set the CVC/CVV Note: This is currently not supported by this class.
setErrorurl()  : mixed
setHiddenmode()  : mixed
Enables hîdden mode if called.
setLanguage()  : mixed
Set the language to be used for the payment
setReqtype()  : mixed
Set the request type
setSign()  : mixed
Set the additional security identifier.
setSuccessurl()  : mixed
setTestonly()  : mixed
Enable test mode if called
setUppcustomercity()  : mixed
setUppcustomercountry()  : mixed
setUppcustomerdetails()  : mixed
Enable sending of customer details if called.
setUppcustomeremail()  : mixed
setUppcustomerfax()  : mixed
setUppcustomerfirstname()  : mixed
setUppcustomerlastname()  : mixed
setUppcustomername()  : mixed
setUppcustomerphone()  : mixed
setUppcustomerstreet()  : mixed
setUppcustomerstreet2()  : mixed
setUppcustomertitle()  : mixed
setUppcustomerzipcode()  : mixed
setUsealias()  : mixed
Request the credit card alias if called
validateReturn()  : bool
Validates the parameters returned after a payment has been completed

Properties

$arrErrorcode

Error codes

private static array<string|int, mixed> $arrErrorcode = array(1001 => 'Missing required parameter', 1002 => 'Not valid parameter format', 1003 => 'Value of parameter not found', 1004 => 'Invalid card number', 1007 => 'Access denied by sign control / parameter "sign" invalid', 1008 => 'Merchant disabled by Datatrans', 1201 => 'System error', 1400 => 'Invalid card number', 1401 => 'Invalid expiration date', 1402 => 'Expired card', 1403 => 'Transaction declined by card issuer', 1404 => 'Card blocked', 1405 => 'Amount exceeded', 3000 => 'Denied by fraud management', 3001 => 'IP address declined by global fraud management', 3002 => 'IP address declined by merchant fraud management', 3003 => 'CC number declined by global fraud management', 3004 => 'CC number declined by merchant fraud management', 3005 => 'Denied by fraud management', 3006 => 'Denied by fraud management', 3011 => 'Denied by fraud management', 3012 => 'Denied by fraud management', 3013 => 'Denied by fraud management', 3014 => 'Denied by fraud management', 3015 => 'Denied by fraud management', 3016 => 'Denied by fraud management', 3031 => 'Declined due to response code 02', 3041 => 'Declined due to post error / post URL check failed', 10412 => 'PayPal duplicate error', -885 => 'CC-alias update error', -886 => 'CC-alias insert error', -887 => 'CC-alias does not match with cardno', -888 => 'CC-alias not found', -900 => 'CC-alias service not enabled', -999 => 'Undefined error')
Tags
access

private

$arrFieldMandatory

Mandatory fields

private static array<string|int, mixed> $arrFieldMandatory = array('merchantId' => \false, 'amount' => \false, 'currency' => \false, 'refno' => \false)
Tags
access

private

$arrFieldOptional

Optional fields

private static array<string|int, mixed> $arrFieldOptional = array('successUrl' => \false, 'errorUrl' => \false, 'cancelUrl' => \false, 'language' => \false, 'sign' => \false, 'reqtype' => \false, 'hiddenMode' => \false, 'cvv' => \false, 'useAlias' => \false, 'testOnly' => \false, 'uppCustomerTitle' => \false, 'uppCustomerName' => \false, 'uppCustomerFirstName' => \false, 'uppCustomerLastName' => \false, 'uppCustomerStreet' => \false, 'uppCustomerStreet2' => \false, 'uppCustomerCity' => \false, 'uppCustomerCountry' => \false, 'uppCustomerZipCode' => \false, 'uppCustomerPhone' => \false, 'uppCustomerFax' => \false, 'uppCustomerEmail' => \false, 'uppCustomerDetails' => \false)
Tags
access

private

$arrFieldReturn

Return fields

private static array<string|int, mixed> $arrFieldReturn = array( // Common 'uppTransactionId' => \false, 'refno' => \false, 'amount' => \false, 'currency' => \false, 'status' => \false, 'uppMsgType' => \false, // Success/unsuccessful/failed, but not when cancelled 'pmethod' => \false, 'reqtype' => \false, // Success only 'authorizationCode' => \false, 'responseMessage' => \false, 'acqAuthorizationCode' => \false, // Success only -- optional 'aliasCC' => \false, 'maskedCC' => \false, 'sign2' => \false, // Unsuccessful/failed only 'errorCode' => \false, 'errorMessage' => \false, 'errorDetail' => \false, )
Tags
access

private

$arrLangId

Codes of supported languages

private static array<string|int, mixed> $arrLangId = array('en', 'de', 'fr', 'it', 'es')
Tags
access

private

$arrPaymentmethod

Payment methods

private static array<string|int, mixed> $arrPaymentmethod = array( 'VIS', // VISA 'ECA', // Mastercard 'AMX', // American Express 'DIN', // Diners Club 'POS', // Swiss Post Yellow Account 'CLB', // Swisscom ClickandBuy 'PAP', // PayPal 'MYO', // Manor MyOne Card 'JEL', // Jelmoli Bonus Card 'PSC', // Paysafecard 'ELV', )
Tags
access

public

$useTestserver

Use test server URI if true

private static bool $useTestserver = \false

Methods

getHtml()

Generates the HTML code containing all available parameters with respective values in hidden input fields

public static getHtml() : string

Note: The form tag is not included in the result, nor is the submit button.

Return values
string

The HTML code on success, the empty string otherwise

getOrderId()

Returns the returned order ID, if any

public static getOrderId() : string

The order ID is taken from the array created by validateReturn() after a payment has completed. If you call this method before that point, you'll get back false in any case.

Tags
access

public

Return values
string

The order ID if known, false otherwise

getPaymentResult()

Returns a numeric value representing the outcome of the payment process

public static getPaymentResult() : int

The returned value has the same meaning as the result value that is usually set in the request when returning to the shop from other PSPs. This is necessary because Datatrans sends the request to the POST URI even if the payment fails or is cancelled. Note: You must call this only after validateReturn() has set up the array with all request parameters!

Return values
int

The payment result value

getReqtypeMenuoptions()

public static getReqtypeMenuoptions(mixed $datatrans_request_type) : mixed
Parameters
$datatrans_request_type : mixed

initialize()

Set up the mandatory parameters

public static initialize(int $merchantId, string $refno, string $amount, string $currency) : bool
Parameters
$merchantId : int

The Datatrans merchant ID

$refno : string

The unique merchant reference number, aka order ID

$amount : string

The amount, in cents

$currency : string

The three letter currency code

Return values
bool

True on success, false otherwise

setCancelurl()

public static setCancelurl(mixed $cancelUrl) : mixed
Parameters
$cancelUrl : mixed

setCvv()

Set the CVC/CVV Note: This is currently not supported by this class.

public static setCvv(string $cvv) : mixed
Parameters
$cvv : string

The CVC or CVV

setErrorurl()

public static setErrorurl(mixed $errorUrl) : mixed
Parameters
$errorUrl : mixed

setHiddenmode()

Enables hîdden mode if called.

public static setHiddenmode() : mixed

Note that this class currently does not support all possible payment methods in hidden mode. This is only implemented to enable German ELV for the time being.

setLanguage()

Set the language to be used for the payment

public static setLanguage(mixed $language) : mixed

Currently supported:

  • de (German)
  • en (English)
  • fr (French)
  • it (Italian)
  • es (Spanish) If any other value is specified, this method sets the default language, German.
Parameters
$language : mixed

setReqtype()

Set the request type

public static setReqtype(mixed $reqtype) : mixed

Specifies whether the transaction has to be immediately settled or authorised only. There are two request types available:

  • NOA: authorisation only
  • CAA: authorisation with immediate settlement in case of successful authorisation If any other value is specified, this method sets the default type, CAA.
Parameters
$reqtype : mixed

setSign()

Set the additional security identifier.

public static setSign(string $sign) : mixed

Note: This is currently not supported by this class.

Parameters
$sign : string

The identifier

setSuccessurl()

public static setSuccessurl(mixed $successUrl) : mixed
Parameters
$successUrl : mixed

setTestonly()

Enable test mode if called

public static setTestonly() : mixed

setUppcustomercity()

public static setUppcustomercity(mixed $uppCustomerCity) : mixed
Parameters
$uppCustomerCity : mixed

setUppcustomercountry()

public static setUppcustomercountry(mixed $uppCustomerCountry) : mixed
Parameters
$uppCustomerCountry : mixed

setUppcustomerdetails()

Enable sending of customer details if called.

public static setUppcustomerdetails() : mixed

This is called by all of the setUppcutomer*() methods whenever a valid value is set.

setUppcustomeremail()

public static setUppcustomeremail(mixed $uppCustomerEmail) : mixed
Parameters
$uppCustomerEmail : mixed

setUppcustomerfax()

public static setUppcustomerfax(mixed $uppCustomerFax) : mixed
Parameters
$uppCustomerFax : mixed

setUppcustomerfirstname()

public static setUppcustomerfirstname(mixed $uppCustomerFirstName) : mixed
Parameters
$uppCustomerFirstName : mixed

setUppcustomerlastname()

public static setUppcustomerlastname(mixed $uppCustomerLastName) : mixed
Parameters
$uppCustomerLastName : mixed

setUppcustomername()

public static setUppcustomername(mixed $uppCustomerName) : mixed
Parameters
$uppCustomerName : mixed

setUppcustomerphone()

public static setUppcustomerphone(mixed $uppCustomerPhone) : mixed
Parameters
$uppCustomerPhone : mixed

setUppcustomerstreet()

public static setUppcustomerstreet(mixed $uppCustomerStreet) : mixed
Parameters
$uppCustomerStreet : mixed

setUppcustomerstreet2()

public static setUppcustomerstreet2(mixed $uppCustomerStreet2) : mixed
Parameters
$uppCustomerStreet2 : mixed

setUppcustomertitle()

public static setUppcustomertitle(mixed $uppCustomerTitle) : mixed
Parameters
$uppCustomerTitle : mixed

setUppcustomerzipcode()

public static setUppcustomerzipcode(mixed $uppCustomerZipCode) : mixed
Parameters
$uppCustomerZipCode : mixed

setUsealias()

Request the credit card alias if called

public static setUsealias() : mixed

validateReturn()

Validates the parameters returned after a payment has been completed

public static validateReturn() : bool

Picks the parameters from the post request and stores the values. Note that this method unset()s the elements from the $_POST array. Mind that the result does not reflect the outcome of the payment process, but only whether the returned values are complete and valid.

Return values
bool

True on success, false otherwise


        
On this page

Search results