Module: lib/libPayment

Container for a Payment Requests. Provides Payment Parameters for Redirect or Direct Link requests. Requirements: - Payment Processor of appropriated Payment Method must point to Payment Method ID (prefixed by PAYMENT_PROCESSOR_PREFIX) - Appropiated Credit Card Type must be same as according BRAND (eg. VISA, MasterCard etc.)
Source:

Classes

PaymentCtnr

Methods

(inner) addPriceAdjustments(adjustments, loopstate, oid, result, itemsAmout)

add Price adjustments to Klarna object
Parameters:
Name Type Description
adjustments dw.util.Collection Collection of adjustment objects
loopstate Number Next item index
oid String String with the option product ID associated with the discount
result Object Object with Klarna data
itemsAmout Number calculated product items cost
Source:

(inner) calculateNonGiftCertificateAmount(lineItemCtnr) → {dw.value.Money}

Calculates the amount to be payed by a non-gift certificate payment instrument based on the given basket. The method subtracts the amount of all redeemed gift certificates from the order total and returns this value. PJP-2000: Modified logic to use LineItemCtnr (to support both Basket and Order)
Parameters:
Name Type Description
lineItemCtnr dw.order.LineItemCtnr
Source:
Returns:
amountOpen
Type
dw.value.Money

(inner) checkEcommercePaymentMethods(paymentMethodID) → {String}

Get Payment Processor for Payment Method
Parameters:
Name Type Description
paymentMethodID String
Source:
Returns:
Type
String

(inner) createDeviceFingerprintSessionID(orderNo) → {dw.crypto.MessageDigest}

create Device Fingerprint Session ID
Parameters:
Name Type Description
orderNo String
Source:
Returns:
crypt
Type
dw.crypto.MessageDigest

(inner) createShaForUrls(order) → {String}

Creates the SHA token used to verify the authenticity of the request in the return urls. This token is calculated and added to the return urls and then it is read and compared with a different token calculated internally from the same parameters. Because Ingenico has a limitation of max 200 characters in the return urls, we take only the first 10 digits from the sha token (also for this reason, the pipeline names and payment method names were shortened)
Parameters:
Name Type Description
order dw.order.Order
Source:
Returns:
shaCode
Type
String

(inner) ecommDecline(Order)

Decline order call
Parameters:
Name Type Description
Order dw.order.Order
Source:

(inner) EcommerceCreatePaymentInstrument(lineItemCtnr, paymentType) → {dw.order.PaymentInstrument}

Creates a payment instrument specific for the given payment type (payment method) for the given basket. If any error occurs the pipelet returns PIPELET_ERROR with no payment instrument being created. If the creation succeeded the script returns the newly created payment instrument. If only one payment instrument is allowed, any existing payment instrument may be removed by using the RemoveExisting input parameter and passing a Boolean true.
Parameters:
Name Type Description
lineItemCtnr dw.order.LineItemCtnr
paymentType String
Source:
Returns:
Type
dw.order.PaymentInstrument

(inner) EcommerceVerifyStatus(order) → {String}

Verify status for Order
Parameters:
Name Type Description
order dw.order.Order
Source:
Returns:
status
Type
String

(inner) formatExpiryNumbers(month, year) → {String|null}

format expiry YYMM
Parameters:
Name Type Description
month Number
year number
Source:
Returns:
Type
String | null

(inner) generateSHAEcommerce(order, gender, locale) → {dw.crypto.MessageDigest}

generate SHA for Ecommerce
Parameters:
Name Type Description
order dw.order.Order
gender Number
locale String
Source:
Returns:
shaCode
Type
dw.crypto.MessageDigest

(inner) generateSHAEcommercePaypal(order, gender, locale) → {dw.crypto.MessageDigest}

generate SHA for Ecommerce Paypal
Parameters:
Name Type Description
order dw.order.Order
gender Number
locale String
Source:
Returns:
shaCode
Type
dw.crypto.MessageDigest

(inner) generateSHAKlarnaEcommerce(klData) → {dw.crypto.MessageDigest}

generate SHA for Ecommerce Klarna
Parameters:
Name Type Description
klData Object
Source:
Returns:
shaCode
Type
dw.crypto.MessageDigest

(inner) generateSHAMasterPassEcommerce(order, locale) → {dw.crypto.MessageDigest}

generate SHA for MasterPass Ecommerce
Parameters:
Name Type Description
order dw.order.Order
locale String
Source:
Returns:
shaCode
Type
dw.crypto.MessageDigest

(inner) GetHostedTokenizationURL() → {String}

Get Hosted Tokenization URL
Source:
Returns:
url
Type
String

(inner) getIngenicoConfiguration() → {Object}

Get the configuration information from Ingenico custom object
Source:
Returns:
IngenicoConfiguration
Type
Object

(inner) GetPaymentDirectLinkOrderData(order, locale, payMethID) → {object|String|String|String|String|String|Boolean}

Sends Payment Direct Link Authorization.
Parameters:
Name Type Description
order dw.order.Order
locale String
payMethID String
Source:
Returns:
  • ret
    Type
    object
  • ret.Status
    Type
    String
  • ret.PaymentMethodID
    Type
    String
  • ret.ErrorStatus
    Type
    String
  • ret.PaymentStatus
    Type
    String
  • ret.ResultStatusCheck
    Type
    String
  • ret.success
    Type
    Boolean

(inner) GetPaymentEcommOrderData(order, locale, payMethID) → {object|String|String|String|String|String|Boolean}

Sends Payment Ecommerce Authorization.
Parameters:
Name Type Description
order dw.order.Order
locale String
payMethID String
Source:
Returns:
  • ret
    Type
    object
  • ret.Status
    Type
    String
  • ret.PaymentMethodID
    Type
    String
  • ret.ErrorStatus
    Type
    String
  • ret.PaymentStatus
    Type
    String
  • ret.ResultStatusCheck
    Type
    String
  • ret.success
    Type
    Boolean

(inner) GetPaymentRequestParameters(Order, Request, PaymentMethodID) → {Object|dw.util.HashMap|Boolean}

Get Payment request Parameters
Parameters:
Name Type Description
Order dw.order.Order
Request dw.system.Request
PaymentMethodID String
Source:
Returns:
  • ret
    Type
    Object
  • ret.PaymentRequestParameters
    Type
    dw.util.HashMap
  • ret.success
    Type
    Boolean

(inner) getPaymentStatusDescription(code) → {String}

Return the description of a status code. The code is a number in a string format, e.g. '9'
Parameters:
Name Type Description
code String
Source:
Returns:
Type
String

(inner) getSHASignParameterFromRequest(requestParameters, shaIn, digest, orderID, comparator) → {dw.crypto.MessageDigest}

Get SHASign used for request
Parameters:
Name Type Description
requestParameters dw.util.HashMap
shaIn String
digest dw.crypto.MessageDigest
orderID String
comparator Object
Source:
Returns:
digest
Type
dw.crypto.MessageDigest

(inner) getSHASignParameterFromRequestUtf(requestParameters, shaIn, digest, orderID, comparator) → {dw.crypto.MessageDigest}

Get SHASign used for request
Parameters:
Name Type Description
requestParameters dw.util.HashMap
shaIn String
digest dw.crypto.MessageDigest
orderID String
comparator Object
Source:
Returns:
digest
Type
dw.crypto.MessageDigest

(inner) getURIParametersFromMap(paramMap) → {String}

get URI Parameter from map
Parameters:
Name Type Description
paramMap dw.util.HashMap
Source:
Returns:
query
Type
String

(inner) InvalidatePaymentDirectDebitsFormElements(status, directDebitsForm) → {Boolean}

Invalidates the Direct Debits form element in case specified status is ERROR. If status is undefined or form is invalid the pipelet returns PIPELET_ERROR.
Parameters:
Name Type Description
status dw.system.Status
directDebitsForm dw.web.FormGroup
Source:
Returns:
Type
Boolean

(inner) Is3DSEnabled(order) → {Boolean}

Checks wether 3DS is necessary. When payment_last3DSauthorization on OrderPaymentInstrument exists and is before now 3DS check isn't necessary anymore. Only one 3DS Check per Customer and Credit Card is required.
Parameters:
Name Type Description
order dw.order.Order
Source:
Returns:
Type
Boolean

(inner) KlarnaEcommerceData(paymentMethod, order, customer, locale, useAlias) → {Object}

Returns an object containg all the information required for the request to Klarna, like accept and decline url, cart amount, etc
Parameters:
Name Type Description
paymentMethod String
order dw.order.Order
customer dw.customer.Customer
locale String
useAlias Boolean
Source:
Returns:
result
Type
Object

(inner) MasterpassEcommerceData(order, customer, locale, useAlias) → {Object}

Returns an object containg all the information required for the request to MasterPass, like accept and decline url, cart amount, etc
Parameters:
Name Type Description
order dw.order.Order
customer dw.customer.Custome
locale String
useAlias Boolean
Source:
Returns:
result
Type
Object

(inner) PaymentChangeStatus(order, paramMap, locale) → {Object|String|Boolean}

Change payment status
Parameters:
Name Type Description
order dw.order.Order
paramMap dw.web.HttpParameterMap
locale String
Source:
Returns:
  • ret
    Type
    Object
  • ret.ResultStatusCheck
    Type
    String
  • ret.success
    Type
    Boolean

(inner) paymentSHAValidation(paramMap) → {Boolean}

Validates Payment response and checks if SHAOut and parameters are valid
Parameters:
Name Type Description
paramMap dw.web.HttpParameterMap
Source:
Returns:
Type
Boolean

(inner) savePaypalAlias()

Save Paypal alias information
Source:

(inner) SendDirectDebitsAuthorization(forms, order, locale) → {String|String|String|String|String|String|String|String|Boolean}

Sends Authorization to payment through DirectLink for Direct Debits AT, DE and NL
Parameters:
Name Type Description
forms dw.web.FormGroup
order dw.order.Order
locale String
Source:
Returns:
  • ret.Status
    Type
    String
  • ret.StatusDescription
    Type
    String
  • ret.PaymentMethod
    Type
    String
  • ret.PayID
    Type
    String
  • ret.Brand
    Type
    String
  • ret.PaymentMethodIDOut
    Type
    String
  • ret.ErrorString
    Type
    String
  • ret.ResultStatusCheck
    Type
    String
  • ret.succes
    Type
    Boolean

(inner) SendHostedTokenizationCreditCardAuthorization(order, enable3DS, PaymentMethodID, locale, Customer) → {String|String|String|String|Boolean|String|String|String|String|Boolean}

Sends Authorization to payment through DirectLink for Credit Cards.
Parameters:
Name Type Description
order dw.order.Order
enable3DS Boolean
PaymentMethodID String
locale String
Customer dw.customer.Customer
Source:
Returns:
  • ret.Status
    Type
    String
  • ret.PaymentMethod
    Type
    String
  • ret.PayID
    Type
    String
  • ret.Brand
    Type
    String
  • ret.Enrolled
    Type
    Boolean
  • ret.HTML
    Type
    String
  • ret.PaymentMethodIDOut
    Type
    String
  • ret.ErrorString
    Type
    String
  • ret.ErrorString
    Type
    String
  • ret.succes
    Type
    Boolean

(inner) SendPayPalInfo(order, locale, paramMap) → {object|String|Boolean}

Sends PayPal Ecommerce Informations.
Parameters:
Name Type Description
order dw.order.Order
locale String
paramMap dw.web.HttpParameterMap
Source:
Returns:
  • ret
    Type
    object
  • ret.ErrorStatus
    Type
    String
  • ret.success
    Type
    Boolean

(inner) SetAuthorizedPayment(params) → {Boolean}

Sets two custom attributes for orders, when TwoStep is enabled
Parameters:
Name Type Description
params dw.web.HttpParameterMap
Source:
Returns:
Type
Boolean

(inner) setKlarnaFields(PaymentMethod, Country, CurrentCustomer, Basket)

Set Klarna addition fiels
Parameters:
Name Type Description
PaymentMethod String
Country String
CurrentCustomer dw.customer.Customer
Basket dw.order.Basket
Source:

(inner) toArrayOfStrings(arr) → {dw.util.ArrayList}

convert array elements to string
Parameters:
Name Type Description
arr dw.util.ArrayList
Source:
Returns:
result_arr
Type
dw.util.ArrayList

(inner) VerifyPaymentDirectDebits(form, customer) → {Object|dw.system.Status|String|dw.web.FormGroup|Boolean}

Validate the Direct Debits forms data fields. The script get the PaymentForms object at input, containing all forms data (Direct Debits DE, AT and NL) , validate current form and add output results: - the status of the validation, - the paymentType and - the data of the current form validated.
Parameters:
Name Type Description
form dw.web.FormGroup
customer dw.customer.Customer
Source:
Returns:
  • ret
    Type
    Object
  • ret.DirectDebitsStatus
    Type
    dw.system.Status
  • ret.PaymentType
    Type
    String
  • ret.DirectDebitsForm
    Type
    dw.web.FormGroup
  • ret.success
    Type
    Boolean