stone_ecommerce 1.0.3 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/gateway/Address/billing_address.rb +25 -23
- data/lib/gateway/Address/buyer_address.rb +28 -25
- data/lib/gateway/Address/delivery_address.rb +24 -22
- data/lib/gateway/BoletoTransaction/boleto_transaction.rb +28 -30
- data/lib/gateway/BoletoTransaction/boleto_transaction_options.rb +14 -11
- data/lib/gateway/BoletoTransaction/boleto_transaction_report_file.rb +20 -17
- data/lib/gateway/CreditCardTransaction/credit_card.rb +19 -18
- data/lib/gateway/CreditCardTransaction/credit_card_transaction.rb +21 -19
- data/lib/gateway/CreditCardTransaction/credit_card_transaction_options.rb +17 -15
- data/lib/gateway/CreditCardTransaction/credit_card_transaction_report_file.rb +29 -26
- data/lib/gateway/CreditCardTransaction/manage_credit_card_transaction.rb +11 -8
- data/lib/gateway/CreditCardTransaction/retry_sale_credit_card_transaction.rb +10 -8
- data/lib/gateway/Gateway.rb +514 -334
- data/lib/gateway/InstantBuyData/create_instant_buy_data_request.rb +31 -0
- data/lib/gateway/InstantBuyData/update_instant_buy_data_request.rb +11 -0
- data/lib/gateway/Merchant/merchant.rb +10 -8
- data/lib/gateway/OnlineDebit/online_debit_transaction_report_file.rb +19 -16
- data/lib/gateway/Order/order.rb +11 -8
- data/lib/gateway/Order/order_transaction_report_file.rb +8 -5
- data/lib/gateway/Parsers/boleto_transaction_parser.rb +28 -25
- data/lib/gateway/Parsers/credit_card_transaction_parser.rb +37 -34
- data/lib/gateway/Parsers/header_parser.rb +13 -10
- data/lib/gateway/Parsers/online_debit_transaction_parser.rb +26 -23
- data/lib/gateway/Parsers/trailer_parser.rb +13 -11
- data/lib/gateway/Person/buyer.rb +22 -22
- data/lib/gateway/Person/create_buyer_request.rb +23 -0
- data/lib/gateway/Person/person.rb +34 -32
- data/lib/gateway/Recurrency/recurrency.rb +18 -16
- data/lib/gateway/Sale/create_sale_request.rb +26 -24
- data/lib/gateway/Sale/manage_sale_request.rb +13 -11
- data/lib/gateway/Sale/query_sale_request.rb +27 -25
- data/lib/gateway/Sale/request_data.rb +16 -14
- data/lib/gateway/Sale/retry_sale_options.rb +12 -10
- data/lib/gateway/Sale/retry_sale_request.rb +15 -14
- data/lib/gateway/Sale/sale_data.rb +0 -2
- data/lib/gateway/Sale/sale_order_data.rb +14 -12
- data/lib/gateway/SalesOption.rb +13 -11
- data/lib/gateway/ShoppingCart/shopping_cart.rb +18 -16
- data/lib/gateway/ShoppingCart/shopping_cart_item.rb +15 -13
- data/lib/gateway/Trailer.rb +8 -5
- data/lib/gateway/header.rb +7 -4
- data/lib/gateway/post_notification.rb +23 -20
- data/lib/gateway/transaction_report_file.rb +43 -40
- data/lib/stone_ecommerce.rb +6 -14
- data/spec/integration/gateway_spec.rb +376 -85
- data/spec/spec_helper.rb +96 -96
- data/stone_ecommerce.gemspec +2 -2
- metadata +6 -20
- data/lib/gateway/AntiFraud/anti_fraud_analysis_result.rb +0 -47
- data/lib/gateway/AntiFraud/query_sale_anti_fraud_analysis_data.rb +0 -51
- data/lib/gateway/AntiFraud/query_sale_anti_fraud_analysis_history_data.rb +0 -41
- data/lib/gateway/BaseRequest.rb +0 -11
- data/lib/gateway/BaseResponse.rb +0 -17
- data/lib/gateway/BoletoTransaction/boleto_transaction_data.rb +0 -44
- data/lib/gateway/BoletoTransaction/boleto_transaction_result.rb +0 -35
- data/lib/gateway/CreditCardTransaction/credit_card_transaction_data.rb +0 -104
- data/lib/gateway/ErrorItem.rb +0 -17
- data/lib/gateway/ErrorReport.rb +0 -18
- data/lib/gateway/InstantBuy/credit_card_data.rb +0 -41
- data/lib/gateway/InstantBuy/get_instant_buy_data_response.rb +0 -18
- data/lib/gateway/Sale/create_sale_response.rb +0 -25
- data/lib/gateway/Sale/manage_sale_response.rb +0 -15
- data/lib/gateway/Sale/query_sale_response.rb +0 -18
- data/lib/gateway/Sale/retry_sale_response.rb +0 -14
- data/lib/gateway/address.rb +0 -25
@@ -1,29 +1,32 @@
|
|
1
|
-
|
2
|
-
attr_accessor :Order
|
3
|
-
attr_accessor :TransactionKey
|
4
|
-
attr_accessor :TransactionKeyToAcquirer
|
5
|
-
attr_accessor :CreditCardTransactionReference
|
6
|
-
attr_accessor :CreditCardBrand
|
7
|
-
attr_accessor :CreditCardNumber
|
8
|
-
attr_accessor :InstallmentCount
|
9
|
-
attr_accessor :AcquirerName
|
10
|
-
attr_accessor :Status
|
11
|
-
attr_accessor :AmountInCents
|
12
|
-
attr_accessor :IataAmountInCents
|
13
|
-
attr_accessor :AuthorizationCode
|
14
|
-
attr_accessor :TransactionIdentifier
|
15
|
-
attr_accessor :UniqueSequentialNumber
|
16
|
-
attr_accessor :AuthorizedAmountInCents
|
17
|
-
attr_accessor :CapturedAmountInCents
|
18
|
-
attr_accessor :VoidedAmountInCents
|
19
|
-
attr_accessor :RefundedAmountInCents
|
20
|
-
attr_accessor :AcquirerAuthorizationReturnCode
|
21
|
-
attr_accessor :AuthorizedDate
|
22
|
-
attr_accessor :CapturedDate
|
23
|
-
attr_accessor :VoidedDate
|
24
|
-
attr_accessor :LastProbeDate
|
1
|
+
module Gateway
|
25
2
|
|
26
|
-
|
27
|
-
|
3
|
+
class CreditCardTransactionReportFile
|
4
|
+
attr_accessor :Order
|
5
|
+
attr_accessor :TransactionKey
|
6
|
+
attr_accessor :TransactionKeyToAcquirer
|
7
|
+
attr_accessor :CreditCardTransactionReference
|
8
|
+
attr_accessor :CreditCardBrand
|
9
|
+
attr_accessor :CreditCardNumber
|
10
|
+
attr_accessor :InstallmentCount
|
11
|
+
attr_accessor :AcquirerName
|
12
|
+
attr_accessor :Status
|
13
|
+
attr_accessor :AmountInCents
|
14
|
+
attr_accessor :IataAmountInCents
|
15
|
+
attr_accessor :AuthorizationCode
|
16
|
+
attr_accessor :TransactionIdentifier
|
17
|
+
attr_accessor :UniqueSequentialNumber
|
18
|
+
attr_accessor :AuthorizedAmountInCents
|
19
|
+
attr_accessor :CapturedAmountInCents
|
20
|
+
attr_accessor :VoidedAmountInCents
|
21
|
+
attr_accessor :RefundedAmountInCents
|
22
|
+
attr_accessor :AcquirerAuthorizationReturnCode
|
23
|
+
attr_accessor :AuthorizedDate
|
24
|
+
attr_accessor :CapturedDate
|
25
|
+
attr_accessor :VoidedDate
|
26
|
+
attr_accessor :LastProbeDate
|
27
|
+
|
28
|
+
def initialize
|
29
|
+
@Order = OrderTransactionReportFile.new
|
30
|
+
end
|
28
31
|
end
|
29
32
|
end
|
@@ -1,12 +1,15 @@
|
|
1
|
+
module Gateway
|
2
|
+
|
1
3
|
# classe para usar nos metodos de cancel e capture
|
2
|
-
class ManageCreditCardTransaction
|
3
|
-
|
4
|
-
|
5
|
-
|
4
|
+
class ManageCreditCardTransaction
|
5
|
+
attr_accessor :AmountInCents
|
6
|
+
attr_accessor :TransactionKey
|
7
|
+
attr_accessor :TransactionReference
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
def to_json
|
10
|
+
hash = {}
|
11
|
+
instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
|
12
|
+
hash
|
13
|
+
end
|
11
14
|
end
|
12
15
|
end
|
@@ -1,13 +1,15 @@
|
|
1
|
-
|
1
|
+
module Gateway
|
2
2
|
|
3
|
-
|
3
|
+
class RetrySaleCreditCardTransaction
|
4
4
|
|
5
|
-
|
5
|
+
attr_accessor :TransactionKey
|
6
6
|
|
7
|
-
|
8
|
-
hash = {}
|
9
|
-
instance_variables.each {|var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
|
10
|
-
hash
|
11
|
-
end
|
7
|
+
attr_accessor :SecurityCode
|
12
8
|
|
9
|
+
def to_json
|
10
|
+
hash = {}
|
11
|
+
instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
|
12
|
+
hash
|
13
|
+
end
|
14
|
+
end
|
13
15
|
end
|
data/lib/gateway/Gateway.rb
CHANGED
@@ -1,441 +1,621 @@
|
|
1
1
|
require_relative '../../lib/stone_ecommerce'
|
2
|
+
module Gateway
|
2
3
|
|
3
|
-
class Gateway
|
4
|
+
class Gateway
|
5
|
+
extend Gem::Deprecate
|
4
6
|
|
5
|
-
|
7
|
+
attr_reader :serviceEnvironment
|
6
8
|
|
7
|
-
|
9
|
+
attr_reader :merchantKey
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
def initialize(environment=:sandbox, merchantKey)
|
12
|
+
@serviceEnvironment = environment
|
13
|
+
@merchantKey = merchantKey
|
14
|
+
@@SERVICE_HEADERS = {:MerchantKey => "#{@merchantKey}", :Accept => 'application/json', :"Content-Type" => 'application/json'}
|
15
|
+
end
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
+
# URL de producao
|
18
|
+
@@SERVICE_URL_PRODUCTION = 'https://transaction.stone.com.br'
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
+
# URL de homologacao
|
21
|
+
@@SERVICE_URL_STAGING = ''
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
+
# URL de sandbox
|
24
|
+
@@SERVICE_URL_SANDBOX = 'https://transaction.stone.com.br'
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
+
# URL do postnotification de producao
|
27
|
+
@@SERVICE_URL_NOTIFICATION_PRODUCTION = ''
|
26
28
|
|
27
|
-
|
28
|
-
|
29
|
+
# URL do postnotification de sandbox
|
30
|
+
@@SERVICE_URL_NOTIFICATION_SANDBOX = ''
|
29
31
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
# permite que o integrador adicione uma busca por transacoes utilizando alguns criterios
|
33
|
+
def Query(querySaleRequestEnum, key)
|
34
|
+
# try, tenta fazer o request
|
35
|
+
begin
|
36
|
+
# se for homologacao faz a chamada por aqui
|
37
|
+
if @serviceEnvironment == :staging
|
38
|
+
getRequest(@@SERVICE_URL_STAGING + '/Sale/Query/' + querySaleRequestEnum + '=' + key)
|
37
39
|
|
38
|
-
|
39
|
-
|
40
|
-
|
40
|
+
# se for producao, faz a chamada por aqui
|
41
|
+
elsif @serviceEnvironment == :production
|
42
|
+
getRequest(@@SERVICE_URL_PRODUCTION + '/Sale/Query/' + querySaleRequestEnum + '=' + key)
|
41
43
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
44
|
+
# se for sandbox
|
45
|
+
elsif @serviceEnvironment == :sandbox
|
46
|
+
getRequest(@@SERVICE_URL_SANDBOX + '/Sale/Query/' + querySaleRequestEnum + '=' + key)
|
47
|
+
end
|
46
48
|
|
47
|
-
|
48
|
-
|
49
|
-
|
49
|
+
# se der algum erro, trata aqui
|
50
|
+
rescue Exception => e
|
51
|
+
return e.message
|
52
|
+
end
|
50
53
|
end
|
51
|
-
end
|
52
54
|
|
53
|
-
|
54
|
-
|
55
|
+
# criar uma transacao na plataforma One utilizando um ou mais meios de pagamento
|
56
|
+
def CreateSale(createSaleRequest)
|
55
57
|
|
56
|
-
|
58
|
+
saleHash = createSaleRequest.to_json
|
57
59
|
|
58
|
-
|
60
|
+
saleHash['BoletoTransactionCollection'] = []
|
59
61
|
|
60
|
-
|
62
|
+
saleHash['CreditCardTransactionCollection'] = []
|
61
63
|
|
62
|
-
|
64
|
+
saleHash['ShoppingCartCollection'] = []
|
63
65
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
66
|
+
begin
|
67
|
+
# transforma a colecao de boleto em json
|
68
|
+
if createSaleRequest.BoletoTransactionCollection.any? == false || createSaleRequest.BoletoTransactionCollection.nil?
|
69
|
+
saleHash['BoletoTransactionCollection'] = nil
|
68
70
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
71
|
+
else
|
72
|
+
createSaleRequest.BoletoTransactionCollection.each_with_index do |boleto, index|
|
73
|
+
b = boleto.to_json
|
74
|
+
saleHash['BoletoTransactionCollection'] << b
|
73
75
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
76
|
+
if boleto.Options.to_json.any?
|
77
|
+
boleto_options = boleto.Options.to_json
|
78
|
+
saleHash['BoletoTransactionCollection'][index]['Options'] = boleto_options
|
79
|
+
else
|
80
|
+
saleHash['BoletoTransactionCollection'][index]['Options'] = nil
|
81
|
+
end
|
80
82
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
83
|
+
if boleto.BillingAddress.to_json.any?
|
84
|
+
boleto_billing_address = boleto.BillingAddress.to_json
|
85
|
+
saleHash['BoletoTransactionCollection'][index]['BillingAddress'] = boleto_billing_address
|
86
|
+
else
|
87
|
+
saleHash['BoletoTransactionCollection'][index]['BillingAddress'] = nil
|
88
|
+
end
|
86
89
|
end
|
87
90
|
end
|
88
|
-
end
|
89
|
-
|
90
|
-
# transforma a colecao de cartao de credito em json
|
91
|
-
if createSaleRequest.CreditCardTransactionCollection.any? == false || createSaleRequest.CreditCardTransactionCollection.nil?
|
92
|
-
saleHash['CreditCardTransactionCollection'] = nil
|
93
|
-
else
|
94
|
-
createSaleRequest.CreditCardTransactionCollection.each_with_index do |creditCard, index|
|
95
|
-
c = creditCard.to_json
|
96
|
-
saleHash['CreditCardTransactionCollection'] << c
|
97
|
-
|
98
|
-
if creditCard.Options.to_json.any?
|
99
|
-
credit_card_options = creditCard.Options.to_json
|
100
|
-
saleHash['CreditCardTransactionCollection'][index]['Options'] = credit_card_options
|
101
|
-
else
|
102
|
-
saleHash['CreditCardTransactionCollection'][index]['Options'] = nil
|
103
|
-
end
|
104
91
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
92
|
+
# transforma a colecao de cartao de credito em json
|
93
|
+
if createSaleRequest.CreditCardTransactionCollection.any? == false || createSaleRequest.CreditCardTransactionCollection.nil?
|
94
|
+
saleHash['CreditCardTransactionCollection'] = nil
|
95
|
+
else
|
96
|
+
createSaleRequest.CreditCardTransactionCollection.each_with_index do |creditCard, index|
|
97
|
+
c = creditCard.to_json
|
98
|
+
saleHash['CreditCardTransactionCollection'] << c
|
111
99
|
|
112
|
-
|
113
|
-
|
114
|
-
|
100
|
+
if creditCard.Options.to_json.any?
|
101
|
+
credit_card_options = creditCard.Options.to_json
|
102
|
+
saleHash['CreditCardTransactionCollection'][index]['Options'] = credit_card_options
|
103
|
+
else
|
104
|
+
saleHash['CreditCardTransactionCollection'][index]['Options'] = nil
|
105
|
+
end
|
115
106
|
|
116
|
-
if creditCard.
|
117
|
-
|
118
|
-
saleHash['CreditCardTransactionCollection'][index]['
|
107
|
+
if creditCard.Recurrency.to_json.any?
|
108
|
+
credit_card_recurrency = creditCard.Recurrency.to_json
|
109
|
+
saleHash['CreditCardTransactionCollection'][index]['Recurrency'] = credit_card_recurrency
|
119
110
|
else
|
120
|
-
saleHash['CreditCardTransactionCollection'][index]['
|
111
|
+
saleHash['CreditCardTransactionCollection'][index]['Recurrency'] = nil
|
121
112
|
end
|
122
113
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
end
|
127
|
-
end
|
114
|
+
if creditCard.CreditCard.to_json.any?
|
115
|
+
credit_card_item = creditCard.CreditCard.to_json
|
116
|
+
saleHash['CreditCardTransactionCollection'][index]['CreditCard'] = credit_card_item
|
128
117
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
saleHash['ShoppingCartCollection'] << s
|
136
|
-
|
137
|
-
if shoppingCart.DeliveryAddress.to_json.any?
|
138
|
-
delivery_address = shoppingCart.DeliveryAddress.to_json
|
139
|
-
saleHash['ShoppingCartCollection'][index]['DeliveryAddress'] = delivery_address
|
140
|
-
else
|
141
|
-
saleHash['ShoppingCartCollection'][index]['DeliveryAddress'] = nil
|
142
|
-
end
|
118
|
+
if creditCard.CreditCard.BillingAddress.to_json.any?
|
119
|
+
credit_card_billing_address = creditCard.CreditCard.BillingAddress.to_json
|
120
|
+
saleHash['CreditCardTransactionCollection'][index]['CreditCard']['BillingAddress'] = credit_card_billing_address
|
121
|
+
else
|
122
|
+
saleHash['CreditCardTransactionCollection'][index]['CreditCard']['BillingAddress'] = nil
|
123
|
+
end
|
143
124
|
|
144
|
-
|
145
|
-
|
146
|
-
item = cartItem.to_json
|
147
|
-
saleHash['ShoppingCartCollection'][index]['ShoppingCartItemCollection'][cartIndex] = item
|
125
|
+
else
|
126
|
+
saleHash['CreditCardTransactionCollection'][index]['CreditCard'] = nil
|
148
127
|
end
|
149
|
-
else
|
150
|
-
saleHash['ShoppingCartCollection'][index]['ShoppingCartItemCollection'] = nil
|
151
128
|
end
|
152
129
|
end
|
153
|
-
end
|
154
130
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
131
|
+
# transforma a colecao de shoppingcart em json
|
132
|
+
if createSaleRequest.ShoppingCartCollection.any? == false || createSaleRequest.ShoppingCartCollection.nil?
|
133
|
+
saleHash['ShoppingCartCollection'] = nil
|
134
|
+
else
|
135
|
+
createSaleRequest.ShoppingCartCollection.each_with_index do |shoppingCart, index|
|
136
|
+
s = shoppingCart.to_json
|
137
|
+
saleHash['ShoppingCartCollection'] << s
|
162
138
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
end
|
139
|
+
if shoppingCart.DeliveryAddress.to_json.any?
|
140
|
+
delivery_address = shoppingCart.DeliveryAddress.to_json
|
141
|
+
saleHash['ShoppingCartCollection'][index]['DeliveryAddress'] = delivery_address
|
142
|
+
else
|
143
|
+
saleHash['ShoppingCartCollection'][index]['DeliveryAddress'] = nil
|
144
|
+
end
|
170
145
|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
146
|
+
if shoppingCart.ShoppingCartItemCollection.any?
|
147
|
+
shoppingCart.ShoppingCartItemCollection.each_with_index do |cartItem, cartIndex|
|
148
|
+
item = cartItem.to_json
|
149
|
+
saleHash['ShoppingCartCollection'][index]['ShoppingCartItemCollection'][cartIndex] = item
|
150
|
+
end
|
151
|
+
else
|
152
|
+
saleHash['ShoppingCartCollection'][index]['ShoppingCartItemCollection'] = nil
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
178
156
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
157
|
+
# transforma objeto options em json
|
158
|
+
if createSaleRequest.Options.to_json.any?
|
159
|
+
o = createSaleRequest.Options.to_json
|
160
|
+
saleHash['Options'] = o
|
161
|
+
else
|
162
|
+
saleHash['Options'] = nil
|
163
|
+
end
|
164
|
+
|
165
|
+
# transforma objeto order em json
|
166
|
+
if createSaleRequest.Order.to_json.any?
|
167
|
+
order = createSaleRequest.Order.to_json
|
168
|
+
saleHash['Order'] = order
|
169
|
+
else
|
170
|
+
saleHash['Order'] = nil
|
171
|
+
end
|
186
172
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
173
|
+
# transforma objeto merchant em json
|
174
|
+
if createSaleRequest.Merchant.to_json.any?
|
175
|
+
merchant = createSaleRequest.Merchant.to_json
|
176
|
+
saleHash['Merchant'] = merchant
|
177
|
+
else
|
178
|
+
saleHash['Merchant'] = nil
|
179
|
+
end
|
191
180
|
|
192
|
-
|
193
|
-
createSaleRequest.
|
194
|
-
|
195
|
-
saleHash['
|
181
|
+
# transforma objeto request data em json
|
182
|
+
if createSaleRequest.RequestData.to_json.any?
|
183
|
+
request_data = createSaleRequest.RequestData.to_json
|
184
|
+
saleHash['RequestData'] = request_data
|
185
|
+
else
|
186
|
+
saleHash['RequestData'] = nil
|
196
187
|
end
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
if buyer_hash.blank? == false
|
188
|
+
|
189
|
+
# transforma o objeto Buyer em json
|
190
|
+
if createSaleRequest.Buyer.AddressCollection.any?
|
201
191
|
b = createSaleRequest.Buyer.to_json
|
202
192
|
saleHash['Buyer'] = b
|
203
|
-
|
193
|
+
|
194
|
+
saleHash['Buyer']['AddressCollection'] = []
|
195
|
+
createSaleRequest.Buyer.AddressCollection.each do |address|
|
196
|
+
a = address.to_json
|
197
|
+
saleHash['Buyer']['AddressCollection'] << a
|
198
|
+
end
|
204
199
|
else
|
205
|
-
|
200
|
+
buyer_hash = createSaleRequest.Buyer.to_json
|
201
|
+
buyer_hash.delete('AddressCollection')
|
202
|
+
if buyer_hash.blank? == false
|
203
|
+
b = createSaleRequest.Buyer.to_json
|
204
|
+
saleHash['Buyer'] = b
|
205
|
+
saleHash['Buyer']['AddressCollection'] = nil
|
206
|
+
else
|
207
|
+
saleHash['Buyer'] = nil
|
208
|
+
end
|
206
209
|
end
|
210
|
+
|
211
|
+
rescue Exception => e
|
212
|
+
return e.message
|
207
213
|
end
|
208
214
|
|
209
|
-
|
210
|
-
|
215
|
+
if @serviceEnvironment == :staging
|
216
|
+
url = @@SERVICE_URL_STAGING + '/Sale/'
|
217
|
+
elsif @serviceEnvironment == :production
|
218
|
+
url = @@SERVICE_URL_PRODUCTION + '/Sale/'
|
219
|
+
elsif @serviceEnvironment == :sandbox
|
220
|
+
url = @@SERVICE_URL_SANDBOX + '/Sale/'
|
221
|
+
end
|
222
|
+
postRequest(saleHash.to_json, url)
|
211
223
|
end
|
212
224
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
225
|
+
# permite forcar a retentativa manualmente de uma transacao (podendo ser tambem uma recorrencia) nao autorizada
|
226
|
+
def Retry(retrySaleRequest)
|
227
|
+
saleHash = retrySaleRequest.to_json
|
228
|
+
saleHash['RetrySaleCreditCardTransactionCollection'] = []
|
229
|
+
|
230
|
+
begin
|
231
|
+
if retrySaleRequest.RetrySaleCreditCardTransactionCollection != nil
|
232
|
+
retrySaleRequest.RetrySaleCreditCardTransactionCollection.each do |retrySale|
|
233
|
+
r = retrySale.to_json
|
234
|
+
saleHash['RetrySaleCreditCardTransactionCollection'] << r
|
235
|
+
end
|
236
|
+
end
|
237
|
+
if retrySaleRequest.Options.to_json.any?
|
238
|
+
retry_options = retrySaleRequest.Options.to_json
|
239
|
+
saleHash['Options'] = retry_options
|
240
|
+
else
|
241
|
+
saleHash['Options'] = nil
|
242
|
+
end
|
243
|
+
rescue Exception => e
|
244
|
+
return e.message
|
245
|
+
end
|
246
|
+
if @serviceEnvironment == :staging
|
247
|
+
url = @@SERVICE_URL_STAGING + '/Sale/Retry'
|
248
|
+
elsif @serviceEnvironment == :production
|
249
|
+
url = @@SERVICE_URL_PRODUCTION + '/Sale/Retry'
|
250
|
+
elsif @serviceEnvironment == :sandbox
|
251
|
+
url = @@SERVICE_URL_SANDBOX + '/Sale/Retry'
|
252
|
+
end
|
253
|
+
postRequest(saleHash.to_json, url)
|
219
254
|
end
|
220
|
-
postRequest(saleHash.to_json, url)
|
221
|
-
end
|
222
255
|
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
256
|
+
# eh uma forma de desfazer uma transação com cartao de credito mesmo a transacao sendo capturada
|
257
|
+
def Cancel(cancelSaleRequest)
|
258
|
+
saleHash = cancelSaleRequest.to_json
|
259
|
+
saleHash['CreditCardTransactionCollection'] = []
|
227
260
|
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
261
|
+
begin
|
262
|
+
if cancelSaleRequest.CreditCardTransactionCollection != nil
|
263
|
+
cancelSaleRequest.CreditCardTransactionCollection.each do |creditCard|
|
264
|
+
c = creditCard.to_json
|
265
|
+
saleHash['CreditCardTransactionCollection'] << c
|
266
|
+
end
|
233
267
|
end
|
268
|
+
rescue Exception => e
|
269
|
+
return e.message
|
234
270
|
end
|
235
|
-
if
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
271
|
+
if @serviceEnvironment == :staging
|
272
|
+
url = @@SERVICE_URL_STAGING + '/Sale/Cancel'
|
273
|
+
elsif @serviceEnvironment == :production
|
274
|
+
url = @@SERVICE_URL_PRODUCTION + '/Sale/Cancel'
|
275
|
+
elsif @serviceEnvironment == :sandbox
|
276
|
+
url = @@SERVICE_URL_SANDBOX + '/Sale/Cancel'
|
240
277
|
end
|
241
|
-
|
242
|
-
return e.message
|
243
|
-
end
|
244
|
-
if @serviceEnvironment == :staging
|
245
|
-
url = @@SERVICE_URL_STAGING + '/Sale/Retry'
|
246
|
-
elsif @serviceEnvironment == :production
|
247
|
-
url = @@SERVICE_URL_PRODUCTION + '/Sale/Retry'
|
248
|
-
elsif @serviceEnvironment == :sandbox
|
249
|
-
url = @@SERVICE_URL_SANDBOX + '/Sale/Retry'
|
278
|
+
postRequest(saleHash.to_json, url)
|
250
279
|
end
|
251
|
-
postRequest(saleHash.to_json, url)
|
252
|
-
end
|
253
280
|
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
281
|
+
# confirmacao de uma transacao de cartao de credito que ja fora autorizada
|
282
|
+
def Capture(captureRequest)
|
283
|
+
saleHash = captureRequest.to_json
|
284
|
+
saleHash['CreditCardTransactionCollection'] = []
|
258
285
|
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
286
|
+
begin
|
287
|
+
if captureRequest.CreditCardTransactionCollection != nil
|
288
|
+
captureRequest.CreditCardTransactionCollection.each do |creditCard|
|
289
|
+
c = creditCard.to_json
|
290
|
+
saleHash['CreditCardTransactionCollection'] << c
|
291
|
+
end
|
264
292
|
end
|
293
|
+
rescue Exception => e
|
294
|
+
return e.message
|
265
295
|
end
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
url = @@SERVICE_URL_SANDBOX + '/Sale/Cancel'
|
296
|
+
if @serviceEnvironment == :staging
|
297
|
+
url = @@SERVICE_URL_STAGING + '/Sale/Capture'
|
298
|
+
elsif @serviceEnvironment == :production
|
299
|
+
url = @@SERVICE_URL_PRODUCTION + '/Sale/Capture'
|
300
|
+
elsif @serviceEnvironment == :sandbox
|
301
|
+
url = @@SERVICE_URL_SANDBOX + '/Sale/Capture'
|
302
|
+
end
|
303
|
+
postRequest(saleHash.to_json, url)
|
275
304
|
end
|
276
|
-
postRequest(saleHash.to_json, url)
|
277
|
-
end
|
278
305
|
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
306
|
+
# faz um parse do xml de post notificaton
|
307
|
+
def ParseXmlToNotification(xml)
|
308
|
+
begin
|
309
|
+
response = PostNotification.ParseNotification(xml)
|
310
|
+
rescue Exception => err
|
311
|
+
return err.message
|
312
|
+
end
|
313
|
+
|
314
|
+
return response
|
315
|
+
end
|
283
316
|
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
317
|
+
# faz uma requisicao e retorna uma string com o transaction report file
|
318
|
+
def TransactionReportFile(date)
|
319
|
+
begin
|
320
|
+
if @serviceEnvironment == :staging
|
321
|
+
url = @@SERVICE_URL_NOTIFICATION_PRODUCTION + date.strftime("%Y%m%d")
|
322
|
+
elsif @serviceEnvironment == :production
|
323
|
+
url = @@SERVICE_URL_NOTIFICATION_PRODUCTION + date.strftime("%Y%m%d")
|
324
|
+
elsif @serviceEnvironment == :sandbox
|
325
|
+
url = @@SERVICE_URL_NOTIFICATION_SANDBOX + date.strftime("%Y%m%d")
|
289
326
|
end
|
327
|
+
|
328
|
+
response = getReportFile(url)
|
329
|
+
|
330
|
+
rescue RestClient::ExceptionWithResponse => err
|
331
|
+
return err.response
|
290
332
|
end
|
291
|
-
|
292
|
-
return e.message
|
333
|
+
return response
|
293
334
|
end
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
335
|
+
|
336
|
+
# faz o download do transaction report file e salva no computador em .txt
|
337
|
+
def TransactionReportFileDownloader(date, file_name, path)
|
338
|
+
begin
|
339
|
+
path = path + file_name + '.txt'
|
340
|
+
|
341
|
+
response = TransactionReportFile(date)
|
342
|
+
|
343
|
+
File.write(path, response)
|
344
|
+
rescue RestClient::ExceptionWithResponse => err
|
345
|
+
return err.response
|
346
|
+
end
|
300
347
|
end
|
301
|
-
postRequest(saleHash.to_json, url)
|
302
|
-
end
|
303
348
|
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
349
|
+
# faz o parse da string recebida do transaction report file e retorna um hash
|
350
|
+
def TransactionReportFileParser(file_to_parse)
|
351
|
+
transaction_report_file = TransactionReportFile.new
|
352
|
+
begin
|
353
|
+
response = transaction_report_file.TransactionReportFileParser(file_to_parse)
|
354
|
+
rescue Exception => err
|
355
|
+
return err
|
356
|
+
end
|
357
|
+
return response
|
310
358
|
end
|
311
359
|
|
312
|
-
|
313
|
-
|
360
|
+
# DEPRECATED
|
361
|
+
def InstantBuyKey(instant_buy_key)
|
362
|
+
GetCreditCard(instant_buy_key)
|
363
|
+
end
|
364
|
+
deprecate :InstantBuyKey, :GetCreditCard, 2016, 04
|
314
365
|
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
366
|
+
# DEPRECATED
|
367
|
+
def BuyerKey(buyer_key)
|
368
|
+
GetCreditCardWithBuyerKey(buyer_key)
|
369
|
+
end
|
370
|
+
deprecate :BuyerKey, :GetCreditCardWithBuyerKey, 2016, 04
|
371
|
+
|
372
|
+
# faz um get credit card com buyer key
|
373
|
+
def GetCreditCardWithBuyerKey(buyer_key)
|
374
|
+
# try, tenta fazer o request
|
375
|
+
begin
|
376
|
+
|
377
|
+
# se for homologacao faz a chamada por aqui
|
378
|
+
if @serviceEnvironment == :staging
|
379
|
+
response = getRequest(@@SERVICE_URL_STAGING + '/CreditCard/BuyerKey=' + buyer_key)
|
380
|
+
|
381
|
+
# se for producao, faz a chamada por aqui
|
382
|
+
elsif @serviceEnvironment == :production
|
383
|
+
response = getRequest(@@SERVICE_URL_PRODUCTION + '/CreditCard/BuyerKey=' + buyer_key)
|
384
|
+
|
385
|
+
# se for sandbox, faz a chamada por aqui
|
386
|
+
elsif @serviceEnvironment == :sandbox
|
387
|
+
response = getRequest(@@SERVICE_URL_SANDBOX + '/CreditCard/BuyerKey=' + buyer_key)
|
388
|
+
end
|
389
|
+
|
390
|
+
# se der algum erro, trata aqui
|
391
|
+
rescue Exception => e
|
392
|
+
return e.message
|
324
393
|
end
|
325
394
|
|
326
|
-
|
395
|
+
# se nao houver erros, retorna o objeto
|
396
|
+
response
|
397
|
+
end
|
327
398
|
|
328
|
-
|
329
|
-
|
399
|
+
# Faz um get no cartão de crédito
|
400
|
+
def GetCreditCard(instant_buy_key)
|
401
|
+
# try, tenta fazer o request
|
402
|
+
begin
|
403
|
+
# se for homologacao faz a chamada por aqui
|
404
|
+
if @serviceEnvironment == :staging
|
405
|
+
getRequest(@@SERVICE_URL_STAGING + '/CreditCard/' + instant_buy_key)
|
406
|
+
|
407
|
+
# se for producao, faz a chamada por aqui
|
408
|
+
elsif @serviceEnvironment == :production
|
409
|
+
getRequest(@@SERVICE_URL_PRODUCTION + '/CreditCard/' + instant_buy_key)
|
410
|
+
|
411
|
+
# se for sandbox
|
412
|
+
elsif @serviceEnvironment == :sandbox
|
413
|
+
getRequest(@@SERVICE_URL_SANDBOX + '/CreditCard/' + instant_buy_key)
|
414
|
+
end
|
415
|
+
|
416
|
+
# se der algum erro, trata aqui
|
417
|
+
rescue Exception => e
|
418
|
+
return e.message
|
419
|
+
end
|
330
420
|
end
|
331
|
-
return response
|
332
|
-
end
|
333
421
|
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
422
|
+
# Cria um cartão de crédito
|
423
|
+
def CreateCreditCard(create_instant_buy_data)
|
424
|
+
sale_hash = create_instant_buy_data.to_json
|
425
|
+
begin
|
426
|
+
if create_instant_buy_data.BillingAddress.to_json.any?
|
427
|
+
sale_hash['BillingAddress'] = create_instant_buy_data.BillingAddress.to_json
|
428
|
+
else
|
429
|
+
sale_hash['BillingAddress'] = nil
|
430
|
+
end
|
431
|
+
|
432
|
+
# se for homologacao faz a chamada por aqui
|
433
|
+
if @serviceEnvironment == :staging
|
434
|
+
url = @@SERVICE_URL_STAGING + '/CreditCard/'
|
435
|
+
|
436
|
+
# se for producao, faz a chamada por aqui
|
437
|
+
elsif @serviceEnvironment == :production
|
438
|
+
url = @@SERVICE_URL_PRODUCTION + '/CreditCard/'
|
338
439
|
|
339
|
-
|
440
|
+
# se for sandbox, faz a chamada por aqui
|
441
|
+
elsif @serviceEnvironment == :sandbox
|
442
|
+
url = @@SERVICE_URL_SANDBOX + '/CreditCard/'
|
443
|
+
end
|
444
|
+
|
445
|
+
response = postRequest(sale_hash.to_json, url)
|
340
446
|
|
341
|
-
|
342
|
-
|
343
|
-
|
447
|
+
# se der algum erro, trata aqui
|
448
|
+
rescue Exception => e
|
449
|
+
return e.message
|
450
|
+
end
|
451
|
+
# se nao houver erros, retorna o objeto
|
452
|
+
response
|
453
|
+
end
|
454
|
+
|
455
|
+
# Atualiza o cartão de crédito
|
456
|
+
def UpdateCreditCard(instant_buy_key, update_instant_buy_data_request)
|
457
|
+
begin
|
458
|
+
sale_hash = update_instant_buy_data_request.to_json
|
459
|
+
|
460
|
+
# se for homologacao faz a chamada por aqui
|
461
|
+
if @serviceEnvironment == :staging
|
462
|
+
url = @@SERVICE_URL_STAGING + '/CreditCard/' + instant_buy_key
|
463
|
+
|
464
|
+
# se for producao, faz a chamada por aqui
|
465
|
+
elsif @serviceEnvironment == :production
|
466
|
+
url = @@SERVICE_URL_PRODUCTION + '/CreditCard/' + instant_buy_key
|
467
|
+
|
468
|
+
# se for sandbox, faz a chamada por aqui
|
469
|
+
elsif @serviceEnvironment == :sandbox
|
470
|
+
url = @@SERVICE_URL_SANDBOX + '/CreditCard/' + instant_buy_key
|
471
|
+
end
|
472
|
+
|
473
|
+
response = patchRequest(sale_hash.to_json, url)
|
474
|
+
# se der algum erro, trata aqui
|
475
|
+
rescue Exception => e
|
476
|
+
return e.message
|
477
|
+
end
|
478
|
+
# se nao houver erros, retorna o objeto
|
479
|
+
response
|
344
480
|
end
|
345
|
-
end
|
346
481
|
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
482
|
+
# Deleta um cartão de crédito
|
483
|
+
def DeleteCreditCard(instant_buy_key)
|
484
|
+
# try, tenta fazer o request
|
485
|
+
begin
|
486
|
+
# se for homologacao faz a chamada por aqui
|
487
|
+
if @serviceEnvironment == :staging
|
488
|
+
deleteRequest(@@SERVICE_URL_STAGING + '/CreditCard/' + instant_buy_key)
|
489
|
+
|
490
|
+
# se for producao, faz a chamada por aqui
|
491
|
+
elsif @serviceEnvironment == :production
|
492
|
+
deleteRequest(@@SERVICE_URL_PRODUCTION + '/CreditCard/' + instant_buy_key)
|
493
|
+
|
494
|
+
# se for sandbox
|
495
|
+
elsif @serviceEnvironment == :sandbox
|
496
|
+
deleteRequest(@@SERVICE_URL_SANDBOX + '/CreditCard/' + instant_buy_key)
|
497
|
+
end
|
498
|
+
|
499
|
+
# se der algum erro, trata aqui
|
500
|
+
rescue Exception => e
|
501
|
+
return e.message
|
502
|
+
end
|
354
503
|
end
|
355
|
-
return response
|
356
|
-
end
|
357
504
|
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
505
|
+
# Busca um buyer
|
506
|
+
def GetBuyer(buyer_key)
|
507
|
+
# try, tenta fazer o request
|
508
|
+
begin
|
362
509
|
|
363
|
-
|
364
|
-
|
365
|
-
|
510
|
+
# se for homologacao faz a chamada por aqui
|
511
|
+
if @serviceEnvironment == :staging
|
512
|
+
response = getRequest(@@SERVICE_URL_STAGING + '/Buyer/' + buyer_key)
|
366
513
|
|
367
|
-
|
368
|
-
|
369
|
-
|
514
|
+
# se for producao, faz a chamada por aqui
|
515
|
+
elsif @serviceEnvironment == :production
|
516
|
+
response = getRequest(@@SERVICE_URL_PRODUCTION + '/Buyer/' + buyer_key)
|
370
517
|
|
371
|
-
|
372
|
-
|
373
|
-
|
518
|
+
# se for sandbox, faz a chamada por aqui
|
519
|
+
elsif @serviceEnvironment == :sandbox
|
520
|
+
response = getRequest(@@SERVICE_URL_SANDBOX + '/Buyer/' + buyer_key)
|
521
|
+
end
|
522
|
+
|
523
|
+
# se der algum erro, trata aqui
|
524
|
+
rescue Exception => e
|
525
|
+
return e.message
|
374
526
|
end
|
375
527
|
|
376
|
-
|
377
|
-
|
378
|
-
return e.message
|
528
|
+
# se nao houver erros, retorna o objeto
|
529
|
+
response
|
379
530
|
end
|
380
|
-
end
|
381
531
|
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
532
|
+
# Cria um buyer
|
533
|
+
def CreateBuyer(buyer_request)
|
534
|
+
sale_hash = buyer_request.to_json
|
535
|
+
sale_hash['AddressCollection'] = []
|
536
|
+
begin
|
537
|
+
if buyer_request.AddressCollection.any? == false || buyer_request.AddressCollection.nil?
|
538
|
+
sale_hash['AddressCollection'] = nil
|
539
|
+
else
|
540
|
+
buyer_request.AddressCollection.each do |address|
|
541
|
+
a = address.to_json
|
542
|
+
sale_hash['AddressCollection'] << a
|
543
|
+
end
|
544
|
+
end
|
545
|
+
|
546
|
+
# se for homologacao faz a chamada por aqui
|
547
|
+
if @serviceEnvironment == :staging
|
548
|
+
url = @@SERVICE_URL_STAGING + '/Buyer/'
|
386
549
|
|
387
|
-
|
388
|
-
|
389
|
-
|
550
|
+
# se for producao, faz a chamada por aqui
|
551
|
+
elsif @serviceEnvironment == :production
|
552
|
+
url = @@SERVICE_URL_PRODUCTION + '/Buyer/'
|
390
553
|
|
391
|
-
|
392
|
-
|
393
|
-
|
554
|
+
# se for sandbox, faz a chamada por aqui
|
555
|
+
elsif @serviceEnvironment == :sandbox
|
556
|
+
url = @@SERVICE_URL_SANDBOX + '/Buyer/'
|
557
|
+
end
|
394
558
|
|
395
|
-
|
396
|
-
|
397
|
-
|
559
|
+
response = postRequest(sale_hash.to_json, url)
|
560
|
+
rescue Exception => e
|
561
|
+
return e.message
|
398
562
|
end
|
563
|
+
response
|
564
|
+
end
|
399
565
|
|
400
|
-
|
401
|
-
|
402
|
-
|
566
|
+
# funcao de post generica
|
567
|
+
def postRequest(payload, url)
|
568
|
+
response = nil
|
569
|
+
begin
|
570
|
+
response = RestClient.post(url, payload, headers=@@SERVICE_HEADERS)
|
571
|
+
rescue RestClient::ExceptionWithResponse => err
|
572
|
+
return err.response
|
573
|
+
end
|
574
|
+
json_response = JSON.load response
|
575
|
+
json_response
|
403
576
|
end
|
404
577
|
|
405
|
-
#
|
406
|
-
|
407
|
-
|
578
|
+
# funcao patch generica
|
579
|
+
def patchRequest(payload, url)
|
580
|
+
begin
|
581
|
+
response = RestClient.patch(url, payload, headers=@@SERVICE_HEADERS)
|
582
|
+
rescue RestClient::ExceptionWithResponse => err
|
583
|
+
return err.response
|
584
|
+
end
|
585
|
+
json_response = JSON.load response
|
586
|
+
json_response
|
587
|
+
end
|
408
588
|
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
589
|
+
# funcao de delete generica
|
590
|
+
def deleteRequest(url)
|
591
|
+
begin
|
592
|
+
response = RestClient.delete(url, headers=@@SERVICE_HEADERS)
|
593
|
+
rescue RestClient::ExceptionWithResponse => err
|
594
|
+
return err.response
|
595
|
+
end
|
596
|
+
json_response = JSON.load response
|
597
|
+
json_response
|
416
598
|
end
|
417
|
-
json_response = JSON.load response
|
418
|
-
json_response
|
419
|
-
end
|
420
599
|
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
600
|
+
# funcao get generica
|
601
|
+
def getRequest(url)
|
602
|
+
response = nil
|
603
|
+
begin
|
604
|
+
response = RestClient.get(url, headers=@@SERVICE_HEADERS)
|
605
|
+
rescue RestClient::ExceptionWithResponse => err
|
606
|
+
return err.response
|
607
|
+
end
|
608
|
+
json_response = JSON.load response
|
609
|
+
json_response
|
428
610
|
end
|
429
|
-
json_response = JSON.load response
|
430
|
-
json_response
|
431
|
-
end
|
432
611
|
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
612
|
+
def getReportFile(url)
|
613
|
+
begin
|
614
|
+
response = RestClient.get(url, headers={:MerchantKey => "#{@merchantKey}"})
|
615
|
+
rescue RestClient::ExceptionWithResponse => err
|
616
|
+
return err.response
|
617
|
+
end
|
618
|
+
return response
|
438
619
|
end
|
439
|
-
return response
|
440
620
|
end
|
441
621
|
end
|