midas_client 0.2.1 → 0.2.13b
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 +5 -5
- data/README.md +86 -3
- data/lib/midas_client/endpoints.rb +32 -6
- data/lib/midas_client/management.rb +44 -11
- data/lib/midas_client/query.rb +644 -33
- data/lib/midas_client/request.rb +17 -2
- data/lib/midas_client/subscription.rb +183 -13
- data/lib/midas_client/transaction.rb +95 -0
- data/lib/midas_client/util.rb +4 -0
- data/lib/midas_client/version.rb +1 -1
- data/lib/midas_client.rb +2 -2
- metadata +5 -7
- data/lib/midas_client/billet.rb +0 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 090f3103f5ed5d6f9fd6a2578bdf671fe12879d23c225b8b90ebab7b6ffe74bf
|
|
4
|
+
data.tar.gz: 1a51aeb74e81ae0e9aaaee7aae55a6e6e2ea330632fa637b2333029fef0040c1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8cb670ccea8c260516745c97a108b9514632ef48e6876279aa54aef10a7110d2f1dbcae9917682d6334ef92e39f91c68f4be4e1636b7de28ba8b8a9a9c28db24
|
|
7
|
+
data.tar.gz: 94dc48e1d3237f4f115dc7bcb6ea11ee1747c8c3b3dfa35faaad99f7a9b8fe0e893a01ed038bdf410c59460072a694865dfd0b0b92116b0a02b05dc5f43c6ac7
|
data/README.md
CHANGED
|
@@ -33,8 +33,10 @@ Use client as follow:
|
|
|
33
33
|
|
|
34
34
|
Request
|
|
35
35
|
|
|
36
|
-
$
|
|
37
|
-
$ transaction.card_store({"externalId":"teste_midas_client_00002", "pan":"5529525900844124", "expirationMonth":"01", "expirationYear":"2021", "holderName":"TESTE MIDAS CLIENT", "customer":{ "documentType":"CPF", "documentNumber":"36549450152"}})
|
|
36
|
+
$ request = MidasClient::Request.new('testes-01','/eFRsg8RLne+I0GlECQofYvnsDfb0w==', 'DEVELOPMENT')
|
|
37
|
+
$ request.transaction.card_store({"externalId":"teste_midas_client_00002", "pan":"5529525900844124", "expirationMonth":"01", "expirationYear":"2021", "holderName":"TESTE MIDAS CLIENT", "customer":{ "documentType":"CPF", "documentNumber":"36549450152"}})
|
|
38
|
+
$ request.subscription.cancel_subscription("subscription_token_00002")
|
|
39
|
+
$ request.query.list_customers
|
|
38
40
|
|
|
39
41
|
Response
|
|
40
42
|
|
|
@@ -42,7 +44,88 @@ Response
|
|
|
42
44
|
$ [17/05/2017 20:48:06.103][RESPONSE] {:result=>{:success=>true, :code=>"010", :message=>"O cartao jah foi armazenado anteriormente"}, :brand=>"MASTER", :cardToken=>"f887d732863eb3ef2e45c0bd8b57ed33"}
|
|
43
45
|
|
|
44
46
|
## Change Releases
|
|
45
|
-
VERSION - 0.2.
|
|
47
|
+
VERSION - 0.2.13a - 2018/07/23
|
|
48
|
+
|
|
49
|
+
- changing MidasClient::Endpopoints - Sandbox endpoint has changed to
|
|
50
|
+
|
|
51
|
+
VERSION - 0.2.13 - 2018/07/12
|
|
52
|
+
|
|
53
|
+
- changing MidasClient::Endpopoints
|
|
54
|
+
|
|
55
|
+
VERSION - 0.2.12 - 2018/06/04
|
|
56
|
+
|
|
57
|
+
- Operation MidasClient::Subscription.invoice_external_payment(invoice_token, payment_date, payment_voucher) - associate an external payment to an invoice
|
|
58
|
+
- Removing operation MidasClient::Subscription.subscription_transactions(subscription_token)
|
|
59
|
+
|
|
60
|
+
VERSION - 0.2.11 - 2018/05/11
|
|
61
|
+
|
|
62
|
+
- Operation MidasClient::Management.list_pos - removal of param 'auth', now uses management_auth from env endpoints
|
|
63
|
+
- Operation MidasClient::Management.create_pos - removal of param 'auth', now uses management_auth from env endpoints
|
|
64
|
+
- Operation MidasClient::Management.pos_details - removal of param 'auth', now uses management_auth from env endpoints
|
|
65
|
+
|
|
66
|
+
VERSION - 0.2.10 - 2018/03/30
|
|
67
|
+
|
|
68
|
+
- Operation MidasClient::Subscription.invoice_cancel(token) - cancel a subscription's invoice.
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
VERSION - 0.2.9 - 2018/03/20
|
|
72
|
+
|
|
73
|
+
- Operation MidasClient::Subscription.renew(token, params) - renew a subscription increasing the number of invoices associated.
|
|
74
|
+
- Operation MidasClient::Transaction.create_billet(params) - create a billet to be payed.
|
|
75
|
+
- Operation MidasClient::Transaction.print_billet(token) - print a billet to be payed.
|
|
76
|
+
|
|
77
|
+
VERSION - 0.2.8 - 2018/02/06
|
|
78
|
+
|
|
79
|
+
- Operation MidasClient::Management.pos_details(midas_login) to return a POS' details like list of card brands allowed
|
|
80
|
+
- Operation MidasClient::Query.invoices_by_expiration_date(start_date, end_date, status) to return all invoices by expiration date
|
|
81
|
+
- Operation MidasClient::Query.invoices_by_payment_date(start_date, end_date, status) to return all invoices by payment date
|
|
82
|
+
|
|
83
|
+
VERSION - 0.2.7 - 2018/01/25
|
|
84
|
+
|
|
85
|
+
- Improving MidasClient::Subscription.create to create a manual subscription when de cardToken is not informed
|
|
86
|
+
- Implementing an invoice payment operation - MidasClient::Subscription.invoice_payment(invoice_token, transaction_token)
|
|
87
|
+
- Query to summarizes all card's transactions by date - MidasClient::Query.cards_summary_by_day(start_date, end_date)
|
|
88
|
+
- Query to summarizes all card's transactions by month - MidasClient::Query.cards_summary_by_month(start_month, start_year, end_month, end_year)
|
|
89
|
+
- Query to summarizes all billet's transactions by date - MidasClient::Query.cards_summary_by_day(start_date, end_date)
|
|
90
|
+
- Query to summarizes all billet's transactions by month - MidasClient::Query.cards_summary_by_month(start_month, start_year, end_month, end_year)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
VERSION - 0.2.6 - 2017/11/17
|
|
94
|
+
|
|
95
|
+
- Query to list all transactions from an invoice's token - MidasClient::Subscription.invoice_transactions(invoiceToken)
|
|
96
|
+
- Query to list all transactions from a subscription's token - MidasClient::Subscription.subscription_transactions(subscriptionToken)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
VERSION - 0.2.5 - 2017/11/11
|
|
100
|
+
|
|
101
|
+
- Query to list transactions from an user's document - MidasClient::Query.transactions_by_customer(document_type, document_number, status)
|
|
102
|
+
- Query to list subscriptions from an user's document - MidasClient::Query.subscriptions_by_customer(document_type, document_number, status)
|
|
103
|
+
- Query to list invoices from a Point of Sale - MidasClient::Query.invoices(start_date, end_date, status))
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
VERSION - 0.2.4 - 2017/11/01
|
|
107
|
+
|
|
108
|
+
- Refactoring QUERIES CONSTANT to QUERY
|
|
109
|
+
- Query to list creditcards from a Point of Sale (MidasClient::Query.list_creditcards)
|
|
110
|
+
- Query to list creditcards from user's document number (MidasClient::Transation.query_user_cards)
|
|
111
|
+
- Query to list transactions by an array of external ids (MidasClient::Query.by_external_ids)
|
|
112
|
+
- Query to list transactions by an array of transaction tokens (MidasClient::Query.by_transaction_tokens)
|
|
113
|
+
- Query to list customers from de POint of Sale (MidasClient::Query.list_customers)
|
|
114
|
+
- Access attributes at Request to acess all subclasses from Request as singleton methods
|
|
115
|
+
- Refactoring class Queries name to Query
|
|
116
|
+
- read.me
|
|
117
|
+
|
|
118
|
+
VERSION - 0.2.3 - 2017/10/25
|
|
119
|
+
|
|
120
|
+
- Bug fix at MidasClient::Subscription.subscription_update
|
|
121
|
+
- read.me
|
|
122
|
+
|
|
123
|
+
VERSION - 0.2.2 - 2017/10/16
|
|
124
|
+
|
|
125
|
+
- Query to return all subscritions for a Point Of Sale at module Query.
|
|
126
|
+
- read.me
|
|
127
|
+
|
|
128
|
+
VERSION - 0.2.1 - 2017/10/11
|
|
46
129
|
|
|
47
130
|
- Changing Development API endpoint
|
|
48
131
|
- read.me
|
|
@@ -15,7 +15,7 @@ module MidasClient
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def get_environment
|
|
18
|
-
get_env
|
|
18
|
+
self.get_env
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
# alias for get_environment
|
|
@@ -38,37 +38,63 @@ module MidasClient
|
|
|
38
38
|
store: '/creditcard',
|
|
39
39
|
synchronous_transaction: '/transaction/creditcard',
|
|
40
40
|
asynchronous_transaction: '/transaction/creditcard/dispatch',
|
|
41
|
+
asynchronous_debit_transaction: '/transaction/debitcard',
|
|
41
42
|
authorize: '/transaction/creditcard/authorize',
|
|
42
43
|
confirm: '/transaction/creditcard/{transactionToken}/capture',
|
|
43
44
|
cancel: '/transaction/creditcard/{transactionToken}/cancel',
|
|
44
45
|
refund: '/transaction/creditcard/{transactionToken}/refund',
|
|
45
46
|
query_by_transaction: '/transaction/{transactionToken}',
|
|
46
|
-
callback: '
|
|
47
|
+
callback: 'https://checkout.express/callback',
|
|
48
|
+
cards_by_user: '/customer/{documentType}/{documentNumber}/creditcard',
|
|
49
|
+
create_billet: '/transaction/bankbillet/',
|
|
50
|
+
print_billet: '/transaction/bankbillet/{transactionToken}'
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
SUBSCRIPTIONS = {
|
|
50
54
|
context: '/midas-core/v2',
|
|
51
55
|
by_token: '/subscription/{subscriptionToken}',
|
|
52
56
|
invoices: '/subscription/{subscriptionToken}/invoices',
|
|
57
|
+
invoices_renew: '/subscription/{subscriptionToken}/invoices',
|
|
53
58
|
invoice_transactions: '/invoice/{invoiceToken}/transactions',
|
|
54
|
-
|
|
59
|
+
invoice_payment: '/invoice/{invoiceToken}/pay',
|
|
60
|
+
invoice_external_payment:'invoice/{invoiceToken}/pay/external',
|
|
61
|
+
invoice_cancel: '/invoice/{invoiceToken}/cancel',
|
|
62
|
+
subscription_transactions: '/subscription/{subscriptionToken}/transactions',
|
|
63
|
+
create_manual: '/subscription/',
|
|
64
|
+
create_recurrent: '/subscription/creditcard',
|
|
55
65
|
cancel: '/subscription/{subscriptionToken}/cancel',
|
|
66
|
+
renew: '/subscription/{subscriptionToken}/renew',
|
|
56
67
|
update: '/subscription/{subscriptionToken}',
|
|
57
68
|
update_card: '/subscription/{subscriptionToken}/payment-method/creditcard',
|
|
58
69
|
update_invoice: '/invoice/{invoiceToken}',
|
|
59
|
-
callback: 'https://
|
|
70
|
+
callback: 'https://checkout.express/callback',
|
|
60
71
|
}
|
|
61
72
|
|
|
62
73
|
QUERIES = {
|
|
63
74
|
context: '/midas-query/v2',
|
|
64
75
|
by_external_id: '/transactions/external-id/{externalId}',
|
|
65
|
-
|
|
76
|
+
by_external_ids: '/transactions/external-ids',
|
|
77
|
+
by_transaction_tokens: '/transactions/transaction-tokens',
|
|
78
|
+
by_period: '/transactions?startDate={startDate}&endDate={endDate}&status={status}&type={type}',
|
|
79
|
+
subscriptions: "/subscriptions?status={status}",
|
|
80
|
+
invoices_by_expiration_date: '/invoices/expiration-date?startDate={startDate}&endDate={endDate}&status={status}',
|
|
81
|
+
invoices_by_payment_date: '/invoices/payment-date?startDate={startDate}&endDate={endDate}&status={status}',
|
|
82
|
+
creditcards: '/creditcards',
|
|
83
|
+
customers: '/customers',
|
|
84
|
+
transactions_by_customer: '/transactions/customer?documentType={documentType}&documentNumber={documentNumber}&status={status}',
|
|
85
|
+
subscriptions_by_customer: '/subscriptions?documentType={documentType}&documentNumber={documentNumber}&status={status}',
|
|
86
|
+
|
|
87
|
+
cards_summary_by_day: '/summary/transactions/card/daily?startDate={startDate}&endDate={endDate}',
|
|
88
|
+
billets_summary_by_day: '/summary/transactions/bank/daily?startDate={startDate}&endDate={endDate}',
|
|
89
|
+
cards_summary_by_month: '/summary/transactions/card/monthly?startMonth={startMonth}&startYear={startYear}&endMonth={endMonth}&endYear={endYear}',
|
|
90
|
+
billets_summary_by_month: '/summary/transactions/bank/monthly?startMonth={startMonth}&startYear={startYear}&endMonth={endMonth}&endYear={endYear}',
|
|
66
91
|
}
|
|
67
92
|
|
|
68
93
|
MANAGEMENTS = {
|
|
69
94
|
context: '/midas-managment/v2',
|
|
70
95
|
create_pos: '/pointofsale',
|
|
71
|
-
list_pos: '/pointofsale'
|
|
96
|
+
list_pos: '/pointofsale',
|
|
97
|
+
pos_details: '/pointofsale/{midasLogin}'
|
|
72
98
|
}
|
|
73
99
|
|
|
74
100
|
end
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
module MidasClient
|
|
2
|
-
class Management
|
|
2
|
+
class Management
|
|
3
|
+
include Util
|
|
4
|
+
include RestClient
|
|
3
5
|
|
|
4
6
|
#= This method LIST all POS in MIDAS.
|
|
5
7
|
# This is a is synchronous operation, using method GET
|
|
6
8
|
#
|
|
7
9
|
# Params:
|
|
8
|
-
#
|
|
10
|
+
# auth: Base 64 authorization token
|
|
11
|
+
# env: Base 64 authorization token
|
|
9
12
|
#
|
|
10
13
|
#
|
|
11
14
|
# Response:
|
|
@@ -27,18 +30,22 @@ module MidasClient
|
|
|
27
30
|
# }]
|
|
28
31
|
# }
|
|
29
32
|
#
|
|
30
|
-
def self.list_pos()
|
|
33
|
+
def self.list_pos(environment='DEVELOPMENT')
|
|
31
34
|
# define o método de envio da requisição
|
|
32
35
|
method = :get
|
|
33
36
|
|
|
37
|
+
# define o ambiente de execução
|
|
38
|
+
_env = environment.upcase == 'PRODUCTION' ? EndPoints::PRODUCTION : EndPoints::DEVELOPMENT
|
|
39
|
+
|
|
34
40
|
# monta a URL de chamada da requisição
|
|
35
|
-
endpoint =
|
|
41
|
+
endpoint = _env[:url] + EndPoints::MANAGEMENTS[:context] + EndPoints::MANAGEMENTS[:list_pos]
|
|
36
42
|
|
|
37
43
|
# monta authorization base64 no header
|
|
38
|
-
headers={content_type: :json, accept: :json, authorization: get_env[:management_auth]}
|
|
44
|
+
#headers={content_type: :json, accept: :json, authorization: get_env[:management_auth]}
|
|
45
|
+
headers={content_type: :json, accept: :json, authorization: _env[:management_auth]}
|
|
39
46
|
|
|
40
47
|
# faz a chamada a plataforma de pagamento (MIDAS)
|
|
41
|
-
external_request(method, endpoint, {}, headers)
|
|
48
|
+
Request.external_request(method, endpoint, {}, headers)
|
|
42
49
|
|
|
43
50
|
end
|
|
44
51
|
|
|
@@ -46,6 +53,7 @@ module MidasClient
|
|
|
46
53
|
# This is a is synchronous operation, using method POST
|
|
47
54
|
#
|
|
48
55
|
# Params:
|
|
56
|
+
# auth: Base 64 authorization token
|
|
49
57
|
# code: string - Represents the name of the POS
|
|
50
58
|
# description: string - Description about the POS
|
|
51
59
|
#
|
|
@@ -58,22 +66,47 @@ module MidasClient
|
|
|
58
66
|
# },
|
|
59
67
|
# accessToken: "3Lpv2ecaeBa4Kffuf0CbWfF1j6I5eg=="
|
|
60
68
|
#
|
|
61
|
-
def self.create_pos(code, description)
|
|
69
|
+
def self.create_pos(code, description, environment= 'DEVELOPMENT')
|
|
62
70
|
# define o método de envio da requisição
|
|
63
71
|
method = :post
|
|
64
72
|
|
|
73
|
+
# define o ambiente de execução
|
|
74
|
+
_env = environment.upcase == 'PRODUCTION' ? EndPoints::PRODUCTION : EndPoints::DEVELOPMENT
|
|
75
|
+
|
|
65
76
|
# monta a URL de chamada da requisição
|
|
66
|
-
endpoint =
|
|
77
|
+
endpoint = _env[:url] + EndPoints::MANAGEMENTS[:context] + EndPoints::MANAGEMENTS[:create_pos]
|
|
67
78
|
|
|
68
79
|
# monta os parâmetros da requisição na url
|
|
69
80
|
params = { code: code, description: description}
|
|
70
81
|
|
|
71
82
|
# monta authorization base64 no header
|
|
72
|
-
headers={content_type: :json, accept: :json, authorization: get_env[:management_auth]}
|
|
83
|
+
#headers={content_type: :json, accept: :json, authorization: get_env[:management_auth]}
|
|
84
|
+
headers={content_type: :json, accept: :json, authorization: _env[:management_auth]}
|
|
73
85
|
|
|
74
86
|
# faz a chamada a plataforma de pagamento (MIDAS)
|
|
75
|
-
external_request(method, endpoint, params, headers)
|
|
87
|
+
Request.external_request(method, endpoint, params, headers)
|
|
88
|
+
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# retorna os detalhes de um PDV
|
|
92
|
+
def self.pos_details(midas_login, environment= 'DEVELOPMENT')
|
|
93
|
+
# define o método de envio da requisição
|
|
94
|
+
method = :get
|
|
95
|
+
|
|
96
|
+
# define o ambiente de execução
|
|
97
|
+
_env = environment.upcase == 'PRODUCTION' ? EndPoints::PRODUCTION : EndPoints::DEVELOPMENT
|
|
76
98
|
|
|
99
|
+
# monta a URL de chamada da requisição
|
|
100
|
+
endpoint = _env[:url] + EndPoints::MANAGEMENTS[:context] + EndPoints::MANAGEMENTS[:pos_details].gsub("{midasLogin}", midas_login)
|
|
101
|
+
|
|
102
|
+
# monta os parâmetros da requisição na url
|
|
103
|
+
params = { }
|
|
104
|
+
|
|
105
|
+
# monta authorization base64 no header
|
|
106
|
+
headers={content_type: :json, accept: :json, authorization: _env[:management_auth]}
|
|
107
|
+
|
|
108
|
+
# faz a chamada a plataforma de pagamento (MIDAS)
|
|
109
|
+
Request.external_request(method, endpoint, params, headers)
|
|
77
110
|
end
|
|
78
111
|
end
|
|
79
|
-
end
|
|
112
|
+
end
|