bongloy 4.21.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +76 -0
- data/.editorconfig +10 -0
- data/.gitattributes +4 -0
- data/.github/ISSUE_TEMPLATE.md +5 -0
- data/.github/README.md +79 -0
- data/.github/pull.yml +5 -0
- data/.gitignore +8 -0
- data/.rubocop.yml +43 -0
- data/.rubocop_todo.yml +38 -0
- data/.travis.yml +43 -0
- data/.vscode/extensions.json +7 -0
- data/.vscode/settings.json +8 -0
- data/CHANGELOG.md +770 -0
- data/CONTRIBUTORS +3 -0
- data/Gemfile +39 -0
- data/History.txt +1 -0
- data/LICENSE +21 -0
- data/README.md +282 -0
- data/Rakefile +36 -0
- data/VERSION +1 -0
- data/bin/stripe-console +16 -0
- data/bongloy.gemspec +37 -0
- data/lib/bongloy.rb +7 -0
- data/lib/data/ca-certificates.crt +4043 -0
- data/lib/stripe.rb +208 -0
- data/lib/stripe/api_operations/create.rb +12 -0
- data/lib/stripe/api_operations/delete.rb +35 -0
- data/lib/stripe/api_operations/list.rb +30 -0
- data/lib/stripe/api_operations/nested_resource.rb +70 -0
- data/lib/stripe/api_operations/request.rb +53 -0
- data/lib/stripe/api_operations/save.rb +94 -0
- data/lib/stripe/api_resource.rb +107 -0
- data/lib/stripe/errors.rb +156 -0
- data/lib/stripe/list_object.rb +110 -0
- data/lib/stripe/oauth.rb +63 -0
- data/lib/stripe/object_types.rb +98 -0
- data/lib/stripe/resources.rb +79 -0
- data/lib/stripe/resources/account.rb +174 -0
- data/lib/stripe/resources/account_link.rb +9 -0
- data/lib/stripe/resources/alipay_account.rb +34 -0
- data/lib/stripe/resources/apple_pay_domain.rb +16 -0
- data/lib/stripe/resources/application_fee.rb +24 -0
- data/lib/stripe/resources/application_fee_refund.rb +30 -0
- data/lib/stripe/resources/balance.rb +7 -0
- data/lib/stripe/resources/balance_transaction.rb +13 -0
- data/lib/stripe/resources/bank_account.rb +42 -0
- data/lib/stripe/resources/bitcoin_receiver.rb +23 -0
- data/lib/stripe/resources/bitcoin_transaction.rb +15 -0
- data/lib/stripe/resources/capability.rb +33 -0
- data/lib/stripe/resources/card.rb +37 -0
- data/lib/stripe/resources/charge.rb +84 -0
- data/lib/stripe/resources/checkout/session.rb +11 -0
- data/lib/stripe/resources/country_spec.rb +9 -0
- data/lib/stripe/resources/coupon.rb +12 -0
- data/lib/stripe/resources/credit_note.rb +18 -0
- data/lib/stripe/resources/customer.rb +95 -0
- data/lib/stripe/resources/customer_balance_transaction.rb +30 -0
- data/lib/stripe/resources/discount.rb +7 -0
- data/lib/stripe/resources/dispute.rb +23 -0
- data/lib/stripe/resources/ephemeral_key.rb +19 -0
- data/lib/stripe/resources/event.rb +9 -0
- data/lib/stripe/resources/exchange_rate.rb +9 -0
- data/lib/stripe/resources/file.rb +44 -0
- data/lib/stripe/resources/file_link.rb +11 -0
- data/lib/stripe/resources/invoice.rb +48 -0
- data/lib/stripe/resources/invoice_item.rb +12 -0
- data/lib/stripe/resources/invoice_line_item.rb +7 -0
- data/lib/stripe/resources/issuer_fraud_record.rb +9 -0
- data/lib/stripe/resources/issuing/authorization.rb +25 -0
- data/lib/stripe/resources/issuing/card.rb +20 -0
- data/lib/stripe/resources/issuing/card_details.rb +9 -0
- data/lib/stripe/resources/issuing/cardholder.rb +13 -0
- data/lib/stripe/resources/issuing/dispute.rb +13 -0
- data/lib/stripe/resources/issuing/transaction.rb +12 -0
- data/lib/stripe/resources/login_link.rb +14 -0
- data/lib/stripe/resources/order.rb +32 -0
- data/lib/stripe/resources/order_return.rb +9 -0
- data/lib/stripe/resources/payment_intent.rb +30 -0
- data/lib/stripe/resources/payment_method.rb +24 -0
- data/lib/stripe/resources/payout.rb +24 -0
- data/lib/stripe/resources/person.rb +31 -0
- data/lib/stripe/resources/plan.rb +12 -0
- data/lib/stripe/resources/product.rb +12 -0
- data/lib/stripe/resources/radar/early_fraud_warning.rb +11 -0
- data/lib/stripe/resources/radar/value_list.rb +14 -0
- data/lib/stripe/resources/radar/value_list_item.rb +13 -0
- data/lib/stripe/resources/recipient.rb +17 -0
- data/lib/stripe/resources/recipient_transfer.rb +7 -0
- data/lib/stripe/resources/refund.rb +11 -0
- data/lib/stripe/resources/reporting/report_run.rb +12 -0
- data/lib/stripe/resources/reporting/report_type.rb +12 -0
- data/lib/stripe/resources/reversal.rb +29 -0
- data/lib/stripe/resources/review.rb +16 -0
- data/lib/stripe/resources/setup_intent.rb +24 -0
- data/lib/stripe/resources/sigma/scheduled_query_run.rb +15 -0
- data/lib/stripe/resources/sku.rb +12 -0
- data/lib/stripe/resources/source.rb +42 -0
- data/lib/stripe/resources/source_transaction.rb +7 -0
- data/lib/stripe/resources/subscription.rb +25 -0
- data/lib/stripe/resources/subscription_item.rb +17 -0
- data/lib/stripe/resources/subscription_schedule.rb +32 -0
- data/lib/stripe/resources/subscription_schedule_revision.rb +34 -0
- data/lib/stripe/resources/tax_id.rb +26 -0
- data/lib/stripe/resources/tax_rate.rb +11 -0
- data/lib/stripe/resources/terminal/connection_token.rb +11 -0
- data/lib/stripe/resources/terminal/location.rb +14 -0
- data/lib/stripe/resources/terminal/reader.rb +14 -0
- data/lib/stripe/resources/three_d_secure.rb +13 -0
- data/lib/stripe/resources/token.rb +9 -0
- data/lib/stripe/resources/topup.rb +18 -0
- data/lib/stripe/resources/transfer.rb +27 -0
- data/lib/stripe/resources/usage_record.rb +23 -0
- data/lib/stripe/resources/usage_record_summary.rb +7 -0
- data/lib/stripe/resources/webhook_endpoint.rb +12 -0
- data/lib/stripe/singleton_api_resource.rb +26 -0
- data/lib/stripe/stripe_client.rb +686 -0
- data/lib/stripe/stripe_object.rb +583 -0
- data/lib/stripe/stripe_response.rb +50 -0
- data/lib/stripe/util.rb +336 -0
- data/lib/stripe/version.rb +5 -0
- data/lib/stripe/webhook.rb +90 -0
- data/stripe.gemspec +37 -0
- data/test/api_stub_helpers.rb +1 -0
- data/test/openapi/README.md +9 -0
- data/test/stripe/account_link_test.rb +18 -0
- data/test/stripe/account_test.rb +428 -0
- data/test/stripe/alipay_account_test.rb +37 -0
- data/test/stripe/api_operations_test.rb +80 -0
- data/test/stripe/api_resource_test.rb +544 -0
- data/test/stripe/apple_pay_domain_test.rb +46 -0
- data/test/stripe/application_fee_refund_test.rb +37 -0
- data/test/stripe/application_fee_test.rb +58 -0
- data/test/stripe/balance_test.rb +13 -0
- data/test/stripe/bank_account_test.rb +36 -0
- data/test/stripe/capability_test.rb +45 -0
- data/test/stripe/charge_test.rb +80 -0
- data/test/stripe/checkout/session_test.rb +41 -0
- data/test/stripe/country_spec_test.rb +20 -0
- data/test/stripe/coupon_test.rb +61 -0
- data/test/stripe/credit_note_test.rb +61 -0
- data/test/stripe/customer_balance_transaction_test.rb +37 -0
- data/test/stripe/customer_card_test.rb +42 -0
- data/test/stripe/customer_test.rb +269 -0
- data/test/stripe/dispute_test.rb +51 -0
- data/test/stripe/ephemeral_key_test.rb +93 -0
- data/test/stripe/errors_test.rb +20 -0
- data/test/stripe/exchange_rate_test.rb +20 -0
- data/test/stripe/file_link_test.rb +41 -0
- data/test/stripe/file_test.rb +97 -0
- data/test/stripe/file_upload_test.rb +79 -0
- data/test/stripe/invoice_item_test.rb +66 -0
- data/test/stripe/invoice_line_item_test.rb +8 -0
- data/test/stripe/invoice_test.rb +213 -0
- data/test/stripe/issuer_fraud_record_test.rb +20 -0
- data/test/stripe/issuing/authorization_test.rb +72 -0
- data/test/stripe/issuing/card_test.rb +62 -0
- data/test/stripe/issuing/cardholder_test.rb +53 -0
- data/test/stripe/issuing/dispute_test.rb +45 -0
- data/test/stripe/issuing/transaction_test.rb +48 -0
- data/test/stripe/list_object_test.rb +156 -0
- data/test/stripe/login_link_test.rb +37 -0
- data/test/stripe/oauth_test.rb +88 -0
- data/test/stripe/order_return_test.rb +21 -0
- data/test/stripe/order_test.rb +82 -0
- data/test/stripe/payment_intent_test.rb +107 -0
- data/test/stripe/payment_method_test.rb +84 -0
- data/test/stripe/payout_test.rb +57 -0
- data/test/stripe/person_test.rb +46 -0
- data/test/stripe/plan_test.rb +98 -0
- data/test/stripe/product_test.rb +59 -0
- data/test/stripe/radar/early_fraud_warning_test.rb +22 -0
- data/test/stripe/radar/value_list_item_test.rb +48 -0
- data/test/stripe/radar/value_list_test.rb +61 -0
- data/test/stripe/recipient_test.rb +62 -0
- data/test/stripe/refund_test.rb +39 -0
- data/test/stripe/reporting/report_run_test.rb +33 -0
- data/test/stripe/reporting/report_type_test.rb +22 -0
- data/test/stripe/reversal_test.rb +43 -0
- data/test/stripe/review_test.rb +27 -0
- data/test/stripe/setup_intent_test.rb +84 -0
- data/test/stripe/sigma/scheduled_query_run_test.rb +22 -0
- data/test/stripe/sku_test.rb +60 -0
- data/test/stripe/source_test.rb +99 -0
- data/test/stripe/source_transaction_test.rb +19 -0
- data/test/stripe/stripe_client_test.rb +842 -0
- data/test/stripe/stripe_object_test.rb +525 -0
- data/test/stripe/stripe_response_test.rb +49 -0
- data/test/stripe/subscription_item_test.rb +63 -0
- data/test/stripe/subscription_schedule_revision_test.rb +37 -0
- data/test/stripe/subscription_schedule_test.rb +116 -0
- data/test/stripe/subscription_test.rb +80 -0
- data/test/stripe/tax_id_test.rb +31 -0
- data/test/stripe/tax_rate_test.rb +43 -0
- data/test/stripe/terminal/connection_token_test.rb +16 -0
- data/test/stripe/terminal/location_test.rb +68 -0
- data/test/stripe/terminal/reader_test.rb +62 -0
- data/test/stripe/three_d_secure_test.rb +23 -0
- data/test/stripe/topup_test.rb +62 -0
- data/test/stripe/transfer_test.rb +88 -0
- data/test/stripe/usage_record_summary_test.rb +19 -0
- data/test/stripe/usage_record_test.rb +28 -0
- data/test/stripe/util_test.rb +402 -0
- data/test/stripe/webhook_endpoint_test.rb +59 -0
- data/test/stripe/webhook_test.rb +96 -0
- data/test/stripe_mock.rb +77 -0
- data/test/stripe_test.rb +63 -0
- data/test/test_data.rb +61 -0
- data/test/test_helper.rb +71 -0
- metadata +372 -0
@@ -0,0 +1,79 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "stripe/resources/account"
|
4
|
+
require "stripe/resources/account_link"
|
5
|
+
require "stripe/resources/alipay_account"
|
6
|
+
require "stripe/resources/apple_pay_domain"
|
7
|
+
require "stripe/resources/application_fee"
|
8
|
+
require "stripe/resources/application_fee_refund"
|
9
|
+
require "stripe/resources/balance"
|
10
|
+
require "stripe/resources/balance_transaction"
|
11
|
+
require "stripe/resources/bank_account"
|
12
|
+
require "stripe/resources/bitcoin_receiver"
|
13
|
+
require "stripe/resources/bitcoin_transaction"
|
14
|
+
require "stripe/resources/capability"
|
15
|
+
require "stripe/resources/card"
|
16
|
+
require "stripe/resources/charge"
|
17
|
+
require "stripe/resources/checkout/session"
|
18
|
+
require "stripe/resources/country_spec"
|
19
|
+
require "stripe/resources/coupon"
|
20
|
+
require "stripe/resources/credit_note"
|
21
|
+
require "stripe/resources/customer"
|
22
|
+
require "stripe/resources/customer_balance_transaction"
|
23
|
+
require "stripe/resources/discount"
|
24
|
+
require "stripe/resources/dispute"
|
25
|
+
require "stripe/resources/ephemeral_key"
|
26
|
+
require "stripe/resources/event"
|
27
|
+
require "stripe/resources/exchange_rate"
|
28
|
+
require "stripe/resources/file"
|
29
|
+
require "stripe/resources/file_link"
|
30
|
+
require "stripe/resources/invoice"
|
31
|
+
require "stripe/resources/invoice_item"
|
32
|
+
require "stripe/resources/invoice_line_item"
|
33
|
+
require "stripe/resources/issuer_fraud_record"
|
34
|
+
require "stripe/resources/issuing/authorization"
|
35
|
+
require "stripe/resources/issuing/card"
|
36
|
+
require "stripe/resources/issuing/card_details"
|
37
|
+
require "stripe/resources/issuing/cardholder"
|
38
|
+
require "stripe/resources/issuing/dispute"
|
39
|
+
require "stripe/resources/issuing/transaction"
|
40
|
+
require "stripe/resources/login_link"
|
41
|
+
require "stripe/resources/order"
|
42
|
+
require "stripe/resources/order_return"
|
43
|
+
require "stripe/resources/payment_intent"
|
44
|
+
require "stripe/resources/payment_method"
|
45
|
+
require "stripe/resources/payout"
|
46
|
+
require "stripe/resources/person"
|
47
|
+
require "stripe/resources/plan"
|
48
|
+
require "stripe/resources/product"
|
49
|
+
require "stripe/resources/radar/early_fraud_warning"
|
50
|
+
require "stripe/resources/radar/value_list"
|
51
|
+
require "stripe/resources/radar/value_list_item"
|
52
|
+
require "stripe/resources/recipient"
|
53
|
+
require "stripe/resources/recipient_transfer"
|
54
|
+
require "stripe/resources/refund"
|
55
|
+
require "stripe/resources/reporting/report_run"
|
56
|
+
require "stripe/resources/reporting/report_type"
|
57
|
+
require "stripe/resources/reversal"
|
58
|
+
require "stripe/resources/review"
|
59
|
+
require "stripe/resources/setup_intent"
|
60
|
+
require "stripe/resources/sigma/scheduled_query_run"
|
61
|
+
require "stripe/resources/sku"
|
62
|
+
require "stripe/resources/source"
|
63
|
+
require "stripe/resources/source_transaction"
|
64
|
+
require "stripe/resources/subscription"
|
65
|
+
require "stripe/resources/subscription_item"
|
66
|
+
require "stripe/resources/subscription_schedule"
|
67
|
+
require "stripe/resources/subscription_schedule_revision"
|
68
|
+
require "stripe/resources/tax_id"
|
69
|
+
require "stripe/resources/tax_rate"
|
70
|
+
require "stripe/resources/terminal/connection_token"
|
71
|
+
require "stripe/resources/terminal/location"
|
72
|
+
require "stripe/resources/terminal/reader"
|
73
|
+
require "stripe/resources/three_d_secure"
|
74
|
+
require "stripe/resources/token"
|
75
|
+
require "stripe/resources/topup"
|
76
|
+
require "stripe/resources/transfer"
|
77
|
+
require "stripe/resources/usage_record"
|
78
|
+
require "stripe/resources/usage_record_summary"
|
79
|
+
require "stripe/resources/webhook_endpoint"
|
@@ -0,0 +1,174 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Stripe
|
4
|
+
class Account < APIResource
|
5
|
+
extend Gem::Deprecate
|
6
|
+
extend Stripe::APIOperations::Create
|
7
|
+
include Stripe::APIOperations::Delete
|
8
|
+
extend Stripe::APIOperations::List
|
9
|
+
include Stripe::APIOperations::Save
|
10
|
+
extend Stripe::APIOperations::NestedResource
|
11
|
+
|
12
|
+
OBJECT_NAME = "account".freeze
|
13
|
+
|
14
|
+
custom_method :reject, http_verb: :post
|
15
|
+
|
16
|
+
nested_resource_class_methods :capability,
|
17
|
+
operations: %i[retrieve update list],
|
18
|
+
resource_plural: "capabilities"
|
19
|
+
nested_resource_class_methods :person,
|
20
|
+
operations: %i[create retrieve update delete list]
|
21
|
+
|
22
|
+
def reject(params = {}, opts = {})
|
23
|
+
resp, opts = request(:post, resource_url + "/reject", params, opts)
|
24
|
+
initialize_from(resp.data, opts)
|
25
|
+
end
|
26
|
+
|
27
|
+
save_nested_resource :external_account
|
28
|
+
|
29
|
+
nested_resource_class_methods :external_account,
|
30
|
+
operations: %i[create retrieve update delete list]
|
31
|
+
|
32
|
+
nested_resource_class_methods :login_link, operations: %i[create]
|
33
|
+
|
34
|
+
# This method is deprecated. Please use `#external_account=` instead.
|
35
|
+
save_nested_resource :bank_account
|
36
|
+
deprecate :bank_account=, "#external_account=", 2017, 8
|
37
|
+
|
38
|
+
def resource_url
|
39
|
+
if self["id"]
|
40
|
+
super
|
41
|
+
else
|
42
|
+
"/v1/account"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# @override To make id optional
|
47
|
+
def self.retrieve(id = ARGUMENT_NOT_PROVIDED, opts = {})
|
48
|
+
id = if id.equal?(ARGUMENT_NOT_PROVIDED)
|
49
|
+
nil
|
50
|
+
else
|
51
|
+
Util.check_string_argument!(id)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Account used to be a singleton, where this method's signature was
|
55
|
+
# `(opts={})`. For the sake of not breaking folks who pass in an OAuth
|
56
|
+
# key in opts, let's lurkily string match for it.
|
57
|
+
if opts == {} && id.is_a?(String) && id.start_with?("sk_")
|
58
|
+
# `super` properly assumes a String opts is the apiKey and normalizes
|
59
|
+
# as expected.
|
60
|
+
opts = id
|
61
|
+
id = nil
|
62
|
+
end
|
63
|
+
super(id, opts)
|
64
|
+
end
|
65
|
+
|
66
|
+
def persons(params = {}, opts = {})
|
67
|
+
resp, opts = request(:get, resource_url + "/persons", params, opts)
|
68
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
69
|
+
end
|
70
|
+
|
71
|
+
# We are not adding a helper for capabilities here as the Account object
|
72
|
+
# already has a capabilities property which is a hash and not the sub-list
|
73
|
+
# of capabilities.
|
74
|
+
|
75
|
+
# Somewhat unfortunately, we attempt to do a special encoding trick when
|
76
|
+
# serializing `additional_owners` under an account: when updating a value,
|
77
|
+
# we actually send the update parameters up as an integer-indexed hash
|
78
|
+
# rather than an array. So instead of this:
|
79
|
+
#
|
80
|
+
# field[]=item1&field[]=item2&field[]=item3
|
81
|
+
#
|
82
|
+
# We send this:
|
83
|
+
#
|
84
|
+
# field[0]=item1&field[1]=item2&field[2]=item3
|
85
|
+
#
|
86
|
+
# There are two major problems with this technique:
|
87
|
+
#
|
88
|
+
# * Entities are addressed by array index, which is not stable and can
|
89
|
+
# easily result in unexpected results between two different requests.
|
90
|
+
#
|
91
|
+
# * A replacement of the array's contents is ambiguous with setting a
|
92
|
+
# subset of the array. Because of this, the only way to shorten an
|
93
|
+
# array is to unset it completely by making sure it goes into the
|
94
|
+
# server as an empty string, then setting its contents again.
|
95
|
+
#
|
96
|
+
# We're trying to get this overturned on the server side, but for now,
|
97
|
+
# patch in a special allowance.
|
98
|
+
def serialize_params(options = {})
|
99
|
+
serialize_params_account(self, super, options)
|
100
|
+
end
|
101
|
+
|
102
|
+
def serialize_params_account(_obj, update_hash, options = {})
|
103
|
+
if (entity = @values[:legal_entity])
|
104
|
+
if (owners = entity[:additional_owners])
|
105
|
+
entity_update = update_hash[:legal_entity] ||= {}
|
106
|
+
entity_update[:additional_owners] =
|
107
|
+
serialize_additional_owners(entity, owners)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
if (individual = @values[:individual])
|
111
|
+
if individual.is_a?(Person) && !update_hash.key?(:individual)
|
112
|
+
update_hash[:individual] = individual.serialize_params(options)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
update_hash
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.protected_fields
|
119
|
+
[:legal_entity]
|
120
|
+
end
|
121
|
+
|
122
|
+
def legal_entity
|
123
|
+
self["legal_entity"]
|
124
|
+
end
|
125
|
+
|
126
|
+
def legal_entity=(_legal_entity)
|
127
|
+
raise NoMethodError,
|
128
|
+
"Overriding legal_entity can cause serious issues. Instead, set " \
|
129
|
+
"the individual fields of legal_entity like " \
|
130
|
+
"`account.legal_entity.first_name = 'Blah'`"
|
131
|
+
end
|
132
|
+
|
133
|
+
def deauthorize(client_id = nil, opts = {})
|
134
|
+
params = {
|
135
|
+
client_id: client_id,
|
136
|
+
stripe_user_id: id,
|
137
|
+
}
|
138
|
+
OAuth.deauthorize(params, opts)
|
139
|
+
end
|
140
|
+
|
141
|
+
ARGUMENT_NOT_PROVIDED = Object.new
|
142
|
+
|
143
|
+
private def serialize_additional_owners(legal_entity, additional_owners)
|
144
|
+
original_value =
|
145
|
+
legal_entity
|
146
|
+
.instance_variable_get(:@original_values)[:additional_owners]
|
147
|
+
if original_value && original_value.length > additional_owners.length
|
148
|
+
# url params provide no mechanism for deleting an item in an array,
|
149
|
+
# just overwriting the whole array or adding new items. So let's not
|
150
|
+
# allow deleting without a full overwrite until we have a solution.
|
151
|
+
raise ArgumentError,
|
152
|
+
"You cannot delete an item from an array, you must instead " \
|
153
|
+
"set a new array"
|
154
|
+
end
|
155
|
+
|
156
|
+
update_hash = {}
|
157
|
+
additional_owners.each_with_index do |v, i|
|
158
|
+
# We will almost always see a StripeObject except in the case of a Hash
|
159
|
+
# that's been appended to an array of `additional_owners`. We may be
|
160
|
+
# able to normalize that ugliness by using an array proxy object with
|
161
|
+
# StripeObjects that can detect appends and replace a hash with a
|
162
|
+
# StripeObject.
|
163
|
+
update = v.is_a?(StripeObject) ? v.serialize_params : v
|
164
|
+
|
165
|
+
next unless update != {} && (!original_value ||
|
166
|
+
update != legal_entity.serialize_params_value(original_value[i], nil,
|
167
|
+
false, true))
|
168
|
+
|
169
|
+
update_hash[i.to_s] = update
|
170
|
+
end
|
171
|
+
update_hash
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Stripe
|
4
|
+
class AlipayAccount < APIResource
|
5
|
+
include Stripe::APIOperations::Save
|
6
|
+
include Stripe::APIOperations::Delete
|
7
|
+
|
8
|
+
OBJECT_NAME = "alipay_account".freeze
|
9
|
+
|
10
|
+
def resource_url
|
11
|
+
if !respond_to?(:customer) || customer.nil?
|
12
|
+
raise NotImplementedError,
|
13
|
+
"Alipay accounts cannot be accessed without a customer ID."
|
14
|
+
end
|
15
|
+
|
16
|
+
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources" \
|
17
|
+
"/#{CGI.escape(id)}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.update(_id, _params = nil, _opts = nil)
|
21
|
+
raise NotImplementedError,
|
22
|
+
"Alipay accounts cannot be updated without a customer ID. " \
|
23
|
+
"Update an Alipay account using `Customer.update_source(" \
|
24
|
+
"'customer_id', 'alipay_account_id', update_params)`"
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.retrieve(_id, _opts = nil)
|
28
|
+
raise NotImplementedError,
|
29
|
+
"Alipay accounts cannot be retrieved without a customer ID. " \
|
30
|
+
"Retrieve an Alipay account using `Customer.retrieve_source(" \
|
31
|
+
"'customer_id', 'alipay_account_id')`"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Stripe
|
4
|
+
# Domains registered for Apple Pay on the Web
|
5
|
+
class ApplePayDomain < APIResource
|
6
|
+
extend Stripe::APIOperations::Create
|
7
|
+
include Stripe::APIOperations::Delete
|
8
|
+
extend Stripe::APIOperations::List
|
9
|
+
|
10
|
+
OBJECT_NAME = "apple_pay_domain".freeze
|
11
|
+
|
12
|
+
def self.resource_url
|
13
|
+
"/v1/apple_pay/domains"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Stripe
|
4
|
+
class ApplicationFee < APIResource
|
5
|
+
extend Stripe::APIOperations::List
|
6
|
+
extend Stripe::APIOperations::NestedResource
|
7
|
+
|
8
|
+
OBJECT_NAME = "application_fee".freeze
|
9
|
+
|
10
|
+
nested_resource_class_methods :refund,
|
11
|
+
operations: %i[create retrieve update list]
|
12
|
+
|
13
|
+
# If you don't need access to an updated fee object after the refund, it's
|
14
|
+
# more performant to just call `fee.refunds.create` directly.
|
15
|
+
def refund(params = {}, opts = {})
|
16
|
+
refunds.create(params, opts)
|
17
|
+
|
18
|
+
# now that a refund has been created, we expect the state of this object
|
19
|
+
# to change as well (i.e. `refunded` will now be `true`) so refresh it
|
20
|
+
# from the server
|
21
|
+
refresh
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Stripe
|
4
|
+
class ApplicationFeeRefund < APIResource
|
5
|
+
include Stripe::APIOperations::Save
|
6
|
+
extend Stripe::APIOperations::List
|
7
|
+
|
8
|
+
OBJECT_NAME = "fee_refund".freeze
|
9
|
+
|
10
|
+
def resource_url
|
11
|
+
"#{ApplicationFee.resource_url}/#{CGI.escape(fee)}/refunds" \
|
12
|
+
"/#{CGI.escape(id)}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.update(_id, _params = nil, _opts = nil)
|
16
|
+
raise NotImplementedError,
|
17
|
+
"Application fee refunds cannot be updated without an " \
|
18
|
+
"application fee ID. Update an application fee refund using " \
|
19
|
+
"`ApplicationFee.update_refund('fee_id', 'refund_id', " \
|
20
|
+
"update_params)`"
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.retrieve(_id, _api_key = nil)
|
24
|
+
raise NotImplementedError,
|
25
|
+
"Application fee refunds cannot be retrieved without an " \
|
26
|
+
"application fee ID. Retrieve an application fee refund using " \
|
27
|
+
"`ApplicationFee.retrieve_refund('fee_id', 'refund_id')`"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Stripe
|
4
|
+
class BankAccount < APIResource
|
5
|
+
include Stripe::APIOperations::Delete
|
6
|
+
extend Stripe::APIOperations::List
|
7
|
+
include Stripe::APIOperations::Save
|
8
|
+
|
9
|
+
OBJECT_NAME = "bank_account".freeze
|
10
|
+
|
11
|
+
def verify(params = {}, opts = {})
|
12
|
+
resp, opts = request(:post, resource_url + "/verify", params, opts)
|
13
|
+
initialize_from(resp.data, opts)
|
14
|
+
end
|
15
|
+
|
16
|
+
def resource_url
|
17
|
+
if respond_to?(:customer)
|
18
|
+
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
|
19
|
+
elsif respond_to?(:account)
|
20
|
+
"#{Account.resource_url}/#{CGI.escape(account)}/external_accounts/#{CGI.escape(id)}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.update(_id, _params = nil, _opts = nil)
|
25
|
+
raise NotImplementedError,
|
26
|
+
"Bank accounts cannot be updated without a customer ID or an " \
|
27
|
+
" account ID. Update a bank account using " \
|
28
|
+
"`Customer.update_source('customer_id', 'bank_account_id', " \
|
29
|
+
"update_params)` or `Account.update_external_account(" \
|
30
|
+
"'account_id', 'bank_account_id', update_params)`"
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.retrieve(_id, _opts = nil)
|
34
|
+
raise NotImplementedError,
|
35
|
+
"Bank accounts cannot be retrieve without a customer ID or an " \
|
36
|
+
"account ID. Retrieve a bank account using " \
|
37
|
+
"`Customer.retrieve_source('customer_id', 'bank_account_id')` " \
|
38
|
+
"or `Account.retrieve_external_account('account_id', " \
|
39
|
+
"'bank_account_id')`"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Stripe
|
4
|
+
# Directly creating or retrieving BitcoinReceivers is deprecated. Please use
|
5
|
+
# the Sources API instead: https://stripe.com/docs/sources/bitcoin
|
6
|
+
class BitcoinReceiver < APIResource
|
7
|
+
extend Stripe::APIOperations::List
|
8
|
+
|
9
|
+
OBJECT_NAME = "bitcoin_receiver".freeze
|
10
|
+
|
11
|
+
def self.resource_url
|
12
|
+
"/v1/bitcoin/receivers"
|
13
|
+
end
|
14
|
+
|
15
|
+
def resource_url
|
16
|
+
if respond_to?(:customer) && !customer.nil? && customer != ""
|
17
|
+
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
|
18
|
+
else
|
19
|
+
"#{self.class.resource_url}/#{CGI.escape(id)}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|