Classes¶
Transaction details¶
-
class
TeliumAsk
¶ -
__init__
(pos_number, answer_flag, transaction_type, payment_mode, currency_numeric, delay, authorization, amount)¶ Parameters: - pos_number (str) – Checkout unique identifier from ‘01’ to ‘99’.
- answer_flag (str) – Answer report size. use
TERMINAL_ANSWER_SET_FULLSIZED
for complete details orTERMINAL_ANSWER_SET_SMALLSIZED
for limited answer report. Limited report does not show payment source id, e.g. credit card numbers. - transaction_type (str) – If transaction is about CREDIT, DEBIT, etc.. .
Use at least one of listed possible values:
TERMINAL_MODE_PAYMENT_DEBIT
,TERMINAL_MODE_PAYMENT_CREDIT
,TERMINAL_MODE_PAYMENT_REFUND
,TERMINAL_MODE_PAYMENT_AUTO
. - payment_mode (str) – Type of payment support.
Use at least one of listed possible values:
TERMINAL_TYPE_PAYMENT_CARD
,TERMINAL_TYPE_PAYMENT_CHECK
,TERMINAL_TYPE_PAYMENT_AMEX
,TERMINAL_TYPE_PAYMENT_CETELEM
,TERMINAL_TYPE_PAYMENT_COFINOGA
,TERMINAL_TYPE_PAYMENT_DINERS
,TERMINAL_TYPE_PAYMENT_FRANFINANCE
,TERMINAL_TYPE_PAYMENT_JCB
,TERMINAL_TYPE_PAYMENT_ACCORD_FINANCE
,TERMINAL_TYPE_PAYMENT_MONEO
,TERMINAL_TYPE_PAYMENT_CUP
,TERMINAL_TYPE_PAYMENT_FINTRAX_EMV
,TERMINAL_TYPE_PAYMENT_OTHER
. - currency_numeric (str) – Currency ISO format.
Two ISO currency are available as constant.
TERMINAL_NUMERIC_CURRENCY_EUR
: EUR - € - ISO;978.TERMINAL_NUMERIC_CURRENCY_USD
: USD - $ - ISO;840. - delay (str) – Describe if answer should be immediate (without valid status) or after transaction.
Use at least one of listed possible values:
TERMINAL_REQUEST_ANSWER_WAIT_FOR_TRANSACTION
,TERMINAL_REQUEST_ANSWER_INSTANT
. - authorization (str) –
Describe if the terminal has to manually authorize payment.
Use at least one of listed possible values:
TERMINAL_FORCE_AUTHORIZATION_ENABLE
,TERMINAL_FORCE_AUTHORIZATION_DISABLE
. - amount (float) – Payment amount, min 0.01, max 99999.99.
This object is meant to be translated into a bytes sequence and transferred to your terminal.
-
encode
()¶ Returns: Raw string array with payment information Return type: str Raises: SequenceDoesNotMatchLengthException – Will be raised if the string sequence doesn’t match required length. Check your instance params. Translate object into a string sequence ready to be sent to device.
-
static
decode
(data)¶ Parameters: data (bytes) – Raw bytes sequence to be converted into TeliumAsk instance.
Returns: Create a new TeliumAsk.
Return type: Raises: - LrcChecksumException – Will be raised if LRC checksum doesn’t match.
- SequenceDoesNotMatchLengthException – Will be raised if the string sequence doesn’t match required length.
Create a new instance of TeliumAsk from a bytes sequence previously generated with encode(). This is no use in a production environment.
-
static
new_payment
(amount, payment_mode='debit', target_currency='USD', checkout_unique_id='1', wait_for_transaction_to_end=True, collect_payment_source_info=True, force_bank_verification=False)¶ Parameters: - amount (float) – Amount requested
- payment_mode (str) – Specify transaction type. (debit, credit or refund)
- target_currency (str) – Target currency, must be written in letters. (EUR, USD, etc..)
- checkout_unique_id (str) – Unique checkout identifer.
- wait_for_transaction_to_end (bool) – Set to True if you need valid transaction status otherwise, set it to False.
- collect_payment_source_info (bool) – If you want to retrieve specifics data about payment source identification.
- force_bank_verification (bool) – Set it to True if your business need to enforce payment verification.
Returns: Ready to use TeliumAsk instance
Return type: Create new TeliumAsk in order to prepare payment. Most commonly used.
-
Transaction results¶
-
class
TeliumResponse
¶ -
__init__
(pos_number, transaction_result, amount, payment_mode, report, currency_numeric, private)¶ Parameters: - pos_number (str) – Checkout unique identifier from ‘01’ to ‘99’.
- transaction_result (int) – Transaction result.
- amount (float) – Payment authorized/acquired amount.
- payment_mode (str) – Type of payment support.
- report (str) – Contains payment source unique identifier like credit-card numbers when fullsized report is enabled.
- currency_numeric (str) – Currency ISO format.
- private (str) – If supported by your device, contains transaction unique identifier.
-
has_succeeded
¶ Getter: True if transaction has been authorized, False otherwise. Type: bool
-
report
¶ Getter: Contain data like the card numbers for instance. Should be handled wisely. Type: str
-
transaction_id
¶ Getter: If supported by your device, contains transaction unique identifier. Type: bool
-
card_id
¶ Getter: Read card numbers if available. Type: str|None
-
card_id_sha512
¶ Getter: Return payment source id hash repr (sha512) Type: str|None
-
card_type
¶ Getter: Return if available payment card type Type: payment_card_identifier.PaymentCard|None
-
Device management¶
-
class
Telium
¶ -
__init__
(path='/dev/ttyACM0', baudrate=9600, timeout=1, open_on_create=True, debugging=False)¶ Parameters: - path – Device path.
- baudrate (int) – Baud rate such as 9600 or 115200 etc. Constructor do recommend to set it as 9600.
- timeout (float) – Set a read timeout value.
- open_on_create (bool) – Specify if device should be immedialty opened on instance creation.
- debugging (bool) – Set it to True if you want to diagnose your device. Will print to stdout bunch of useful data.
The port is immediately opened on object creation if open_on_create toggle is True.
path is the device path: depending on operating system. e.g.
/dev/ttyACM0
on GNU/Linux orCOM3
on Windows. Please be aware that a proper driver is needed on Windows in order to create an emulated serial device.Possible values for the parameter timeout which controls the behavior of the device instance:
timeout = None
: wait forever / until requested number of bytes are received, not recommended.timeout = 0
: non-blocking mode, return immediately in any case, returning zero or more, up to the requested number of bytes, use it only when your computer is really fast unless you don’t care about reliability.timeout = x
: set timeout tox
seconds (float allowed) returns immediately when the requested number of bytes are available, otherwise wait until the timeout expires and return all bytes that were received until then.
-
static
get
()¶ Returns: Fresh new Telium instance or None Return type: Telium|None Auto-create a new instance of Telium. The device path will be inferred based on most common location. This won’t be reliable if you have more than one emulated serial device plugged-in. Does not work on NT platform.
-
ask
(telium_ask)¶ Parameters: telium_ask (TeliumAsk) – Payment details Returns: True if device has accepted it, False otherwise. Return type: bool Initialize payment to terminal
-
verify
(telium_ask)¶ Parameters: telium_ask (TeliumAsk) – Payment details previously used on ask() Returns: Transaction results as TeliumResponse, None if nothing was caught from device. Return type: TeliumResponse|None Wait for answer and convert it to TeliumResponse.
-
close
()¶ Returns: True if device was previously opened and now closed. False otherwise. Return type: bool Close device if currently opened. Recommended practice, don’t let Python close it from garbage collector.
-
timeout
¶ Getter: Current timeout set on read. Type: float
-