Module: TransactPro::RequestSpecs

Defined in:
lib/transact_pro/request_specs.rb

Constant Summary collapse

GUID_REGEX =

have an ASCII hexadecimal value greater than 20, or an EBCDIC hexadecimal value greater than 40.

Occurrences of values ASCII 00 – 1F and EBCDIC 00 – 3F are not valid. Not all special characters are
usually enabled. See fields’ description for details."

u: Unicode alphabetic characters.

%r'\A[[:alnum:]]{4}-[[:alnum:]]{4}-[[:alnum:]]{4}-[[:alnum:]]{4}\z'
PASSWORD_DIGEST_REGEX =
%r'\A.{40}\z'
ROUTING_REGEX =

an(1..12)

%r'\A[[:alnum:]]{1,12}\z'
MERCHANT_TRANSACTION_ID =

ans(5..50)

%r'\A.{5,50}\z'
TID_REGEX =

h(40)

%r'\A[0-9a-f]{40}\z'i
USER_IP =
%r'\A
  (
    ([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.
  ){3}
  ([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])
\z'x
DESCRIPTION =

ns(7..15)

%r'\A.{5,255}\z'
AMOUNT =

n

%r'\A[1-9]\d*\z'
CURRENCY =

a(3)

%r'\A[[:upper:]]{3}\z'
NAME_ON_CARD =

ans(2..100)

%r'\A.{2,100}\z'
STREET =

ans(2..50)

%r'\A.{2,50}\z'
ZIP =

ans(2..15)

%r'\A.{2,15}\z'
CITY =

ans(2..25)

%r'\A.{2,25}\z'
COUNTRY =

a(2)

%r'\A[[:alpha:]]{2}\z'
STATE =

ans(2..20)

%r'\A.{2,20}\z'
EMAIL =

ans(1..100)

%r'\A.{1,100}\z'
PHONE =

ns(5..25)

%r'\A[0-9\-_]{5,25}\z'
CARD_BIN =

n(6)

%r'\A\d{6}\z'
BIN_NAME =

uns(3..50)

%r'\A.{3,50}\z'
BIN_PHONE =

ns(3..25)

%r'\A[0-9\-_]{3,25}\z'
MERCHANT_SITE_URL =

ans(1..255)

%r'\A.{1,255}\z'
MERCHANT_REFERRING_NAME =

ans(1..21)

%r'\A.{1,21}\z'
BACK_URL =

ans(1..255)

%r'\A.{1,255}\z'
F_EXTENDED =

n

%r'\A\d+\z'
INIT_SPEC =
  1. Table

Field Format Description guid ans(19) Your merchant GUID. pwd h(40) SHA1 hash of your processing password. rs an(1..12) Your routing string. merchant_transaction_id ans(5..50) Your transaction ID, must be unique for every transaction you submit to the gateway. The transaction ID must be from 5 to 50 characters. user_ip ns(7..15) Cardholder’s IP, as string (AA.BB.CC.DD). description uns(5..255) Order items description, from 5 to 255 characters (Example: SDHC Memory card x 2, AAA battery pack x 1). amount n Transaction amount, in MINOR units (i.e. 2150 for $21.50 transaction). Notice: check JPY exception notice below! currency a(3) Transaction currency, ISO 4217 3-character code, USD, EUR, CHF etc. name_on_card ans(2..100) Cardholder name, as printed on a card (pass client name if card data collected at gateway side) street ans(2..50) Cardholder address – street. (min 2 symbols) zip ans(2..15) Cardholder address – ZIP. (min 2 symbols) city as(2..25) Cardholder address – City. (min 2 symbols) country a(2) Cardholder address – country, 2-letter ISO 3166-1-Alpha 2 code. state ans(2..20) Cardholder address – state (send NA if you don’t have state information). email ans(1..100) Cardholder address – email phone ns(5..25) Cardholder phone number (min. 5 symbols). card_bin n(6) Cardholder card BIN (first 6 characters of CC number). - not required if card data collected at gateway side. bin_name uns(3..50) Cardholder bank name (non-mandatory). bin_phone ns(3..25) Cardholder bank phone given on a back side of used card (non-mandatory). merchant_site_url ans(1..255) Purchase site URL. merchant_referring_name ans(1..21) Must not be send by default. See chapter 3.5 for description if you need to use it. custom_return_url ans(1..255) Custom return URL custom_callback_url ans(1..255) Custom callback URL

{
  # method: :init
  guid: {mandatory: true, format: GUID_REGEX},
  pwd: {mandatory: true, format: PASSWORD_DIGEST_REGEX},
  rs: {mandatory: true, format: ROUTING_REGEX},
  merchant_transaction_id: {mandatory: true, format: MERCHANT_TRANSACTION_ID},
  user_ip: {mandatory: true, format: USER_IP},
  description: {mandatory: true, format: DESCRIPTION},
  amount: {mandatory: true, format: AMOUNT},
  currency: {mandatory: true, format: CURRENCY},
  name_on_card: {mandatory: true, format: NAME_ON_CARD},
  street: {mandatory: true, format: STREET},
  zip: {mandatory: true, format: ZIP},
  city: {mandatory: true, format: CITY},
  country: {mandatory: true, format: COUNTRY},
  state: {mandatory: true, format: STATE},
  email: {mandatory: true, format: EMAIL},
  phone: {mandatory: true, format: PHONE},
  card_bin: {mandatory: false, format: CARD_BIN},
  bin_name: {mandatory: false, format: BIN_NAME},
  bin_phone: {mandatory: false, format: BIN_PHONE},
  merchant_site_url: {mandatory: true, format: MERCHANT_SITE_URL},
  merchant_referring_name: {mandatory: false, format: MERCHANT_REFERRING_NAME},
  custom_return_url: {mandatory: false, format: BACK_URL},
  custom_callback_url: {mandatory: false, format: BACK_URL}
}.freeze
INIT_DEFAULTS =
{
  # noop, was used to provide placeholder values to requests
}.freeze
LOOSENED_INIT_SPEC =
INIT_SPEC.dup.merge(
  name_on_card: {mandatory: false, format: NAME_ON_CARD},
  street: {mandatory: false, format: STREET},
  zip: {mandatory: false, format: ZIP},
  city: {mandatory: false, format: CITY},
  country: {mandatory: false, format: COUNTRY},
  state: {mandatory: false, format: STATE},
  phone: {mandatory: false, format: PHONE},
).freeze
INIT_RECURRING_REGISTRATION_SPEC =
INIT_SPEC.
# method: :init_recurring_registration
dup.merge(save_card: {mandatory: true, format: %r'\d+'}).freeze
INIT_RECURRING_REGISTRATION_DEFAULTS =
INIT_DEFAULTS.
dup.merge(save_card: "1").freeze
LOOSENED_INIT_RECURRING_REGISTRATION_SPEC =
LOOSENED_INIT_SPEC.
dup.merge(save_card: {mandatory: true, format: %r'\d+'}).freeze
INIT_RECURRENT_SPEC =
  1. Table

Field Format Description guid ans(19) Your merchant GUID pwd h(40) SHA1 hash of your processing password rs an(1..12) Routing string original_init_id h(40) init_transaction_id of your original transaction merchant_transaction_id ans(5..50) Your transaction ID amount n Transaction amount, in MINOR units (i.e. 2150 for $21.50 transaction) description uns(5..255) Order items description

{
  # method: :init_recurrent
  guid: {mandatory: true, format: GUID_REGEX},
  pwd: {mandatory: true, format: PASSWORD_DIGEST_REGEX},
  rs: {mandatory: true, format: ROUTING_REGEX},
  original_init_id: {mandatory: true, format: TID_REGEX},
  merchant_transaction_id: {mandatory: true, format: MERCHANT_TRANSACTION_ID},
  amount: {mandatory: true, format: AMOUNT},
  description: {mandatory: true, format: DESCRIPTION},
}.freeze
INIT_RECURRENT_DEFAULTS =
{
  # none
}.freeze
CHARGE_RECURRENT_SPEC =
  1. Table

Field Format Description init_transaction_id h(40) init_transaction_id received for this recurrent transaction f_extended n Return extended charge details (optional)

{
  # method: :charge_recurrent
  guid: {mandatory: true, format: GUID_REGEX},
  pwd: {mandatory: true, format: PASSWORD_DIGEST_REGEX},
  init_transaction_id: {mandatory: true, format: TID_REGEX},
  f_extended: {mandatory: false, format: F_EXTENDED},
}.freeze
CHARGE_RECURRENT_DEFAULTS =
{
  f_extended: "100" # determines the verbosity of responses
}.freeze
STATUS_REQUEST_SPEC =
  1. Table

Field Format Value request_type as ‘transaction_status’ init_transaction_id h(40) Gateway Transaction ID f_extended n Return extended charge details, see section 2.4 of this manual for more details (optional) guid ans(19) Your GUID pwd h(40) SHA1 hash of your processing password

{
  # method: :status_request
  guid: {mandatory: true, format: GUID_REGEX},
  pwd: {mandatory: true, format: PASSWORD_DIGEST_REGEX},
  request_type: {mandatory: true, format: 'transaction_status'},
  init_transaction_id: {mandatory: true, format: TID_REGEX},
  f_extended: {mandatory: false, format: F_EXTENDED}
}.freeze
STATUS_REQUEST_DEFAULTS =
{
  request_type: 'transaction_status',
  f_extended: "100", # determines the verbosity of responses
}.freeze