maxipago_api 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/maxipago_api.rb +2 -1
- data/lib/maxipago_api/models/customer_model.rb +2 -1
- data/lib/maxipago_api/models/transaction_model.rb +3 -2
- data/lib/maxipago_api/requests/transaction_request.rb +15 -0
- data/lib/maxipago_api/version.rb +1 -1
- data/maxipago_api-0.1.2.gem +0 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05582ac979e4c8c7eb1036813918dd64c8342ddc56692c8d07ffc3e7cd24bc9e
|
4
|
+
data.tar.gz: 9dab7dc69c963e1f3f7e9ce6100ae252a6f8d19d237aaa780d1da0304abe2fb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74a36c34ffa1a0c2be329e9c6db8490a468637b8df2a920933c78c32c99e91a27895ebc3c0277211c30c4acbe0e6bafb56626b38a1a6c0f75a1d04bce6e24350
|
7
|
+
data.tar.gz: d3c482140f9581db241df4498438ad37d30bb9ac02932f8dbc3701e340ee4b0180aeaf9e42552ac46053d00e58e62465cd8838fca7975e173872359beef8af4c
|
data/lib/maxipago_api.rb
CHANGED
@@ -7,12 +7,13 @@ require 'maxipago_api/requests/customer_request.rb'
|
|
7
7
|
module MaxipagoApi
|
8
8
|
class Error < StandardError; end
|
9
9
|
class << self
|
10
|
-
attr_accessor :api_register_endpoint, :api_transaction_endpoint, :store_id, :store_key
|
10
|
+
attr_accessor :api_register_endpoint, :api_transaction_endpoint, :api_reports_endpoint, :store_id, :store_key
|
11
11
|
end
|
12
12
|
self.store_key = ENV['MAXIPAGO_API_KEY']
|
13
13
|
self.store_id = ENV['MAXIPAGO_STORE_ID']
|
14
14
|
self.api_register_endpoint = 'https://testapi.maxipago.net/UniversalAPI/postAPI'
|
15
15
|
self.api_transaction_endpoint = 'https://testapi.maxipago.net/UniversalAPI/postXML'
|
16
|
+
self.api_reports_endpoint = 'https://testapi.maxipago.net/ReportsAPI/servlet/ReportsAPI'
|
16
17
|
|
17
18
|
def self.production?
|
18
19
|
ENV['RACK_ENV'] == 'production' ||
|
@@ -1,9 +1,10 @@
|
|
1
1
|
require 'maxipago_api/requests/transaction_request.rb'
|
2
2
|
module MaxipagoApi
|
3
3
|
class TransactionModel
|
4
|
-
attr_accessor :customer_id, :token, :ip_address, :reference_number, :charge_total
|
4
|
+
attr_accessor :customer_id, :token, :ip_address, :reference_number, :charge_total, :processor_id
|
5
5
|
def initialize(options = {})
|
6
6
|
self.customer_id = options[:customer_id]
|
7
|
+
self.processor_id = options[:processor_id]
|
7
8
|
self.token = options[:token]
|
8
9
|
self.ip_address = options[:ip_address]
|
9
10
|
self.reference_number = options[:reference_number]
|
@@ -20,7 +21,7 @@ module MaxipagoApi
|
|
20
21
|
def to_object
|
21
22
|
{
|
22
23
|
sale: {
|
23
|
-
processorID:
|
24
|
+
processorID: self.processor_id,
|
24
25
|
referenceNum: self.reference_number,
|
25
26
|
ipAddress: self.ip_address,
|
26
27
|
transactionDetail: {
|
@@ -13,6 +13,21 @@ module MaxipagoApi
|
|
13
13
|
order: transaction.to_object
|
14
14
|
}.to_xml(root: 'transaction-request', skip_types: true)
|
15
15
|
response = post(MaxipagoApi.api_transaction_endpoint, body: xml, headers: {'Content-Type' => 'text/plain'})
|
16
|
+
Hash.from_xml(response.parsed_response)
|
17
|
+
end
|
18
|
+
|
19
|
+
def find(id)
|
20
|
+
xml = {
|
21
|
+
'verification' => {merchantId: MaxipagoApi.store_id, merchantKey: MaxipagoApi.store_key},
|
22
|
+
command: 'transactionDetailReport',
|
23
|
+
request: {
|
24
|
+
filterOptions: {
|
25
|
+
transactionId: id
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}.to_xml(root: 'rapi-request', skip_types: true)
|
29
|
+
response = post(MaxipagoApi.api_reports_endpoint, body: xml, headers: {'Content-Type' => 'text/plain'})
|
30
|
+
Hash.from_xml(response.parsed_response)
|
16
31
|
end
|
17
32
|
end
|
18
33
|
end
|
data/lib/maxipago_api/version.rb
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maxipago_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sidnei Pacheco
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -93,6 +93,7 @@ files:
|
|
93
93
|
- lib/maxipago_api/version.rb
|
94
94
|
- maxipago_api-0.1.0.gem
|
95
95
|
- maxipago_api-0.1.1.gem
|
96
|
+
- maxipago_api-0.1.2.gem
|
96
97
|
- maxipago_api.gemspec
|
97
98
|
homepage: https://github.com/sidneip
|
98
99
|
licenses:
|