API

batch.stream

vantivsdk.batch.stream(transactions, conf, return_format='dict', timeout_send=60, timeout_rev=2)

stream batch request to IBC (inbound batch communicator) via socket and get return object

Parameters:
  • transactions – an instance of batch.Transactions.
  • conf – An instance of utils.Configuration.
  • return_format – Return format. The default is ‘dict’. Could be one of ‘dict’, ‘object’ or ‘xml’.
  • timeout_send – Positive int. Timeout in second for socket connection when sending.
  • timeout_rev – Positive int. Timeout in second for socket connection when receiving.
Returns:

response XML in desired format.

batch.download

vantivsdk.batch.download(filename, conf, delete_remote=False, timeout=60)

Download Processed Session File from server via sFTP

Get xml file from server and save to local file system

Parameters:
  • filename – filename of file in outbound folder at remote server with ‘.asc’ as extension.
  • conf – An instance of utils.Configuration.
  • delete_remote – If delete the remote file after download. The default is False
  • timeout – Timeout in second for ssh connection for sftp.
Returns:

path for file that saved in local file system.

Raises:

Exception depends on when get it.

batch.submit

vantivsdk.batch.submit(transactions, conf, filename='', timeout=60)

Submitting a Session File for Processing to server via sFTP

  1. Generate litleRequest xml.
  2. Save xml at local file system.
  3. Send xml file to server.
Parameters:
  • transactions – an instance of batch.Transactions.
  • conf – An instance of utils.Configuration.
  • filename – String. File name for generated xml file. If the file exist, a timestamp string will be added.
  • timeout – Positive int. Timeout in second for ssh connection for sftp.
Returns:

filename of file in inbound folder at remote server with ‘.asc’ as extension.

Raises:

Exception depends on when get it.

batch.retrieve

vantivsdk.batch.retrieve(filename, conf, return_format='dict', save_to_local=False, delete_remote=False, timeout=60)

Retrieving Processed Session File from server via sFTP

  1. Get xml file string from server and return object
  2. If save_to_local, save to local file system
Parameters:
  • filename – filename of file in outbound folder at remote server with ‘.asc’ as extension.
  • conf – An instance of utils.Configuration.
  • return_format – Return format. The default is ‘dict’. Could be one of ‘dict’, ‘object’ or ‘xml’.
  • save_to_local – whether save file to local. default is false.
  • delete_remote – If delete the remote file after download. The default is False
  • timeout – Timeout in second for ssh connection for sftp.
Returns:

response XML in desired format.

Raises:

Exception depends on when get it.

batch.Transactions

class vantivsdk.batch.Transactions

Container of transactions for batch request

Then transactions could be RFRRequest and any batch request supported transactions and recurringTransaction. RFRRequest cannot exist in the same instance with any other transactions.

A instance cannot contain more than 1,000,000 transactions.

sameDayFunding

bool – Since v11.1. Used for Dynamic Payout Funding Instructions only. Set to True to mark this Batch of Funding Instructions for same day funding.

add(transaction)

Add transaction to the container class.

Parameters:transaction – an instance of Transactions or RFRRequest which could process by Batch.
Returns:None
Raises:Exceptions.
is_rfr_request

A property, whether current instanc include a RFRRequest

Returns:Boolean
recurringTransactions

A property, return a new list of recurringTransactions.

Returns:list of recurringTransactions
transactions

A property, return a new list of transactions.

Returns:list of transactions

online.request

vantivsdk.online.request(transaction, conf, return_format='dict', timeout=30)

Send request to server.

Parameters:
  • transaction – An instance of transaction class
  • conf – An instance of utils.Configuration
  • return_format – Return format. The default is ‘dict’. Could be one of ‘dict’, ‘object’ or ‘xml’.
  • timeout – timeout for the request in seconds. timeout is not a time limit on the entire response.
  • the time that server has not issued a response. (It's) –
Returns:

response XML in desired format.

Raises:

VantivExceptions.

utils.Configuration

class vantivsdk.utils.Configuration(conf_dict={})

Setup Configuration variables.

user

Str – authentication.user

password

Str – authentication.password

merchantId

Str – The unique string to identify the merchant within the system.

reportGroup

Str – To separate your transactions into different categories,

url

Str – Url for server.

proxy

Str – Https proxy server address. Must start with “https://

sftp_username

Str – Username for sftp

sftp_password

Str – Password for sftp

sftp_url

Str – Address for sftp

batch_requests_path

Str – Location for saving generated batch request xml

batch_response_path

Str – Location for saving batch response xml

fast_url

Str – Fast address, using for batch stream

fast_port

Str – Fast port, using for batch stream

print_xml

Str – Whether print request and response xml

save()

Save Class Attributes to .vantiv_python_sdk.conf

Returns:full path for configuration file.
Raises:IOError – An error occurred