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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b65b599f6aef9ed3f2d3208d090691d1afc2040cff9aff5e549f308d3bc4fc12
4
- data.tar.gz: 50c80ba50caab3a25e0736f23b0296865fc91795c5df66c856d7467a9ab64b47
3
+ metadata.gz: 05582ac979e4c8c7eb1036813918dd64c8342ddc56692c8d07ffc3e7cd24bc9e
4
+ data.tar.gz: 9dab7dc69c963e1f3f7e9ce6100ae252a6f8d19d237aaa780d1da0304abe2fb5
5
5
  SHA512:
6
- metadata.gz: 165d2d155ae0b8f6e8e41f1bfb9e905e68c203c66c8e518b8def5b80cd02ec0c72eeb4df057beba0d647c56eb979ee2923c9286be7686fc7c80561583f7e4b57
7
- data.tar.gz: 2aaf02f89ae915e1740ed990ae130f318494baec48101540fd2015052b48ee0c627975505b33a2dc9bc6845b81ab38e6c37804695ee6e15f5dc3ed341012c692
6
+ metadata.gz: 74a36c34ffa1a0c2be329e9c6db8490a468637b8df2a920933c78c32c99e91a27895ebc3c0277211c30c4acbe0e6bafb56626b38a1a6c0f75a1d04bce6e24350
7
+ data.tar.gz: d3c482140f9581db241df4498438ad37d30bb9ac02932f8dbc3701e340ee4b0180aeaf9e42552ac46053d00e58e62465cd8838fca7975e173872359beef8af4c
@@ -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' ||
@@ -28,7 +28,8 @@ module MaxipagoApi
28
28
  MaxipagoApi::CustomerRequest.create(self)
29
29
  end
30
30
 
31
- def find
31
+ def self.find(id)
32
+ MaxipagoApi::CustomerRequest.find(id)
32
33
  end
33
34
 
34
35
  def to_object
@@ -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: 1,
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
@@ -1,3 +1,3 @@
1
1
  module MaxipagoApi
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
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.2
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-07 00:00:00.000000000 Z
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: