starkinfra 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/lib/brcodepreview/brcodepreview.rb +125 -0
  3. data/lib/cardmethod/cardmethod.rb +56 -0
  4. data/lib/creditholmes/creditholmes.rb +160 -0
  5. data/lib/creditnote/creditnote.rb +51 -355
  6. data/lib/creditnote/invoice/description.rb +51 -0
  7. data/lib/creditnote/invoice/discount.rb +49 -0
  8. data/lib/creditnote/invoice/invoice.rb +124 -0
  9. data/lib/creditnote/log.rb +18 -19
  10. data/lib/creditnote/transfer.rb +90 -0
  11. data/lib/creditpreview/creditnotepreview.rb +85 -0
  12. data/lib/creditpreview/creditpreview.rb +77 -0
  13. data/lib/creditsigner/creditsigner.rb +57 -0
  14. data/lib/dynamicbrcode/dynamicbrcode.rb +350 -0
  15. data/lib/event/attempt.rb +5 -4
  16. data/lib/event/event.rb +11 -11
  17. data/lib/individualdocument/individualdocument.rb +165 -0
  18. data/lib/individualdocument/log.rb +125 -0
  19. data/lib/individualidentity/individualidentity.rb +193 -0
  20. data/lib/individualidentity/log.rb +124 -0
  21. data/lib/issuingbalance/issuingbalance.rb +4 -4
  22. data/lib/issuingcard/issuingcard.rb +35 -33
  23. data/lib/issuingcard/log.rb +21 -21
  24. data/lib/issuingdesign/issuingdesign.rb +138 -0
  25. data/lib/issuingembossingkit/issuingembossingkit.rb +121 -0
  26. data/lib/issuingembossingrequest/issuingembossingrequest.rb +210 -0
  27. data/lib/issuingembossingrequest/log.rb +128 -0
  28. data/lib/issuingholder/issuingholder.rb +21 -15
  29. data/lib/issuingholder/log.rb +19 -19
  30. data/lib/issuinginvoice/issuinginvoice.rb +29 -14
  31. data/lib/issuinginvoice/log.rb +18 -18
  32. data/lib/{issuingbin/issuingbin.rb → issuingproduct/issuingproduct.rb} +27 -30
  33. data/lib/issuingpurchase/issuingpurchase.rb +111 -31
  34. data/lib/issuingpurchase/log.rb +16 -16
  35. data/lib/issuingrestock/issuingrestock.rb +162 -0
  36. data/lib/issuingrestock/log.rb +127 -0
  37. data/lib/issuingrule/issuingrule.rb +64 -18
  38. data/lib/issuingstock/issuingstock.rb +138 -0
  39. data/lib/issuingstock/log.rb +130 -0
  40. data/lib/issuingtransaction/issuingtransaction.rb +12 -13
  41. data/lib/issuingwithdrawal/issuingwithdrawal.rb +12 -11
  42. data/lib/merchantcategory/merchantcategory.rb +63 -0
  43. data/lib/merchantcountry/merchantcountry.rb +59 -0
  44. data/lib/pixbalance/pixbalance.rb +5 -5
  45. data/lib/pixchargeback/log.rb +15 -15
  46. data/lib/pixchargeback/pixchargeback.rb +32 -20
  47. data/lib/pixclaim/log.rb +21 -24
  48. data/lib/pixclaim/pixclaim.rb +44 -34
  49. data/lib/pixdirector/pixdirector.rb +9 -11
  50. data/lib/pixdomain/certificate.rb +1 -1
  51. data/lib/pixdomain/pixdomain.rb +5 -5
  52. data/lib/pixinfraction/log.rb +20 -20
  53. data/lib/pixinfraction/pixinfraction.rb +23 -15
  54. data/lib/pixkey/log.rb +23 -23
  55. data/lib/pixkey/pixkey.rb +14 -12
  56. data/lib/pixrequest/log.rb +24 -20
  57. data/lib/pixrequest/pixrequest.rb +54 -21
  58. data/lib/pixreversal/log.rb +3 -3
  59. data/lib/pixreversal/pixreversal.rb +48 -21
  60. data/lib/pixstatement/pixstatement.rb +13 -8
  61. data/lib/starkinfra.rb +40 -15
  62. data/lib/staticbrcode/staticbrcode.rb +170 -0
  63. data/lib/user/project.rb +1 -1
  64. data/lib/utils/api.rb +1 -0
  65. data/lib/utils/bacenid.rb +1 -1
  66. data/lib/utils/parse.rb +7 -3
  67. data/lib/utils/request.rb +1 -1
  68. data/lib/utils/resource.rb +1 -1
  69. data/lib/utils/sub_resource.rb +21 -22
  70. data/lib/webhook/webhook.rb +11 -11
  71. metadata +29 -4
  72. data/lib/issuingauthorization/issuingauthorization.rb +0 -141
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: starkinfra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - starkinfra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-03 00:00:00.000000000 Z
11
+ date: 2023-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: starkbank-ecdsa
@@ -72,26 +72,50 @@ executables: []
72
72
  extensions: []
73
73
  extra_rdoc_files: []
74
74
  files:
75
+ - lib/brcodepreview/brcodepreview.rb
76
+ - lib/cardmethod/cardmethod.rb
77
+ - lib/creditholmes/creditholmes.rb
75
78
  - lib/creditnote/creditnote.rb
79
+ - lib/creditnote/invoice/description.rb
80
+ - lib/creditnote/invoice/discount.rb
81
+ - lib/creditnote/invoice/invoice.rb
76
82
  - lib/creditnote/log.rb
83
+ - lib/creditnote/transfer.rb
84
+ - lib/creditpreview/creditnotepreview.rb
85
+ - lib/creditpreview/creditpreview.rb
86
+ - lib/creditsigner/creditsigner.rb
87
+ - lib/dynamicbrcode/dynamicbrcode.rb
77
88
  - lib/error.rb
78
89
  - lib/event/attempt.rb
79
90
  - lib/event/event.rb
80
- - lib/issuingauthorization/issuingauthorization.rb
91
+ - lib/individualdocument/individualdocument.rb
92
+ - lib/individualdocument/log.rb
93
+ - lib/individualidentity/individualidentity.rb
94
+ - lib/individualidentity/log.rb
81
95
  - lib/issuingbalance/issuingbalance.rb
82
- - lib/issuingbin/issuingbin.rb
83
96
  - lib/issuingcard/issuingcard.rb
84
97
  - lib/issuingcard/log.rb
98
+ - lib/issuingdesign/issuingdesign.rb
99
+ - lib/issuingembossingkit/issuingembossingkit.rb
100
+ - lib/issuingembossingrequest/issuingembossingrequest.rb
101
+ - lib/issuingembossingrequest/log.rb
85
102
  - lib/issuingholder/issuingholder.rb
86
103
  - lib/issuingholder/log.rb
87
104
  - lib/issuinginvoice/issuinginvoice.rb
88
105
  - lib/issuinginvoice/log.rb
106
+ - lib/issuingproduct/issuingproduct.rb
89
107
  - lib/issuingpurchase/issuingpurchase.rb
90
108
  - lib/issuingpurchase/log.rb
109
+ - lib/issuingrestock/issuingrestock.rb
110
+ - lib/issuingrestock/log.rb
91
111
  - lib/issuingrule/issuingrule.rb
112
+ - lib/issuingstock/issuingstock.rb
113
+ - lib/issuingstock/log.rb
92
114
  - lib/issuingtransaction/issuingtransaction.rb
93
115
  - lib/issuingwithdrawal/issuingwithdrawal.rb
94
116
  - lib/key.rb
117
+ - lib/merchantcategory/merchantcategory.rb
118
+ - lib/merchantcountry/merchantcountry.rb
95
119
  - lib/pixbalance/pixbalance.rb
96
120
  - lib/pixchargeback/log.rb
97
121
  - lib/pixchargeback/pixchargeback.rb
@@ -110,6 +134,7 @@ files:
110
134
  - lib/pixreversal/pixreversal.rb
111
135
  - lib/pixstatement/pixstatement.rb
112
136
  - lib/starkinfra.rb
137
+ - lib/staticbrcode/staticbrcode.rb
113
138
  - lib/user/organization.rb
114
139
  - lib/user/project.rb
115
140
  - lib/user/user.rb
@@ -1,141 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative('../utils/resource')
4
- require_relative('../utils/rest')
5
- require_relative('../utils/checks')
6
- require('json')
7
-
8
- module StarkInfra
9
- # # IssuingAuthorization object
10
- #
11
- # An IssuingAuthorization presents purchase data to be analysed and answered with an approval or a declination.
12
- #
13
- # ## Attributes (return-only):
14
- # - id [string]: unique id returned when the IssuingAuthorization is created. ex: '5656565656565656'
15
- # - end_to_end_id [string]: central bank's unique transaction ID. ex: "E79457883202101262140HHX553UPqeq"
16
- # - amount [integer]: IssuingPurchase value in cents. Minimum = 0. ex: 1234 (= R$ 12.34)
17
- # - tax [integer]: IOF amount taxed for international purchases. ex: 1234 (= R$ 12.34)
18
- # - card_id [string]: unique id returned when IssuingCard is created. ex: "5656565656565656"
19
- # - issuer_amount [integer]: issuer amount. ex: 1234 (= R$ 12.34)
20
- # - issuer_currency_code [string]: issuer currency code. ex: "USD"
21
- # - merchant_amount [integer]: merchant amount. ex: 1234 (= R$ 12.34)
22
- # - merchant_currency_code [string]: merchant currency code. ex: "USD"
23
- # - merchant_category_code [string]: merchant category code. ex: "fastFoodRestaurants"
24
- # - merchant_country_code [string]: merchant country code. ex: "USA"
25
- # - acquirer_id [string]: acquirer ID. ex: "5656565656565656"
26
- # - merchant_id [string]: merchant ID. ex: "5656565656565656"
27
- # - merchant_name [string]: merchant name. ex: "Google Cloud Platform"
28
- # - merchant_fee [integer]: merchant fee charged. ex: 200 (= R$ 2.00)
29
- # - wallet_id [string]: virtual wallet ID. ex: "googlePay"
30
- # - method_code [string]: method code. ex: "chip", "token", "server", "manual", "magstripe" or "contactless"
31
- # - score [float]: internal score calculated for the authenticity of the purchase. nil in case of insufficient data. ex: 7.6
32
- # - is_partial_allowed [bool]: true if the the merchant allows partial purchases. ex: False
33
- # - purpose [string]: purchase purpose. ex: "purchase"
34
- # - card_tags [list of strings]: tags of the IssuingCard responsible for this purchase. ex: ["travel", "food"]
35
- # - holder_tags [list of strings]: tags of the IssuingHolder responsible for this purchase. ex: ["technology", "john snow"]
36
- class IssuingAuthorization < StarkInfra::Utils::Resource
37
- attr_reader :id, :end_to_end_id, :amount, :tax, :card_id, :issuer_amount, :issuer_currency_code, :merchant_amount,
38
- :merchant_currency_code, :merchant_category_code, :merchant_country_code, :acquirer_id, :merchant_id,
39
- :merchant_name, :merchant_fee, :wallet_id, :method_code, :score, :is_partial_allowed, :purpose,
40
- :card_tags, :holder_tags
41
- def initialize(
42
- id: nil, end_to_end_id: nil, amount: nil, tax: nil, card_id: nil, issuer_amount: nil,
43
- issuer_currency_code: nil, merchant_amount: nil, merchant_currency_code: nil,
44
- merchant_category_code: nil, merchant_country_code: nil, acquirer_id: nil, merchant_id: nil,
45
- merchant_name: nil, merchant_fee: nil, wallet_id: nil, method_code: nil, score: nil,
46
- is_partial_allowed: nil, purpose: nil, card_tags: nil, holder_tags: nil
47
- )
48
- super(id)
49
- @end_to_end_id = end_to_end_id
50
- @amount = amount
51
- @tax = tax
52
- @card_id = card_id
53
- @issuer_amount = issuer_amount
54
- @issuer_currency_code = issuer_currency_code
55
- @merchant_amount = merchant_amount
56
- @merchant_currency_code = merchant_currency_code
57
- @merchant_category_code = merchant_category_code
58
- @merchant_country_code = merchant_country_code
59
- @acquirer_id = acquirer_id
60
- @merchant_id = merchant_id
61
- @merchant_name = merchant_name
62
- @merchant_fee = merchant_fee
63
- @wallet_id = wallet_id
64
- @method_code = method_code
65
- @score = score
66
- @is_partial_allowed = is_partial_allowed
67
- @purpose = purpose
68
- @card_tags = card_tags
69
- @holder_tags = holder_tags
70
- end
71
-
72
- # # Create single IssuingAuthorization from a content string
73
- #
74
- # Create a single IssuingAuthorization object received from IssuingAuthorization at the informed endpoint.
75
- # If the provided digital signature does not check out with the StarkInfra public key, a
76
- # StarkInfra.Error.InvalidSignatureError will be raised.
77
- #
78
- # ## Parameters (optional):
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
- # - IssuingAuthorization object with updated attributes
83
- def self.parse(content:, signature:, user: nil)
84
- StarkInfra::Utils::Parse.parse_and_verify(content: content, signature: signature, user: user, resource: resource)
85
- end
86
-
87
- # # Helps you respond IssuingAuthorization requests.
88
- #
89
- # ## Parameters (required):
90
- # - status [string]: sub-issuer response to the authorization. ex: 'accepted' or 'denied'
91
- #
92
- # ## Parameters (optional):
93
- # - amount [integer, default 0]: amount in cents that was authorized. ex: 1234 (= R$ 12.34)
94
- # - reason [string, default '']: denial reason. ex: 'other'
95
- # - tags [list of strings, default []]: tags to filter retrieved object. ex: ['tony', 'stark']
96
- #
97
- # ## Return:
98
- # - Dumped JSON string that must be returned to us on the IssuingAuthorization request
99
- def self.response(status:, amount: nil, reason: nil, tags: nil)
100
- response_hash = {
101
- "status": status,
102
- "amount": amount || 0,
103
- "reason": reason || '',
104
- "tags": tags || []
105
- }
106
- response_hash.to_json
107
- end
108
-
109
- def self.resource
110
- {
111
- resource_name: 'IssuingAuthorization',
112
- resource_maker: proc { |json|
113
- IssuingAuthorization.new(
114
- id: json['id'],
115
- end_to_end_id: json['end_to_end_id'],
116
- amount: json['amount'],
117
- tax: json['tax'],
118
- card_id: json['card_id'],
119
- issuer_amount: json['issuer_amount'],
120
- issuer_currency_code: json['issuer_currency_code'],
121
- merchant_amount: json['merchant_amount'],
122
- merchant_currency_code: json['merchant_currency_code'],
123
- merchant_category_code: json['merchant_category_code'],
124
- merchant_country_code: json['merchant_country_code'],
125
- acquirer_id: json['acquirer_id'],
126
- merchant_id: json['merchant_id'],
127
- merchant_name: json['merchant_name'],
128
- merchant_fee: json['merchant_fee'],
129
- wallet_id: json['wallet_id'],
130
- method_code: json['method_code'],
131
- score: json['score'],
132
- is_partial_allowed: json['is_partial_allowed'],
133
- purpose: json['purpose'],
134
- card_tags: json['card_tags'],
135
- holder_tags: json['holder_tags']
136
- )
137
- }
138
- }
139
- end
140
- end
141
- end