API

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 cnpRequest 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

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

Type:bool
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, sameDayFunding=False)

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. It’s the time that server has not issued a response.
  • sameDayFunding (bool) – Start v11.3. Used for Online Dynamic Payout Funding Instructions only. Set to True for same day funding.
Returns:

response XML in desired format.

Raises:

VantivExceptions.

utils.Configuration

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

Setup Configuration variables.

user

authentication.user

Type:Str
password

authentication.password

Type:Str
merchantId

The unique string to identify the merchant within the system.

Type:Str
reportGroup

To separate your transactions into different categories,

Type:Str
url

Url for server.

Type:Str
proxy

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

Type:Str
sftp_username

Username for sftp

Type:Str
sftp_password

Password for sftp

Type:Str
sftp_url

Address for sftp

Type:Str
batch_requests_path

Location for saving generated batch request xml

Type:Str
batch_response_path

Location for saving batch response xml

Type:Str
print_xml

Whether print request and response xml

Type:Str
save()

Save Class Attributes to .vantiv_python_sdk.conf

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