midas_client 0.2.4 → 0.2.14

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 81c854614d06fb0820ef6fde44ea13ee781266c7
4
- data.tar.gz: 1d40a8f4350905e685f539f619380fdfac92b7e3
2
+ SHA256:
3
+ metadata.gz: ae8a3dfc20f07cb2344ffcb6e87ba9990ae2c2fd98190bdae6b56d6eda075a5f
4
+ data.tar.gz: f16119be9aabbda951b05f7feed26f6cb9c197b9020f6ed275d1ef40a2a021df
5
5
  SHA512:
6
- metadata.gz: e9ee9daec5887385a65edccca415957bcef666226a1f6531adc80a42798f8da574b9da52b3d78da2147faad71287bb5a9dd5e1f2dfa8ae7a0fa035250a9a951e
7
- data.tar.gz: 61ffb8f7cda498954e0e169098ba0de225034c3d7446292da61bebb2e8e20d0e1209e961eea2795339447108956fd7fac4a45ca33eefd325573381a54033dad5
6
+ metadata.gz: b875a05a99270e8989598f64042695a42c68d3302c138c0e9ae30e75406010500b80bfedaa3621ecace21420942ce66d82e19ea6a46cffe965fc816b745fc5df
7
+ data.tar.gz: 9f9661f8d71033b3377e9bc20391c21a2be5d474fb894921b9b04daab5ad273f34b3f6722f74f2abf90c96df9464084838d5744c33924d04649fab1753f0c677
data/README.md CHANGED
@@ -44,6 +44,65 @@ Response
44
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"}
45
45
 
46
46
  ## Change Releases
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
+
47
106
  VERSION - 0.2.4 - 2017/11/01
48
107
 
49
108
  - Refactoring QUERIES CONSTANT to QUERY
@@ -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,26 +38,36 @@ 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: 'http://matricula.crossfitlendarios.com.br/callback',
47
+ callback: 'https://checkout.express/callback',
47
48
  cards_by_user: '/customer/{documentType}/{documentNumber}/creditcard',
49
+ create_billet: '/transaction/bankbillet/',
50
+ print_billet: '/transaction/bankbillet/{transactionToken}'
48
51
  }
49
52
 
50
53
  SUBSCRIPTIONS = {
51
54
  context: '/midas-core/v2',
52
55
  by_token: '/subscription/{subscriptionToken}',
53
56
  invoices: '/subscription/{subscriptionToken}/invoices',
57
+ invoices_renew: '/subscription/{subscriptionToken}/invoices',
54
58
  invoice_transactions: '/invoice/{invoiceToken}/transactions',
55
- create: '/subscription/creditcard',
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',
56
65
  cancel: '/subscription/{subscriptionToken}/cancel',
66
+ renew: '/subscription/{subscriptionToken}/renew',
57
67
  update: '/subscription/{subscriptionToken}',
58
68
  update_card: '/subscription/{subscriptionToken}/payment-method/creditcard',
59
69
  update_invoice: '/invoice/{invoiceToken}',
60
- callback: 'https://matricula.crossfitlendarios.com.br/callback'
70
+ callback: 'https://checkout.express/callback',
61
71
  }
62
72
 
63
73
  QUERIES = {
@@ -65,16 +75,26 @@ module MidasClient
65
75
  by_external_id: '/transactions/external-id/{externalId}',
66
76
  by_external_ids: '/transactions/external-ids',
67
77
  by_transaction_tokens: '/transactions/transaction-tokens',
68
- by_period: '/transactions?startDate={startDate}&endDate={endDate}&status={status}',
78
+ by_period: '/transactions?startDate={startDate}&endDate={endDate}&status={status}&type={type}',
69
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}',
70
82
  creditcards: '/creditcards',
71
- customers: '/customers'
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}',
72
91
  }
73
92
 
74
93
  MANAGEMENTS = {
75
94
  context: '/midas-managment/v2',
76
95
  create_pos: '/pointofsale',
77
- list_pos: '/pointofsale'
96
+ list_pos: '/pointofsale',
97
+ pos_details: '/pointofsale/{midasLogin}'
78
98
  }
79
99
 
80
100
  end
@@ -1,11 +1,14 @@
1
1
  module MidasClient
2
- class Management < Request
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
- # None
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 = get_env[:url] + EndPoints::MANAGEMENTS[:context] + EndPoints::MANAGEMENTS[:list_pos]
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 = get_env[:url] + EndPoints::MANAGEMENTS[:context] + EndPoints::MANAGEMENTS[:create_pos]
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