Class: StarkInfra::IssuingPurchase
- Inherits:
-
Utils::Resource
- Object
- Utils::SubResource
- Utils::Resource
- StarkInfra::IssuingPurchase
- Defined in:
- lib/issuingpurchase/issuingpurchase.rb,
lib/issuingpurchase/log.rb
Overview
# IssuingPurchase object
Displays the IssuingPurchase objects created in your Workspace.
## Attributes (return-only):
-
id [string]: unique id returned when IssuingPurchase is created. ex: ‘5656565656565656’
-
holder_name [string]: card holder name. ex: ‘Tony Stark’
-
card_id [string]: unique id returned when IssuingCard is created. ex: ‘5656565656565656’
-
card_ending [string]: last 4 digits of the card number. ex: ‘1234’
-
amount [integer]: IssuingPurchase value in cents. Minimum = 0. ex: 1234 (= R$ 12.34)
-
tax [integer]: IOF amount taxed for international purchases. ex: 1234 (= R$ 12.34)
-
issuer_amount [integer]: issuer amount. ex: 1234 (= R$ 12.34)
-
issuer_currency_code [string]: issuer currency code. ex: ‘USD’
-
issuer_currency_symbol [string]: issuer currency symbol. ex: ‘$’
-
merchant_amount [integer]: merchant amount. ex: 1234 (= R$ 12.34)
-
merchant_currency_code [string]: merchant currency code. ex: ‘USD’
-
merchant_currency_symbol [string]: merchant currency symbol. ex: ‘$’
-
merchant_category_code [string]: merchant category code. ex: ‘fastFoodRestaurants’
-
merchant_country_code [string]: merchant country code. ex: ‘USA’
-
acquirer_id [string]: acquirer ID. ex: ‘5656565656565656’
-
merchant_id [string]: merchant ID. ex: ‘5656565656565656’
-
merchant_name [string]: merchant name. ex: ‘Google Cloud Platform’
-
merchant_fee [integer]: fee charged by the merchant to cover specific costs, such as ATM withdrawal logistics, etc. ex: 200 (= R$ 2.00)
-
wallet_id [string]: virtual wallet ID. ex: ‘5656565656565656’
-
method_code [string]: method code. ex: ‘chip’, ‘token’, ‘server’, ‘manual’, ‘magstripe’ or ‘contactless’
-
score [float]: internal score calculated for the authenticity of the purchase. nil in case of insufficient data. ex: 7.6
-
issuing_transaction_ids [string]: ledger transaction ids linked to this Purchase
-
end_to_end_id [string]: Unique id used to identify the transaction through all of its life cycle, even before the purchase is denied or accepted and gets its usual id. Example: endToEndId=‘679cd385-642b-49d0-96b7-89491e1249a5’
-
status [string]: current IssuingCard status. ex: ‘approved’, ‘canceled’, ‘denied’, ‘confirmed’, ‘voided’
-
tags [string]: list of strings for tagging returned by the sub-issuer during the authorization. ex: [‘travel’, ‘food’]
-
created [DateTime]: creation datetime for the IssuingPurchase. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
-
updated [DateTime]: latest update datetime for the IssuingPurchase. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
Defined Under Namespace
Classes: Log
Instance Attribute Summary collapse
-
#acquirer_id ⇒ Object
readonly
Returns the value of attribute acquirer_id.
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#card_ending ⇒ Object
readonly
Returns the value of attribute card_ending.
-
#card_id ⇒ Object
readonly
Returns the value of attribute card_id.
-
#created ⇒ Object
readonly
Returns the value of attribute created.
-
#end_to_end_id ⇒ Object
readonly
Returns the value of attribute end_to_end_id.
-
#holder_name ⇒ Object
readonly
Returns the value of attribute holder_name.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#issuer_amount ⇒ Object
readonly
Returns the value of attribute issuer_amount.
-
#issuer_currency_code ⇒ Object
readonly
Returns the value of attribute issuer_currency_code.
-
#issuer_currency_symbol ⇒ Object
readonly
Returns the value of attribute issuer_currency_symbol.
-
#issuing_transaction_ids ⇒ Object
readonly
Returns the value of attribute issuing_transaction_ids.
-
#merchant_amount ⇒ Object
readonly
Returns the value of attribute merchant_amount.
-
#merchant_category_code ⇒ Object
readonly
Returns the value of attribute merchant_category_code.
-
#merchant_country_code ⇒ Object
readonly
Returns the value of attribute merchant_country_code.
-
#merchant_currency_code ⇒ Object
readonly
Returns the value of attribute merchant_currency_code.
-
#merchant_currency_symbol ⇒ Object
readonly
Returns the value of attribute merchant_currency_symbol.
-
#merchant_fee ⇒ Object
readonly
Returns the value of attribute merchant_fee.
-
#merchant_id ⇒ Object
readonly
Returns the value of attribute merchant_id.
-
#merchant_name ⇒ Object
readonly
Returns the value of attribute merchant_name.
-
#method_code ⇒ Object
readonly
Returns the value of attribute method_code.
-
#score ⇒ Object
readonly
Returns the value of attribute score.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#tax ⇒ Object
readonly
Returns the value of attribute tax.
-
#updated ⇒ Object
readonly
Returns the value of attribute updated.
-
#wallet_id ⇒ Object
readonly
Returns the value of attribute wallet_id.
Class Method Summary collapse
-
.get(id, user: nil) ⇒ Object
# Retrieve a specific IssuingPurchase.
-
.page(cursor: nil, ids: nil, limit: nil, after: nil, before: nil, end_to_end_ids: nil, holder_ids: nil, card_ids: nil, status: nil, user: nil) ⇒ Object
# Retrieve paged IssuingPurchases.
-
.query(ids: nil, limit: nil, after: nil, before: nil, end_to_end_ids: nil, holder_ids: nil, card_ids: nil, status: nil, user: nil) ⇒ Object
# Retrieve IssuingPurchase.
- .resource ⇒ Object
Instance Method Summary collapse
Methods inherited from Utils::SubResource
Constructor Details
#initialize(id: nil, holder_name: nil, card_id: nil, card_ending: nil, amount: nil, tax: nil, issuer_amount: nil, issuer_currency_code: nil, issuer_currency_symbol: nil, merchant_amount: nil, merchant_currency_code: nil, merchant_currency_symbol: nil, merchant_category_code: nil, merchant_country_code: nil, acquirer_id: nil, merchant_id: nil, merchant_name: nil, merchant_fee: nil, wallet_id: nil, method_code: nil, score: nil, issuing_transaction_ids: nil, end_to_end_id: nil, status: nil, tags: nil, updated: nil, created: nil) ⇒ IssuingPurchase
Returns a new instance of IssuingPurchase.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 47 def initialize( id: nil, holder_name: nil, card_id: nil, card_ending: nil, amount: nil, tax: nil, issuer_amount: nil, issuer_currency_code: nil, issuer_currency_symbol: nil, merchant_amount: nil, merchant_currency_code: nil, merchant_currency_symbol: nil, merchant_category_code: nil, merchant_country_code: nil, acquirer_id: nil, merchant_id: nil, merchant_name: nil, merchant_fee: nil, wallet_id: nil, method_code: nil, score: nil, issuing_transaction_ids: nil, end_to_end_id: nil, status: nil, tags: nil, updated: nil, created: nil ) super(id) @holder_name = holder_name @card_id = card_id @card_ending = card_ending @amount = amount @tax = tax @issuer_amount = issuer_amount @issuer_currency_code = issuer_currency_code @issuer_currency_symbol = issuer_currency_symbol @merchant_amount = merchant_amount @merchant_currency_code = merchant_currency_code @merchant_currency_symbol = merchant_currency_symbol @merchant_category_code = merchant_category_code @merchant_country_code = merchant_country_code @acquirer_id = acquirer_id @merchant_id = merchant_id @merchant_name = merchant_name @merchant_fee = merchant_fee @wallet_id = wallet_id @method_code = method_code @score = score @issuing_transaction_ids = issuing_transaction_ids @end_to_end_id = end_to_end_id @status = status @tags = @created = StarkInfra::Utils::Checks.check_datetime(created) @updated = StarkInfra::Utils::Checks.check_datetime(updated) end |
Instance Attribute Details
#acquirer_id ⇒ Object (readonly)
Returns the value of attribute acquirer_id.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def acquirer_id @acquirer_id end |
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def amount @amount end |
#card_ending ⇒ Object (readonly)
Returns the value of attribute card_ending.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def card_ending @card_ending end |
#card_id ⇒ Object (readonly)
Returns the value of attribute card_id.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def card_id @card_id end |
#created ⇒ Object (readonly)
Returns the value of attribute created.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def created @created end |
#end_to_end_id ⇒ Object (readonly)
Returns the value of attribute end_to_end_id.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def end_to_end_id @end_to_end_id end |
#holder_name ⇒ Object (readonly)
Returns the value of attribute holder_name.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def holder_name @holder_name end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def id @id end |
#issuer_amount ⇒ Object (readonly)
Returns the value of attribute issuer_amount.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def issuer_amount @issuer_amount end |
#issuer_currency_code ⇒ Object (readonly)
Returns the value of attribute issuer_currency_code.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def issuer_currency_code @issuer_currency_code end |
#issuer_currency_symbol ⇒ Object (readonly)
Returns the value of attribute issuer_currency_symbol.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def issuer_currency_symbol @issuer_currency_symbol end |
#issuing_transaction_ids ⇒ Object (readonly)
Returns the value of attribute issuing_transaction_ids.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def issuing_transaction_ids @issuing_transaction_ids end |
#merchant_amount ⇒ Object (readonly)
Returns the value of attribute merchant_amount.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def merchant_amount @merchant_amount end |
#merchant_category_code ⇒ Object (readonly)
Returns the value of attribute merchant_category_code.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def merchant_category_code @merchant_category_code end |
#merchant_country_code ⇒ Object (readonly)
Returns the value of attribute merchant_country_code.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def merchant_country_code @merchant_country_code end |
#merchant_currency_code ⇒ Object (readonly)
Returns the value of attribute merchant_currency_code.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def merchant_currency_code @merchant_currency_code end |
#merchant_currency_symbol ⇒ Object (readonly)
Returns the value of attribute merchant_currency_symbol.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def merchant_currency_symbol @merchant_currency_symbol end |
#merchant_fee ⇒ Object (readonly)
Returns the value of attribute merchant_fee.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def merchant_fee @merchant_fee end |
#merchant_id ⇒ Object (readonly)
Returns the value of attribute merchant_id.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def merchant_id @merchant_id end |
#merchant_name ⇒ Object (readonly)
Returns the value of attribute merchant_name.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def merchant_name @merchant_name end |
#method_code ⇒ Object (readonly)
Returns the value of attribute method_code.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def method_code @method_code end |
#score ⇒ Object (readonly)
Returns the value of attribute score.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def score @score end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def status @status end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def @tags end |
#tax ⇒ Object (readonly)
Returns the value of attribute tax.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def tax @tax end |
#updated ⇒ Object (readonly)
Returns the value of attribute updated.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def updated @updated end |
#wallet_id ⇒ Object (readonly)
Returns the value of attribute wallet_id.
41 42 43 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 41 def wallet_id @wallet_id end |
Class Method Details
.get(id, user: nil) ⇒ Object
# Retrieve a specific IssuingPurchase
Receive a single IssuingPurchase object previously created in the Stark Infra API by its id
## Parameters (required):
-
id [string]: object unique id. ex: ‘5656565656565656’
## Parameters (optional):
-
user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
## Return:
-
IssuingPurchase object with updated attributes
95 96 97 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 95 def self.get(id, user: nil) StarkInfra::Utils::Rest.get_id(id: id, user: user, **resource) end |
.page(cursor: nil, ids: nil, limit: nil, after: nil, before: nil, end_to_end_ids: nil, holder_ids: nil, card_ids: nil, status: nil, user: nil) ⇒ Object
# Retrieve paged IssuingPurchases
Receive a list of IssuingPurchase objects previously created in the Stark Infra API and the cursor to the next page.
## Parameters (optional):
-
cursor [string, default nil]: cursor returned on the previous page function call.
-
ids [list of strings, default nil]: purchase IDs. ex: [‘5656565656565656’, ‘4545454545454545’]
-
limit [integer, default 100]: maximum number of objects to be retrieved. Max = 100. ex: 35
-
after [Date or string, default nil] date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
-
before [Date or string, default nil] date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
-
end_to_end_ids [list of strings, default []]: central bank’s unique transaction ID. ex: ‘E79457883202101262140HHX553UPqeq’
-
holder_ids [list of strings, default []]: card holder IDs. ex: [‘5656565656565656’, ‘4545454545454545’]
-
card_ids [list of strings, default []]: card IDs. ex: [‘5656565656565656’, ‘4545454545454545’]
-
status [list of strings, default nil]: filter for status of retrieved objects. ex: [‘approved’, ‘canceled’, ‘denied’, ‘confirmed’, ‘voided’]
-
user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
## Return:
-
list of IssuingPurchases objects with updated attributes
-
cursor to retrieve the next page of IssuingPurchases objects
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 153 def self.page(cursor: nil, ids: nil, limit: nil, after: nil, before: nil, end_to_end_ids: nil, holder_ids: nil, card_ids: nil, status: nil, user: nil) after = StarkInfra::Utils::Checks.check_date(after) before = StarkInfra::Utils::Checks.check_date(before) StarkInfra::Utils::Rest.get_page( cursor: cursor, ids: ids, limit: limit, after: after, before: before, end_to_end_ids: end_to_end_ids, holder_ids: holder_ids, card_ids: card_ids, status: status, user: user, **resource ) end |
.query(ids: nil, limit: nil, after: nil, before: nil, end_to_end_ids: nil, holder_ids: nil, card_ids: nil, status: nil, user: nil) ⇒ Object
# Retrieve IssuingPurchase
Receive a generator of IssuingPurchases objects previously created in the Stark Infra API
## Parameters (optional):
-
ids [list of strings, default nil]: purchase IDs. ex: [‘5656565656565656’, ‘4545454545454545’]
-
limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
-
after [Date or string, default nil] date filter for objects created only after specified date. ex: Date.new(2020, 3, 09)
-
before [Date or string, default nil] date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
-
end_to_end_ids [list of strings, default []]: central bank’s unique transaction ID. ex: ‘E79457883202101262140HHX553UPqeq’
-
holder_ids [list of strings, default []]: card holder IDs. ex: [‘5656565656565656’, ‘4545454545454545’]
-
card_ids [list of strings, default []]: card IDs. ex: [‘5656565656565656’, ‘4545454545454545’]
-
status [list of strings, default nil]: filter for status of retrieved objects. ex: [‘approved’, ‘canceled’, ‘denied’, ‘confirmed’, ‘voided’]
-
user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
## Return:
-
generator of IssuingPurchases objects with updated attributes
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 116 def self.query(ids: nil, limit: nil, after: nil, before: nil, end_to_end_ids: nil, holder_ids: nil, card_ids: nil, status: nil, user: nil) after = StarkInfra::Utils::Checks.check_date(after) before = StarkInfra::Utils::Checks.check_date(before) StarkInfra::Utils::Rest.get_stream( ids: ids, limit: limit, after: after, before: before, end_to_end_ids: end_to_end_ids, holder_ids: holder_ids, card_ids: card_ids, status: status, user: user, **resource ) end |
.resource ⇒ Object
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/issuingpurchase/issuingpurchase.rb', line 172 def self.resource { resource_name: 'IssuingPurchase', resource_maker: proc { |json| IssuingPurchase.new( id: json['id'], holder_name: json['holder_name'], card_id: json['card_id'], card_ending: json['card_ending'], amount: json['amount'], tax: json['tax'], issuer_amount: json['issuer_amount'], issuer_currency_code: json['issuer_currency_code'], issuer_currency_symbol: json['issuer_currency_symbol'], merchant_amount: json['merchant_amount'], merchant_currency_code: json['merchant_currency_code'], merchant_currency_symbol: json['merchant_currency_symbol'], merchant_category_code: json['merchant_category_code'], merchant_country_code: json['merchant_country_code'], acquirer_id: json['acquirer_id'], merchant_id: json['merchant_id'], merchant_name: json['merchant_name'], merchant_fee: json['merchant_fee'], wallet_id: json['wallet_id'], method_code: json['method_code'], score: json['score'], issuing_transaction_ids: json['issuing_transaction_ids'], end_to_end_id: json['end_to_end_id'], status: json['status'], tags: json['tags'], updated: json['updated'], created: json['created'] ) } } end |