maxipago_api 0.1.1 → 0.1.6
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 +3 -2
- data/lib/maxipago_api/models/credit_card_model.rb +16 -15
- data/lib/maxipago_api/models/customer_model.rb +9 -3
- data/lib/maxipago_api/models/transaction_model.rb +27 -2
- data/lib/maxipago_api/requests/credit_card_request.rb +11 -7
- data/lib/maxipago_api/requests/customer_request.rb +1 -1
- data/lib/maxipago_api/requests/transaction_request.rb +34 -0
- data/lib/maxipago_api/version.rb +1 -1
- data/maxipago_api-0.1.0.gem +0 -0
- data/maxipago_api-0.1.1.gem +0 -0
- data/maxipago_api-0.1.2.gem +0 -0
- data/maxipago_api-0.1.3.gem +0 -0
- data/maxipago_api-0.1.4.gem +0 -0
- data/maxipago_api-0.1.5.gem +0 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2074933a5a54f323510b5f3cf0c192771be86d754d28c102542f050339e43386
|
4
|
+
data.tar.gz: 32419c84f61b6ae9dd246543a82a1626bb25d0a43b09bc3b6d971be901f2f81e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbae861cda43e2d16fe68bfd7f83a880c2d113770d84390c7a2e03368b88039b31f0a7d4fbe4aa9c83c1754c4f30279d75a7a75f278132837b46e026390fd14c
|
7
|
+
data.tar.gz: 2394360776ac5f2e4a6871f039c9908829c9bdfee987c5d72733f707a10a4e9b72bb63542dcce983531578685c4a690a8414559df4f5e19e3a9b39b2450e3318
|
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, :
|
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
|
-
self.
|
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,3 +1,4 @@
|
|
1
|
+
require 'maxipago_api/requests/credit_card_request.rb'
|
1
2
|
module MaxipagoApi
|
2
3
|
class CreditCardModel
|
3
4
|
attr_accessor :customer_id, :credit_card_number, :expiration_month, :expiration_year,
|
@@ -6,23 +7,23 @@ module MaxipagoApi
|
|
6
7
|
:billing_email
|
7
8
|
|
8
9
|
def initialize(options = {})
|
9
|
-
self.customer_id =
|
10
|
-
self.credit_card_number =
|
11
|
-
self.expiration_month =
|
12
|
-
self.expiration_year =
|
13
|
-
self.billing_name =
|
14
|
-
self.billing_address1 =
|
15
|
-
self.billing_address2 =
|
16
|
-
self.billing_city =
|
17
|
-
self.billing_state =
|
18
|
-
self.billing_zipcode =
|
19
|
-
self.billing_country =
|
20
|
-
self.billing_phone =
|
21
|
-
self.billing_email =
|
10
|
+
self.customer_id = options[:customer_id]
|
11
|
+
self.credit_card_number = options[:credit_card_number]
|
12
|
+
self.expiration_month = options[:expiration_month]
|
13
|
+
self.expiration_year = options[:expiration_year]
|
14
|
+
self.billing_name = options[:billing_name]
|
15
|
+
self.billing_address1 = options[:billing_address1]
|
16
|
+
self.billing_address2 = options[:billing_address2]
|
17
|
+
self.billing_city = options[:billing_city]
|
18
|
+
self.billing_state = options[:billing_state]
|
19
|
+
self.billing_zipcode = options[:billing_zipcode]
|
20
|
+
self.billing_country = options[:billing_country]
|
21
|
+
self.billing_phone = options[:billing_phone]
|
22
|
+
self.billing_email = options[:billing_email]
|
22
23
|
end
|
23
24
|
|
24
25
|
def save
|
25
|
-
MaxipagoApi::CreditCardRequest.
|
26
|
+
MaxipagoApi::CreditCardRequest.save(self)
|
26
27
|
end
|
27
28
|
|
28
29
|
def to_object
|
@@ -40,7 +41,7 @@ module MaxipagoApi
|
|
40
41
|
billingCountry: self.billing_country,
|
41
42
|
billingPhone: self.billing_phone,
|
42
43
|
billingEmail: self.billing_email,
|
43
|
-
}
|
44
|
+
}.select{|k,v| v.present?}
|
44
45
|
end
|
45
46
|
end
|
46
47
|
end
|
@@ -28,15 +28,21 @@ 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
|
35
36
|
{
|
36
37
|
customerIdExt: self.customer_id_ext,
|
37
38
|
firstName: self.first_name,
|
38
|
-
lastName: self.last_name
|
39
|
-
|
39
|
+
lastName: self.last_name,
|
40
|
+
zip: self.zipcode,
|
41
|
+
email: self.email,
|
42
|
+
dob: self.sex,
|
43
|
+
ssn: self.document,
|
44
|
+
sex: self.sex
|
45
|
+
}.select{|k,v| v.present?}
|
40
46
|
end
|
41
47
|
end
|
42
48
|
end
|
@@ -1,8 +1,12 @@
|
|
1
|
+
require 'maxipago_api/requests/transaction_request.rb'
|
1
2
|
module MaxipagoApi
|
2
3
|
class TransactionModel
|
3
|
-
attr_accessor :
|
4
|
+
attr_accessor :customer_id, :token, :ip_address, :reference_number, :charge_total, :processor_id
|
4
5
|
def initialize(options = {})
|
5
|
-
self.
|
6
|
+
self.customer_id = options[:customer_id]
|
7
|
+
self.processor_id = options[:processor_id]
|
8
|
+
self.token = options[:token]
|
9
|
+
self.ip_address = options[:ip_address]
|
6
10
|
self.reference_number = options[:reference_number]
|
7
11
|
self.charge_total = options[:charge_total]
|
8
12
|
end
|
@@ -13,5 +17,26 @@ module MaxipagoApi
|
|
13
17
|
|
14
18
|
def find
|
15
19
|
end
|
20
|
+
|
21
|
+
def to_object
|
22
|
+
{
|
23
|
+
sale: {
|
24
|
+
processorID: self.processor_id,
|
25
|
+
referenceNum: self.reference_number,
|
26
|
+
transactionDetail: {
|
27
|
+
payType: {
|
28
|
+
onFile: {
|
29
|
+
customerId: self.customer_id,
|
30
|
+
token: self.token,
|
31
|
+
},
|
32
|
+
}
|
33
|
+
},
|
34
|
+
payment: {
|
35
|
+
currencyCode: 'BRL',
|
36
|
+
chargeTotal: self.charge_total
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}.select{|k,v| v.present?}
|
40
|
+
end
|
16
41
|
end
|
17
42
|
end
|
@@ -4,13 +4,17 @@ require "active_support/core_ext"
|
|
4
4
|
module MaxipagoApi
|
5
5
|
class CreditCardRequest
|
6
6
|
include HTTParty
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def save(credit_card)
|
10
|
+
xml = {
|
11
|
+
'verification' => {merchantId: MaxipagoApi.store_id, merchantKey: MaxipagoApi.store_key},
|
12
|
+
command: 'add-card-onfile',
|
13
|
+
request: credit_card.to_object
|
14
|
+
}.to_xml(root: 'api-request', skip_types: true)
|
15
|
+
response = post(MaxipagoApi.api_register_endpoint, body: xml, headers: {'Content-Type' => 'text/plain'})
|
16
|
+
Hash.from_xml(response.parsed_response)
|
17
|
+
end
|
14
18
|
end
|
15
19
|
end
|
16
20
|
end
|
@@ -10,7 +10,7 @@ module MaxipagoApi
|
|
10
10
|
'verification' => {merchantId: MaxipagoApi.store_id, merchantKey: MaxipagoApi.store_key},
|
11
11
|
command: 'add-consumer',
|
12
12
|
request: customer.to_object
|
13
|
-
}.to_xml(root: 'api-request')
|
13
|
+
}.to_xml(root: 'api-request', skip_types: true)
|
14
14
|
response = post(MaxipagoApi.api_register_endpoint, body: xml, headers: {'Content-Type' => 'text/plain'})
|
15
15
|
Hash.from_xml(response.parsed_response)
|
16
16
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'active_support'
|
3
|
+
require "active_support/core_ext"
|
4
|
+
module MaxipagoApi
|
5
|
+
class TransactionRequest
|
6
|
+
include HTTParty
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def create(transaction)
|
10
|
+
xml = {
|
11
|
+
'verification' => {merchantId: MaxipagoApi.store_id, merchantKey: MaxipagoApi.store_key},
|
12
|
+
version: '3.1.1.15',
|
13
|
+
order: transaction.to_object
|
14
|
+
}.to_xml(root: 'transaction-request', skip_types: true)
|
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)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/maxipago_api/version.rb
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
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.6
|
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-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -91,6 +91,12 @@ files:
|
|
91
91
|
- lib/maxipago_api/requests/transaction_request.rb
|
92
92
|
- lib/maxipago_api/responses/response_api.rb
|
93
93
|
- lib/maxipago_api/version.rb
|
94
|
+
- maxipago_api-0.1.0.gem
|
95
|
+
- maxipago_api-0.1.1.gem
|
96
|
+
- maxipago_api-0.1.2.gem
|
97
|
+
- maxipago_api-0.1.3.gem
|
98
|
+
- maxipago_api-0.1.4.gem
|
99
|
+
- maxipago_api-0.1.5.gem
|
94
100
|
- maxipago_api.gemspec
|
95
101
|
homepage: https://github.com/sidneip
|
96
102
|
licenses:
|