-
Notifications
You must be signed in to change notification settings - Fork 3
TransactionReportFile
Munir Wanis edited this page Feb 10, 2016
·
2 revisions
require 'stone_ecommerce'
# variable with merchant key
merchantKey = '85328786-8BA6-420F-9948-5352F5A183EB'
# instantiate class with request methods
# :sandbox for sandbox ambient
# :production for production ambient
gateway = Gateway::Gateway.new(:sandbox, merchantKey)
# create a Date variable
date = Date.new(2014, 12, 10)
# make the request and returns a response string with report data
response = gateway.TransactionReportFile(date)
If you want the string that is received from TransactionReportFile Method to be parsed, there is a method for that.
require 'stone_ecommerce'
# variable with merchant key
merchantKey = '85328786-8BA6-420F-9948-5352F5A183EB'
# instantiate class with request methods
# :sandbox for sandbox ambient
# :production for production ambient
gateway = Gateway::Gateway.new(:sandbox, merchantKey)
# create a Date variable
date = Date.new(2014, 12, 10)
# make the request and returns a response string with report data
response = gateway.TransactionReportFile(date)
# parses the string from TransactionReportFile and returns a response hash
response = gateway.TransactionReportFileParser(request_to_parse)
This method download and save the TransactionReportFile to a '.txt' file.
require 'stone_ecommerce'
# variable with merchant key
merchantKey = '85328786-8BA6-420F-9948-5352F5A183EB'
# instantiate class with request methods
# :sandbox for sandbox ambient
# :production for production ambient
gateway = Gateway::Gateway.new(:sandbox, merchantKey)
# create a Date variable
date = Date.new(2014, 12, 10)
# make a transaction report file request and saves it at the destiny you passed on 3rd parameter
# the 2nd parameter is the file name
# file type is .txt
response = gateway.TransactionReportFileDownloader(date, 'Test', "C:\\Users\\YourUser\\Desktop\\")