starkinfra 0.5.0 → 0.6.0
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 +4 -4
- data/lib/{brcodepreview/brcodepreview.rb → brcode_preview/brcode_preview.rb} +5 -2
- data/lib/brcode_preview/subscription.rb +102 -0
- data/lib/business_attachment/business_attachment.rb +186 -0
- data/lib/business_attachment/log.rb +127 -0
- data/lib/business_identity/business_identity.rb +225 -0
- data/lib/business_identity/log.rb +127 -0
- data/lib/{creditnote/creditnote.rb → credit_note/credit_note.rb} +11 -5
- data/lib/{creditnote → credit_note}/log.rb +1 -1
- data/lib/credit_note/rule.rb +46 -0
- data/lib/event/event.rb +10 -2
- data/lib/{individualdocument → individual_document}/log.rb +1 -1
- data/lib/{individualidentity → individual_identity}/log.rb +1 -1
- data/lib/{issuingbalance/issuingbalance.rb → issuing_balance/issuing_balance.rb} +8 -2
- data/lib/issuing_billing_invoice/issuing_billing_invoice.rb +155 -0
- data/lib/issuing_billing_transaction/issuing_billing_transaction.rb +142 -0
- data/lib/{issuingcard/issuingcard.rb → issuing_card/issuing_card.rb} +5 -2
- data/lib/{issuingcard → issuing_card}/log.rb +1 -1
- data/lib/{issuingembossingrequest → issuing_embossing_request}/log.rb +1 -1
- data/lib/{issuingholder → issuing_holder}/log.rb +1 -1
- data/lib/{issuinginvoice → issuing_invoice}/log.rb +1 -1
- data/lib/{issuingproduct/issuingproduct.rb → issuing_product/issuing_product.rb} +5 -2
- data/lib/{issuingpurchase/issuingpurchase.rb → issuing_purchase/issuing_purchase.rb} +18 -9
- data/lib/{issuingpurchase → issuing_purchase}/log.rb +1 -1
- data/lib/{issuingrestock → issuing_restock}/log.rb +1 -1
- data/lib/{issuingrule/issuingrule.rb → issuing_rule/issuing_rule.rb} +9 -3
- data/lib/{issuingstock/issuingstock.rb → issuing_stock/issuing_stock.rb} +5 -2
- data/lib/{issuingstock → issuing_stock}/log.rb +1 -1
- data/lib/issuing_stock_rule/issuing_stock_rule.rb +213 -0
- data/lib/issuing_token/issuing_token.rb +309 -0
- data/lib/issuing_token_design/issuing_token_design.rb +118 -0
- data/lib/issuing_token_request/issuing_token_request.rb +63 -0
- data/lib/{merchantcategory/merchantcategory.rb → merchant_category/merchant_category.rb} +6 -3
- data/lib/{pixchargeback → pix_chargeback}/log.rb +1 -1
- data/lib/{pixchargeback/pixchargeback.rb → pix_chargeback/pix_chargeback.rb} +26 -2
- data/lib/{pixclaim → pix_claim}/log.rb +1 -1
- data/lib/pix_dispute/log.rb +127 -0
- data/lib/pix_dispute/pix_dispute.rb +210 -0
- data/lib/pix_dispute/transaction.rb +91 -0
- data/lib/pix_fraud/log.rb +128 -0
- data/lib/pix_fraud/pix_fraud.rb +180 -0
- data/lib/{pixinfraction → pix_infraction}/log.rb +1 -1
- data/lib/{pixinfraction/pixinfraction.rb → pix_infraction/pix_infraction.rb} +18 -4
- data/lib/pix_internal_transaction_report/log.rb +129 -0
- data/lib/pix_internal_transaction_report/pix_internal_transaction_report.rb +200 -0
- data/lib/{pixkey → pix_key}/log.rb +1 -1
- data/lib/pix_key_holmes/pix_key_holmes.rb +139 -0
- data/lib/pix_pull_request/log.rb +127 -0
- data/lib/pix_pull_request/pix_pull_request.rb +265 -0
- data/lib/pix_pull_subscription/log.rb +127 -0
- data/lib/pix_pull_subscription/pix_pull_subscription.rb +281 -0
- data/lib/{pixrequest → pix_request}/log.rb +1 -1
- data/lib/{pixrequest/pixrequest.rb → pix_request/pix_request.rb} +9 -2
- data/lib/{pixreversal → pix_reversal}/log.rb +1 -1
- data/lib/starkinfra.rb +83 -59
- data/lib/utils/parse.rb +2 -2
- data/lib/utils/return_id.rb +24 -0
- data/lib/webhook/webhook.rb +2 -2
- metadata +87 -67
- /data/lib/{cardmethod/cardmethod.rb → card_method/card_method.rb} +0 -0
- /data/lib/{creditholmes/creditholmes.rb → credit_holmes/credit_holmes.rb} +0 -0
- /data/lib/{creditnote → credit_note}/invoice/description.rb +0 -0
- /data/lib/{creditnote → credit_note}/invoice/discount.rb +0 -0
- /data/lib/{creditnote → credit_note}/invoice/invoice.rb +0 -0
- /data/lib/{creditnote → credit_note}/transfer.rb +0 -0
- /data/lib/{creditpreview/creditnotepreview.rb → credit_preview/credit_note_preview.rb} +0 -0
- /data/lib/{creditpreview/creditpreview.rb → credit_preview/credit_preview.rb} +0 -0
- /data/lib/{creditsigner/creditsigner.rb → credit_signer/credit_signer.rb} +0 -0
- /data/lib/{dynamicbrcode/dynamicbrcode.rb → dynamic_brcode/dynamic_brcode.rb} +0 -0
- /data/lib/{individualdocument/individualdocument.rb → individual_document/individual_document.rb} +0 -0
- /data/lib/{individualidentity/individualidentity.rb → individual_identity/individual_identity.rb} +0 -0
- /data/lib/{issuingdesign/issuingdesign.rb → issuing_design/issuing_design.rb} +0 -0
- /data/lib/{issuingembossingkit/issuingembossingkit.rb → issuing_embossing_kit/issuing_embossing_kit.rb} +0 -0
- /data/lib/{issuingembossingrequest/issuingembossingrequest.rb → issuing_embossing_request/issuing_embossing_request.rb} +0 -0
- /data/lib/{issuingholder/issuingholder.rb → issuing_holder/issuing_holder.rb} +0 -0
- /data/lib/{issuinginvoice/issuinginvoice.rb → issuing_invoice/issuing_invoice.rb} +0 -0
- /data/lib/{issuingrestock/issuingrestock.rb → issuing_restock/issuing_restock.rb} +0 -0
- /data/lib/{issuingtransaction/issuingtransaction.rb → issuing_transaction/issuing_transaction.rb} +0 -0
- /data/lib/{issuingwithdrawal/issuingwithdrawal.rb → issuing_withdrawal/issuing_withdrawal.rb} +0 -0
- /data/lib/{merchantcountry/merchantcountry.rb → merchant_country/merchant_country.rb} +0 -0
- /data/lib/{pixbalance/pixbalance.rb → pix_balance/pix_balance.rb} +0 -0
- /data/lib/{pixclaim/pixclaim.rb → pix_claim/pix_claim.rb} +0 -0
- /data/lib/{pixdirector/pixdirector.rb → pix_director/pix_director.rb} +0 -0
- /data/lib/{pixdomain → pix_domain}/certificate.rb +0 -0
- /data/lib/{pixdomain/pixdomain.rb → pix_domain/pix_domain.rb} +0 -0
- /data/lib/{pixkey/pixkey.rb → pix_key/pix_key.rb} +0 -0
- /data/lib/{pixreversal/pixreversal.rb → pix_reversal/pix_reversal.rb} +0 -0
- /data/lib/{pixstatement/pixstatement.rb → pix_statement/pix_statement.rb} +0 -0
- /data/lib/{staticbrcode/staticbrcode.rb → static_brcode/static_brcode.rb} +0 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require('starkcore')
|
|
4
|
+
require_relative('../utils/rest')
|
|
5
|
+
|
|
6
|
+
module StarkInfra
|
|
7
|
+
# # IssuingBillingInvoice object
|
|
8
|
+
#
|
|
9
|
+
# The IssuingBillingInvoice objects created in your Workspace report the
|
|
10
|
+
# billing cycle charges of your Issuing operation.
|
|
11
|
+
#
|
|
12
|
+
# ## Attributes (return-only):
|
|
13
|
+
# - id [string]: unique id returned when IssuingBillingInvoice is created. ex: '5656565656565656'
|
|
14
|
+
# - tax_id [string]: payer tax ID (CPF or CNPJ) with or without formatting. ex: '01234567890' or '20.018.183/0001-80'
|
|
15
|
+
# - name [string]: payer name. ex: 'Iron Bank S.A.'
|
|
16
|
+
# - fine [float]: Fine percentage applied when paid after the due date. ex: 2.0
|
|
17
|
+
# - interest [float]: Monthly interest percentage applied when paid after the due date. ex: 1.0
|
|
18
|
+
# - amount [integer]: invoice amount in cents. ex: 1234 (= R$ 12.34)
|
|
19
|
+
# - nominal_amount [integer]: nominal amount of the invoice in cents. ex: 1234 (= R$ 12.34)
|
|
20
|
+
# - status [string]: current IssuingBillingInvoice status. ex: 'created', 'paid', 'overdue'
|
|
21
|
+
# - brcode [string]: BR Code for the invoice payment. ex: '00020101021226930014br.gov.bcb.pix2571brcode-h.development.starkinfra.com'
|
|
22
|
+
# - link [string]: public invoice webpage URL. ex: 'https://starkbank-card-issuer.sandbox.starkbank.com/billinginvoicelink/97de4d51e8984c459639a645ce920abb'
|
|
23
|
+
# - due [DateTime]: invoice due and expiration datetime in UTC ISO format. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
24
|
+
# - period_start [DateTime]: billing cycle start datetime. Maps to wire field 'start'. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
25
|
+
# - period_end [DateTime]: billing cycle end datetime. Maps to wire field 'end'. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
26
|
+
# - created [DateTime]: creation datetime for the IssuingBillingInvoice. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
27
|
+
# - updated [DateTime]: latest update datetime for the IssuingBillingInvoice. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
28
|
+
class IssuingBillingInvoice < StarkCore::Utils::Resource
|
|
29
|
+
attr_reader :id, :tax_id, :name, :fine, :interest, :amount, :nominal_amount, :status, :brcode, :link,
|
|
30
|
+
:due, :period_start, :period_end, :created, :updated
|
|
31
|
+
def initialize(
|
|
32
|
+
id: nil, tax_id: nil, name: nil, fine: nil, interest: nil, amount: nil, nominal_amount: nil, status: nil,
|
|
33
|
+
brcode: nil, link: nil, due: nil, period_start: nil, period_end: nil, created: nil, updated: nil
|
|
34
|
+
)
|
|
35
|
+
super(id)
|
|
36
|
+
@tax_id = tax_id
|
|
37
|
+
@name = name
|
|
38
|
+
@fine = fine
|
|
39
|
+
@interest = interest
|
|
40
|
+
@amount = amount
|
|
41
|
+
@nominal_amount = nominal_amount
|
|
42
|
+
@status = status
|
|
43
|
+
@brcode = brcode
|
|
44
|
+
@link = link
|
|
45
|
+
@due = StarkCore::Utils::Checks.check_datetime(due)
|
|
46
|
+
@period_start = StarkCore::Utils::Checks.check_datetime(period_start)
|
|
47
|
+
@period_end = StarkCore::Utils::Checks.check_datetime(period_end)
|
|
48
|
+
@created = StarkCore::Utils::Checks.check_datetime(created)
|
|
49
|
+
@updated = StarkCore::Utils::Checks.check_datetime(updated)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# # Retrieve a specific IssuingBillingInvoice
|
|
53
|
+
#
|
|
54
|
+
# Receive a single IssuingBillingInvoice object previously created in the Stark Infra API by its id
|
|
55
|
+
#
|
|
56
|
+
# ## Parameters (required):
|
|
57
|
+
# - id [string]: object unique id. ex: '5656565656565656'
|
|
58
|
+
#
|
|
59
|
+
# ## Parameters (optional):
|
|
60
|
+
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
|
61
|
+
#
|
|
62
|
+
# ## Return:
|
|
63
|
+
# - IssuingBillingInvoice object with updated attributes
|
|
64
|
+
def self.get(id, user: nil)
|
|
65
|
+
StarkInfra::Utils::Rest.get_id(id: id, user: user, **resource)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# # Retrieve IssuingBillingInvoices
|
|
69
|
+
#
|
|
70
|
+
# Receive a generator of IssuingBillingInvoice objects previously created in the Stark Infra API
|
|
71
|
+
#
|
|
72
|
+
# ## Parameters (optional):
|
|
73
|
+
# - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
|
|
74
|
+
# - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
|
|
75
|
+
# - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
|
|
76
|
+
# - status [list of strings, default nil]: filter for status of retrieved objects. ex: ['created', 'paid', 'overdue']
|
|
77
|
+
# - id [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
|
|
78
|
+
# - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
|
|
79
|
+
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
|
80
|
+
#
|
|
81
|
+
# ## Return:
|
|
82
|
+
# - generator of IssuingBillingInvoice objects with updated attributes
|
|
83
|
+
def self.query(limit: nil, after: nil, before: nil, status: nil, id: nil, tags: nil, user: nil)
|
|
84
|
+
after = StarkCore::Utils::Checks.check_date(after)
|
|
85
|
+
before = StarkCore::Utils::Checks.check_date(before)
|
|
86
|
+
StarkInfra::Utils::Rest.get_stream(
|
|
87
|
+
limit: limit,
|
|
88
|
+
after: after,
|
|
89
|
+
before: before,
|
|
90
|
+
status: status,
|
|
91
|
+
id: id,
|
|
92
|
+
tags: tags,
|
|
93
|
+
user: user,
|
|
94
|
+
**resource
|
|
95
|
+
)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# # Retrieve paged IssuingBillingInvoices
|
|
99
|
+
#
|
|
100
|
+
# Receive a list of up to 100 IssuingBillingInvoice objects previously created in the Stark Infra API and the cursor to the next page.
|
|
101
|
+
# Use this function instead of query if you want to manually page your requests.
|
|
102
|
+
#
|
|
103
|
+
# ## Parameters (optional):
|
|
104
|
+
# - cursor [string, default nil]: cursor returned on the previous page function call.
|
|
105
|
+
# - limit [integer, default 100]: maximum number of objects to be retrieved. Max = 100. ex: 35
|
|
106
|
+
# - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
|
|
107
|
+
# - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
|
|
108
|
+
# - status [list of strings, default nil]: filter for status of retrieved objects. ex: ['created', 'paid', 'overdue']
|
|
109
|
+
# - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
|
|
110
|
+
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
|
111
|
+
#
|
|
112
|
+
# ## Return:
|
|
113
|
+
# - list of IssuingBillingInvoice objects with updated attributes
|
|
114
|
+
# - cursor to retrieve the next page of IssuingBillingInvoice objects
|
|
115
|
+
def self.page(cursor: nil, limit: nil, after: nil, before: nil, status: nil, tags: nil, user: nil)
|
|
116
|
+
after = StarkCore::Utils::Checks.check_date(after)
|
|
117
|
+
before = StarkCore::Utils::Checks.check_date(before)
|
|
118
|
+
StarkInfra::Utils::Rest.get_page(
|
|
119
|
+
cursor: cursor,
|
|
120
|
+
limit: limit,
|
|
121
|
+
after: after,
|
|
122
|
+
before: before,
|
|
123
|
+
status: status,
|
|
124
|
+
tags: tags,
|
|
125
|
+
user: user,
|
|
126
|
+
**resource
|
|
127
|
+
)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def self.resource
|
|
131
|
+
{
|
|
132
|
+
resource_name: 'IssuingBillingInvoice',
|
|
133
|
+
resource_maker: proc { |json|
|
|
134
|
+
IssuingBillingInvoice.new(
|
|
135
|
+
id: json['id'],
|
|
136
|
+
tax_id: json['tax_id'],
|
|
137
|
+
name: json['name'],
|
|
138
|
+
fine: json['fine'],
|
|
139
|
+
interest: json['interest'],
|
|
140
|
+
amount: json['amount'],
|
|
141
|
+
nominal_amount: json['nominal_amount'],
|
|
142
|
+
status: json['status'],
|
|
143
|
+
brcode: json['brcode'],
|
|
144
|
+
link: json['link'],
|
|
145
|
+
due: json['due'],
|
|
146
|
+
period_start: json['start'],
|
|
147
|
+
period_end: json['end'],
|
|
148
|
+
created: json['created'],
|
|
149
|
+
updated: json['updated']
|
|
150
|
+
)
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
end
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require('starkcore')
|
|
4
|
+
require_relative('../utils/rest')
|
|
5
|
+
|
|
6
|
+
module StarkInfra
|
|
7
|
+
# # IssuingBillingTransaction object
|
|
8
|
+
#
|
|
9
|
+
# The IssuingBillingTransaction objects created in your Workspace report the
|
|
10
|
+
# transactions that compose the billing invoices of your Issuing operation.
|
|
11
|
+
#
|
|
12
|
+
# ## Attributes (return-only):
|
|
13
|
+
# - id [string]: unique id returned when IssuingBillingTransaction is created. ex: '5656565656565656'
|
|
14
|
+
# - amount [integer]: transaction amount in cents. ex: 1234 (= R$ 12.34)
|
|
15
|
+
# - invoice_id [string]: id of the parent billing invoice the transaction belongs to. May be nil when the transaction is not tied to an invoice. ex: '5656565656565656'
|
|
16
|
+
# - installment [integer]: installment number of the transaction. ex: 1
|
|
17
|
+
# - installment_count [integer]: total number of installments of the transaction. ex: 12
|
|
18
|
+
# - balance [integer]: remaining issuing balance in cents after the transaction. ex: 1234 (= R$ 12.34)
|
|
19
|
+
# - holder_name [string]: card holder name. ex: 'Tony Stark'
|
|
20
|
+
# - source [string]: transaction source. ex: 'issuing-purchase'
|
|
21
|
+
# - external_id [string]: external transaction id. ex: 'my-external-id-123456'
|
|
22
|
+
# - description [string]: transaction description. ex: 'Purchase at Stark Store'
|
|
23
|
+
# - card_ending [string]: last 4 digits of the card number. ex: '1234'
|
|
24
|
+
# - tax [integer]: IOF amount in cents applied to the transaction
|
|
25
|
+
# - rate [float]: Conversion rate applied to international transactions
|
|
26
|
+
# - merchant_amount [integer]: merchant amount in cents. ex: 1234 (= R$ 12.34)
|
|
27
|
+
# - merchant_currency_code [string]: merchant currency code in ISO 4217 format. ex: 'USD'
|
|
28
|
+
# - created [DateTime]: creation datetime for the IssuingBillingTransaction. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
29
|
+
class IssuingBillingTransaction < StarkCore::Utils::Resource
|
|
30
|
+
attr_reader :id, :amount, :invoice_id, :installment, :installment_count, :balance, :holder_name, :source,
|
|
31
|
+
:external_id, :description, :card_ending, :tax, :rate, :merchant_amount, :merchant_currency_code,
|
|
32
|
+
:created
|
|
33
|
+
def initialize(
|
|
34
|
+
id: nil, amount: nil, invoice_id: nil, installment: nil, installment_count: nil, balance: nil,
|
|
35
|
+
holder_name: nil, source: nil, external_id: nil, description: nil, card_ending: nil, tax: nil, rate: nil,
|
|
36
|
+
merchant_amount: nil, merchant_currency_code: nil, created: nil
|
|
37
|
+
)
|
|
38
|
+
super(id)
|
|
39
|
+
@amount = amount
|
|
40
|
+
@invoice_id = invoice_id
|
|
41
|
+
@installment = installment
|
|
42
|
+
@installment_count = installment_count
|
|
43
|
+
@balance = balance
|
|
44
|
+
@holder_name = holder_name
|
|
45
|
+
@source = source
|
|
46
|
+
@external_id = external_id
|
|
47
|
+
@description = description
|
|
48
|
+
@card_ending = card_ending
|
|
49
|
+
@tax = tax
|
|
50
|
+
@rate = rate
|
|
51
|
+
@merchant_amount = merchant_amount
|
|
52
|
+
@merchant_currency_code = merchant_currency_code
|
|
53
|
+
@created = StarkCore::Utils::Checks.check_datetime(created)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# # Retrieve IssuingBillingTransactions
|
|
57
|
+
#
|
|
58
|
+
# Receive a generator of IssuingBillingTransaction objects previously created in the Stark Infra API
|
|
59
|
+
#
|
|
60
|
+
# ## Parameters (optional):
|
|
61
|
+
# - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
|
|
62
|
+
# - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
|
|
63
|
+
# - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
|
|
64
|
+
# - invoice_id [string, default nil]: filter for transactions of a specific billing invoice. ex: '5656565656565656'
|
|
65
|
+
# - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
|
|
66
|
+
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
|
67
|
+
#
|
|
68
|
+
# ## Return:
|
|
69
|
+
# - generator of IssuingBillingTransaction objects with updated attributes
|
|
70
|
+
def self.query(limit: nil, after: nil, before: nil, invoice_id: nil, tags: nil, user: nil)
|
|
71
|
+
after = StarkCore::Utils::Checks.check_date(after)
|
|
72
|
+
before = StarkCore::Utils::Checks.check_date(before)
|
|
73
|
+
StarkInfra::Utils::Rest.get_stream(
|
|
74
|
+
limit: limit,
|
|
75
|
+
after: after,
|
|
76
|
+
before: before,
|
|
77
|
+
invoice_id: invoice_id,
|
|
78
|
+
tags: tags,
|
|
79
|
+
user: user,
|
|
80
|
+
**resource
|
|
81
|
+
)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# # Retrieve paged IssuingBillingTransactions
|
|
85
|
+
#
|
|
86
|
+
# Receive a list of up to 100 IssuingBillingTransaction objects previously created in the Stark Infra API and the cursor to the next page.
|
|
87
|
+
# Use this function instead of query if you want to manually page your requests.
|
|
88
|
+
#
|
|
89
|
+
# ## Parameters (optional):
|
|
90
|
+
# - cursor [string, default nil]: cursor returned on the previous page function call.
|
|
91
|
+
# - limit [integer, default 100]: maximum number of objects to be retrieved. Max = 100. ex: 35
|
|
92
|
+
# - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
|
|
93
|
+
# - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
|
|
94
|
+
# - invoice_id [string, default nil]: filter for transactions of a specific billing invoice. ex: '5656565656565656'
|
|
95
|
+
# - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
|
|
96
|
+
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
|
97
|
+
#
|
|
98
|
+
# ## Return:
|
|
99
|
+
# - list of IssuingBillingTransaction objects with updated attributes
|
|
100
|
+
# - cursor to retrieve the next page of IssuingBillingTransaction objects
|
|
101
|
+
def self.page(cursor: nil, limit: nil, after: nil, before: nil, invoice_id: nil, tags: nil, user: nil)
|
|
102
|
+
after = StarkCore::Utils::Checks.check_date(after)
|
|
103
|
+
before = StarkCore::Utils::Checks.check_date(before)
|
|
104
|
+
StarkInfra::Utils::Rest.get_page(
|
|
105
|
+
cursor: cursor,
|
|
106
|
+
limit: limit,
|
|
107
|
+
after: after,
|
|
108
|
+
before: before,
|
|
109
|
+
invoice_id: invoice_id,
|
|
110
|
+
tags: tags,
|
|
111
|
+
user: user,
|
|
112
|
+
**resource
|
|
113
|
+
)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def self.resource
|
|
117
|
+
{
|
|
118
|
+
resource_name: 'IssuingBillingTransaction',
|
|
119
|
+
resource_maker: proc { |json|
|
|
120
|
+
IssuingBillingTransaction.new(
|
|
121
|
+
id: json['id'],
|
|
122
|
+
amount: json['amount'],
|
|
123
|
+
invoice_id: json['invoice_id'],
|
|
124
|
+
installment: json['installment'],
|
|
125
|
+
installment_count: json['installment_count'],
|
|
126
|
+
balance: json['balance'],
|
|
127
|
+
holder_name: json['holder_name'],
|
|
128
|
+
source: json['source'],
|
|
129
|
+
external_id: json['external_id'],
|
|
130
|
+
description: json['description'],
|
|
131
|
+
card_ending: json['card_ending'],
|
|
132
|
+
tax: json['tax'],
|
|
133
|
+
rate: json['rate'],
|
|
134
|
+
merchant_amount: json['merchant_amount'],
|
|
135
|
+
merchant_currency_code: json['merchant_currency_code'],
|
|
136
|
+
created: json['created']
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
|
@@ -31,6 +31,7 @@ module StarkInfra
|
|
|
31
31
|
# - holder_id [string]: card holder unique id. ex: '5656565656565656'
|
|
32
32
|
# - type [string]: card type. ex: 'virtual'
|
|
33
33
|
# - status [string]: current IssuingCard status. ex: 'active', 'blocked', 'canceled', 'expired'.
|
|
34
|
+
# - is_pin_defined [boolean]: Whether the card has a PIN defined. Returned only when "expand=isPinDefined" is informed in the request
|
|
34
35
|
# - number [string]: [EXPANDABLE] masked card number. Expand to unmask the value. ex: '123'.
|
|
35
36
|
# - security_code [string]: [EXPANDABLE] masked card verification value (cvv). Expand to unmask the value. ex: '123'.
|
|
36
37
|
# - expiration [DateTime]: [EXPANDABLE] masked card expiration datetime. Expand to unmask the value. ex: DateTime.new(2032, 3, 10, 10, 30, 0, 0)
|
|
@@ -39,11 +40,11 @@ module StarkInfra
|
|
|
39
40
|
class IssuingCard < StarkCore::Utils::Resource
|
|
40
41
|
attr_reader :id, :holder_name, :holder_tax_id, :holder_external_id, :display_name, :rules, :product_id, :tags,
|
|
41
42
|
:street_line_1, :street_line_2, :district, :city, :state_code, :zip_code, :holder_id,
|
|
42
|
-
:type, :status, :number, :security_code, :expiration, :created, :updated
|
|
43
|
+
:type, :status, :is_pin_defined, :number, :security_code, :expiration, :created, :updated
|
|
43
44
|
def initialize(
|
|
44
45
|
holder_name: , holder_tax_id: , holder_external_id: , display_name: nil, rules: nil, product_id: nil, tags: nil,
|
|
45
46
|
street_line_1: nil, street_line_2: nil, district: nil, city: nil, state_code: nil, zip_code: nil, id: nil,
|
|
46
|
-
holder_id: nil, type: nil, status: nil, number: nil, security_code: nil, expiration: nil, created: nil, updated: nil
|
|
47
|
+
holder_id: nil, type: nil, status: nil, is_pin_defined: nil, number: nil, security_code: nil, expiration: nil, created: nil, updated: nil
|
|
47
48
|
)
|
|
48
49
|
super(id)
|
|
49
50
|
@holder_name = holder_name
|
|
@@ -62,6 +63,7 @@ module StarkInfra
|
|
|
62
63
|
@holder_id = holder_id
|
|
63
64
|
@type = type
|
|
64
65
|
@status = status
|
|
66
|
+
@is_pin_defined = is_pin_defined
|
|
65
67
|
@number = number
|
|
66
68
|
@security_code = security_code
|
|
67
69
|
expiration = nil if !expiration.nil? && expiration.include?('*')
|
|
@@ -249,6 +251,7 @@ module StarkInfra
|
|
|
249
251
|
holder_id: json['holder_id'],
|
|
250
252
|
type: json['type'],
|
|
251
253
|
status: json['status'],
|
|
254
|
+
is_pin_defined: json['is_pin_defined'],
|
|
252
255
|
number: json['number'],
|
|
253
256
|
security_code: json['security_code'],
|
|
254
257
|
expiration: json['expiration'],
|
|
@@ -15,15 +15,17 @@ module StarkInfra
|
|
|
15
15
|
# - funding_type [string]: type of funding used for payment. ex: 'credit', 'debit'
|
|
16
16
|
# - holder_type [string]: holder type. ex: 'business', 'individual'
|
|
17
17
|
# - code [string]: internal code from card flag informing the product. ex: 'MRW', 'MCO', 'MWB', 'MCS'
|
|
18
|
+
# - customer_type [string]: Same as holderType. Kept for backward compatibility
|
|
18
19
|
# - created [DateTime]: creation datetime for the IssuingProduct. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
19
20
|
class IssuingProduct < StarkCore::Utils::Resource
|
|
20
|
-
attr_reader :id, :network, :funding_type, :holder_type, :code, :created
|
|
21
|
-
def initialize(id: nil, network: nil, funding_type: nil, holder_type: nil, code: nil, created: nil)
|
|
21
|
+
attr_reader :id, :network, :funding_type, :holder_type, :code, :customer_type, :created
|
|
22
|
+
def initialize(id: nil, network: nil, funding_type: nil, holder_type: nil, code: nil, customer_type: nil, created: nil)
|
|
22
23
|
super(id)
|
|
23
24
|
@network = network
|
|
24
25
|
@funding_type = funding_type
|
|
25
26
|
@holder_type = holder_type
|
|
26
27
|
@code = code
|
|
28
|
+
@customer_type = customer_type
|
|
27
29
|
@created = StarkCore::Utils::Checks.check_datetime(created)
|
|
28
30
|
end
|
|
29
31
|
|
|
@@ -76,6 +78,7 @@ module StarkInfra
|
|
|
76
78
|
funding_type: json['funding_type'],
|
|
77
79
|
holder_type: json['holder_type'],
|
|
78
80
|
code: json['code'],
|
|
81
|
+
customer_type: json['customer_type'],
|
|
79
82
|
created: json['created']
|
|
80
83
|
)
|
|
81
84
|
}
|
|
@@ -14,6 +14,7 @@ module StarkInfra
|
|
|
14
14
|
# - card_id [string]: unique id returned when IssuingCard is created. ex: '5656565656565656'
|
|
15
15
|
# - card_ending [string]: last 4 digits of the card number. ex: '1234'
|
|
16
16
|
# - purpose [string]: purchase purpose. ex: 'purchase'
|
|
17
|
+
# - installment_count [integer]: quantity of installments to be confirmed. Minimum = 1. ex: 12
|
|
17
18
|
# - amount [integer]: IssuingPurchase value in cents. Minimum = 0. ex: 1234 (= R$ 12.34)
|
|
18
19
|
# - tax [integer]: IOF amount taxed for international purchases. ex: 1234 (= R$ 12.34)
|
|
19
20
|
# - issuer_amount [integer]: issuer amount. ex: 1234 (= R$ 12.34)
|
|
@@ -24,6 +25,7 @@ module StarkInfra
|
|
|
24
25
|
# - merchant_category_type [string]: merchant category type. ex 'food'
|
|
25
26
|
# - merchant_currency_symbol [string]: merchant currency symbol. ex: '$'
|
|
26
27
|
# - merchant_category_code [string]: merchant category code. ex: 'fastFoodRestaurants'
|
|
28
|
+
# - merchant_category_number [integer]: MCC number of the merchant category. ex: 5814
|
|
27
29
|
# - merchant_country_code [string]: merchant country code. ex: 'USA'
|
|
28
30
|
# - acquirer_id [string]: acquirer ID. ex: '5656565656565656'
|
|
29
31
|
# - merchant_id [string]: merchant ID. ex: '5656565656565656'
|
|
@@ -39,6 +41,7 @@ module StarkInfra
|
|
|
39
41
|
# - id [string]: unique id returned when IssuingPurchase is created. ex: '5656565656565656'
|
|
40
42
|
# - issuing_transaction_ids [string]: ledger transaction ids linked to this Purchase
|
|
41
43
|
# - status [string]: current IssuingCard status. Options: 'approved', 'canceled', 'denied', 'confirmed', 'voided'
|
|
44
|
+
# - confirmed [DateTime]: Confirmation datetime. Null until the purchase is confirmed. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
42
45
|
# - description [string]: IssuingPurchase description. ex: 'Office Supplies'
|
|
43
46
|
# - metadata [dictionary object]: dictionary object used to store additional information about the IssuingPurchase object. ex: { authorizationId: 'OjZAqj' }
|
|
44
47
|
# - zip_code [string]: zip code of the merchant location. ex: '02101234'
|
|
@@ -51,18 +54,18 @@ module StarkInfra
|
|
|
51
54
|
# - holder_id [string]: card holder ID. ex: '5656565656565656'
|
|
52
55
|
# - holder_tags [list of strings]: tags of the IssuingHolder responsible for this purchase. ex: ['technology', 'john snow']
|
|
53
56
|
class IssuingPurchase < StarkCore::Utils::Resource
|
|
54
|
-
attr_reader :id, :holder_name, :product_id, :card_id, :card_ending, :purpose, :amount, :tax, :issuer_amount, :issuer_currency_code,
|
|
57
|
+
attr_reader :id, :holder_name, :product_id, :card_id, :card_ending, :purpose, :installment_count, :amount, :tax, :issuer_amount, :issuer_currency_code,
|
|
55
58
|
:issuer_currency_symbol, :merchant_amount, :merchant_currency_code, :merchant_currency_symbol,
|
|
56
|
-
:merchant_category_code, :merchant_category_type, :merchant_country_code, :acquirer_id, :merchant_id, :merchant_name,
|
|
59
|
+
:merchant_category_code, :merchant_category_number, :merchant_category_type, :merchant_country_code, :acquirer_id, :merchant_id, :merchant_name,
|
|
57
60
|
:merchant_fee, :wallet_id, :method_code, :score, :end_to_end_id, :tags,
|
|
58
|
-
:issuing_transaction_ids, :status, :description, :metadata, :zip_code, :updated, :created, :is_partial_allowed, :card_tags, :holder_id, :holder_tags
|
|
61
|
+
:issuing_transaction_ids, :status, :confirmed, :description, :metadata, :zip_code, :updated, :created, :is_partial_allowed, :card_tags, :holder_id, :holder_tags
|
|
59
62
|
|
|
60
63
|
def initialize(
|
|
61
|
-
id: nil, holder_name: nil, product_id: nil, card_id: nil, card_ending: nil, purpose: nil, amount: nil, tax: nil, issuer_amount: nil,
|
|
64
|
+
id: nil, holder_name: nil, product_id: nil, card_id: nil, card_ending: nil, purpose: nil, installment_count: nil, amount: nil, tax: nil, issuer_amount: nil,
|
|
62
65
|
issuer_currency_code: nil, issuer_currency_symbol: nil, merchant_amount: nil, merchant_currency_code: nil,
|
|
63
|
-
merchant_currency_symbol: nil, merchant_category_code: nil, merchant_category_type: nil, merchant_country_code: nil, acquirer_id: nil,
|
|
66
|
+
merchant_currency_symbol: nil, merchant_category_code: nil, merchant_category_number: nil, merchant_category_type: nil, merchant_country_code: nil, acquirer_id: nil,
|
|
64
67
|
merchant_id: nil, merchant_name: nil, merchant_fee: nil, wallet_id: nil, method_code: nil, score: nil,
|
|
65
|
-
end_to_end_id: nil, tags: nil, issuing_transaction_ids: nil, status: nil, description: nil, metadata: nil, zip_code: nil, updated: nil, created: nil,
|
|
68
|
+
end_to_end_id: nil, tags: nil, issuing_transaction_ids: nil, status: nil, confirmed: nil, description: nil, metadata: nil, zip_code: nil, updated: nil, created: nil,
|
|
66
69
|
is_partial_allowed: nil, card_tags:nil, holder_id: nil, holder_tags:nil
|
|
67
70
|
)
|
|
68
71
|
super(id)
|
|
@@ -71,6 +74,7 @@ module StarkInfra
|
|
|
71
74
|
@card_id = card_id
|
|
72
75
|
@card_ending = card_ending
|
|
73
76
|
@purpose = purpose
|
|
77
|
+
@installment_count = installment_count
|
|
74
78
|
@amount = amount
|
|
75
79
|
@tax = tax
|
|
76
80
|
@issuer_amount = issuer_amount
|
|
@@ -80,6 +84,7 @@ module StarkInfra
|
|
|
80
84
|
@merchant_currency_code = merchant_currency_code
|
|
81
85
|
@merchant_currency_symbol = merchant_currency_symbol
|
|
82
86
|
@merchant_category_code = merchant_category_code
|
|
87
|
+
@merchant_category_number = merchant_category_number
|
|
83
88
|
@merchant_category_type = merchant_category_type
|
|
84
89
|
@merchant_country_code = merchant_country_code
|
|
85
90
|
@acquirer_id = acquirer_id
|
|
@@ -93,6 +98,7 @@ module StarkInfra
|
|
|
93
98
|
@tags = tags
|
|
94
99
|
@issuing_transaction_ids = issuing_transaction_ids
|
|
95
100
|
@status = status
|
|
101
|
+
@confirmed = StarkCore::Utils::Checks.check_datetime(confirmed)
|
|
96
102
|
@description = description
|
|
97
103
|
@metadata = metadata
|
|
98
104
|
@zip_code = zip_code
|
|
@@ -214,12 +220,12 @@ module StarkInfra
|
|
|
214
220
|
# ## Return:
|
|
215
221
|
# - Parsed IssuingPurchase object
|
|
216
222
|
def self.parse(content:, signature:, user: nil)
|
|
217
|
-
|
|
223
|
+
StarkInfra::Utils::Parse.parse_and_verify(
|
|
218
224
|
content: content,
|
|
219
225
|
signature: signature,
|
|
220
226
|
user: user,
|
|
221
227
|
key: nil,
|
|
222
|
-
|
|
228
|
+
resource: resource
|
|
223
229
|
)
|
|
224
230
|
end
|
|
225
231
|
|
|
@@ -238,7 +244,7 @@ module StarkInfra
|
|
|
238
244
|
# ## Return:
|
|
239
245
|
# - Dumped JSON string that must be returned to us on the IssuingPurchase request
|
|
240
246
|
def self.response(
|
|
241
|
-
status:, reason
|
|
247
|
+
status:, reason: nil, amount: nil, tags: nil
|
|
242
248
|
)
|
|
243
249
|
params = {
|
|
244
250
|
'status': status,
|
|
@@ -261,6 +267,7 @@ module StarkInfra
|
|
|
261
267
|
card_id: json['card_id'],
|
|
262
268
|
card_ending: json['card_ending'],
|
|
263
269
|
purpose: json['purpose'],
|
|
270
|
+
installment_count: json['installment_count'],
|
|
264
271
|
amount: json['amount'],
|
|
265
272
|
tax: json['tax'],
|
|
266
273
|
issuer_amount: json['issuer_amount'],
|
|
@@ -270,6 +277,7 @@ module StarkInfra
|
|
|
270
277
|
merchant_currency_code: json['merchant_currency_code'],
|
|
271
278
|
merchant_currency_symbol: json['merchant_currency_symbol'],
|
|
272
279
|
merchant_category_code: json['merchant_category_code'],
|
|
280
|
+
merchant_category_number: json['merchant_category_number'],
|
|
273
281
|
merchant_category_type: json['merchant_category_type'],
|
|
274
282
|
merchant_country_code: json['merchant_country_code'],
|
|
275
283
|
acquirer_id: json['acquirer_id'],
|
|
@@ -283,6 +291,7 @@ module StarkInfra
|
|
|
283
291
|
tags: json['tags'],
|
|
284
292
|
issuing_transaction_ids: json['issuing_transaction_ids'],
|
|
285
293
|
status: json['status'],
|
|
294
|
+
confirmed: json['confirmed'],
|
|
286
295
|
description: json['description'],
|
|
287
296
|
metadata: json['metadata'],
|
|
288
297
|
zip_code: json['zip_code'],
|
|
@@ -24,12 +24,14 @@ module StarkInfra
|
|
|
24
24
|
# - counter_amount [integer]: current rule spent amount. ex: 1000
|
|
25
25
|
# - currency_symbol [string]: currency symbol. ex: 'R$'
|
|
26
26
|
# - currency_name [string]: currency name. ex: 'Brazilian Real'
|
|
27
|
+
# - schedule [string]: Optional schedule dictating when the rule can be used. Some examples: 'everyday from 09:00 to 18:00 in America/Sao_Paulo' - every day, 09:00-18:00 Sao Paulo time; 'every monday, wednesday, friday from 08:00 to 12:00 in America/Sao_Paulo' - only those weekdays, mornings; 'every saturday, sunday' - weekends, all day, in UTC
|
|
28
|
+
# - purposes [list of strings]: Optional list of transaction purposes the rule applies to. Options: 'purchase', 'withdrawal', 'verification'. The rule then limits only purchases of those purposes; omit it to allow any purposes. Example: ['purchase', 'verification'] if you want us to automatically deny withdrawal.
|
|
27
29
|
class IssuingRule < StarkCore::Utils::Resource
|
|
28
30
|
attr_reader :name, :interval, :amount, :currency_code, :counter_amount, :currency_name, :currency_symbol,
|
|
29
|
-
:categories, :countries, :methods
|
|
31
|
+
:categories, :countries, :methods, :schedule, :purposes
|
|
30
32
|
def initialize(
|
|
31
33
|
name:, amount:, id: nil, interval: nil, currency_code: nil, categories: nil, countries: nil, methods: nil,
|
|
32
|
-
counter_amount: nil, currency_symbol: nil, currency_name: nil
|
|
34
|
+
counter_amount: nil, currency_symbol: nil, currency_name: nil, schedule: nil, purposes: nil
|
|
33
35
|
)
|
|
34
36
|
super(id)
|
|
35
37
|
@name = name
|
|
@@ -42,6 +44,8 @@ module StarkInfra
|
|
|
42
44
|
@counter_amount = counter_amount
|
|
43
45
|
@currency_symbol = currency_symbol
|
|
44
46
|
@currency_name = currency_name
|
|
47
|
+
@schedule = schedule
|
|
48
|
+
@purposes = purposes
|
|
45
49
|
end
|
|
46
50
|
|
|
47
51
|
def self.parse_categories(categories)
|
|
@@ -114,7 +118,9 @@ module StarkInfra
|
|
|
114
118
|
methods: json['methods'],
|
|
115
119
|
counter_amount: json['counter_amount'],
|
|
116
120
|
currency_symbol: json['currency_symbol'],
|
|
117
|
-
currency_name: json['currency_name']
|
|
121
|
+
currency_name: json['currency_name'],
|
|
122
|
+
schedule: json['schedule'],
|
|
123
|
+
purposes: json['purposes']
|
|
118
124
|
)
|
|
119
125
|
}
|
|
120
126
|
}
|
|
@@ -13,17 +13,19 @@ module StarkInfra
|
|
|
13
13
|
# - balance [integer]: [EXPANDABLE] current stock balance. ex: 1000
|
|
14
14
|
# - design_id [string]: IssuingDesign unique id. ex: "5656565656565656"
|
|
15
15
|
# - embosser_id [string]: Embosser unique id. ex: "5656565656565656"
|
|
16
|
+
# - embosser_name [string]: Name of the embosser that holds this stock
|
|
16
17
|
# - updated [DateTime]: latest update datetime for the IssuingStock. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
17
18
|
# - created [DateTime]: creation datetime for the IssuingStock. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
18
19
|
class IssuingStock < StarkCore::Utils::Resource
|
|
19
|
-
attr_reader :id, :balance, :design_id, :embosser_id, :updated, :created
|
|
20
|
+
attr_reader :id, :balance, :design_id, :embosser_id, :embosser_name, :updated, :created
|
|
20
21
|
def initialize(
|
|
21
|
-
id: nil, balance: nil, design_id: nil, embosser_id: nil, updated: nil, created: nil
|
|
22
|
+
id: nil, balance: nil, design_id: nil, embosser_id: nil, embosser_name: nil, updated: nil, created: nil
|
|
22
23
|
)
|
|
23
24
|
super(id)
|
|
24
25
|
@balance = balance
|
|
25
26
|
@design_id = design_id
|
|
26
27
|
@embosser_id = embosser_id
|
|
28
|
+
@embosser_name = embosser_name
|
|
27
29
|
@updated = StarkCore::Utils::Checks.check_datetime(updated)
|
|
28
30
|
@created = StarkCore::Utils::Checks.check_datetime(created)
|
|
29
31
|
end
|
|
@@ -127,6 +129,7 @@ module StarkInfra
|
|
|
127
129
|
balance: json['balance'],
|
|
128
130
|
design_id: json['design_id'],
|
|
129
131
|
embosser_id: json['embosser_id'],
|
|
132
|
+
embosser_name: json['embosser_name'],
|
|
130
133
|
updated: json['updated'],
|
|
131
134
|
created: json['created']
|
|
132
135
|
)
|