balanced 0.8.2 → 1.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rbenv-version +1 -1
- data/.ruby-version +1 -1
- data/Gemfile +7 -3
- data/README.md +2 -10
- data/Rakefile +4 -18
- data/balanced.gemspec +8 -10
- data/lib/balanced.rb +28 -28
- data/lib/balanced/client.rb +15 -6
- data/lib/balanced/error.rb +21 -12
- data/lib/balanced/pager.rb +66 -25
- data/lib/balanced/resources.rb +18 -17
- data/lib/balanced/resources/api_key.rb +4 -0
- data/lib/balanced/resources/bank_account.rb +26 -75
- data/lib/balanced/resources/callback.rb +2 -0
- data/lib/balanced/resources/card.rb +15 -65
- data/lib/balanced/resources/card_hold.rb +38 -0
- data/lib/balanced/resources/credit.rb +6 -50
- data/lib/balanced/resources/customer.rb +33 -71
- data/lib/balanced/resources/debit.rb +6 -14
- data/lib/balanced/resources/event.rb +6 -0
- data/lib/balanced/resources/funding_instrument.rb +11 -0
- data/lib/balanced/resources/hypermedia.rb +28 -0
- data/lib/balanced/resources/marketplace.rb +5 -203
- data/lib/balanced/resources/order.rb +71 -0
- data/lib/balanced/resources/refund.rb +2 -7
- data/lib/balanced/resources/resource.rb +169 -106
- data/lib/balanced/resources/reversal.rb +2 -8
- data/lib/balanced/resources/transfer.rb +11 -0
- data/lib/balanced/response/balanced_exception_middleware.rb +2 -2
- data/lib/balanced/utils.rb +47 -14
- data/lib/balanced/version.rb +1 -1
- data/scenario.cache +526 -380
- data/scenarios/api_key_create/definition.rb +1 -0
- data/scenarios/api_key_create/request.rb +2 -0
- data/scenarios/api_key_create/ruby.mako +21 -0
- data/scenarios/api_key_delete/definition.rb +1 -0
- data/scenarios/api_key_delete/request.rb +3 -0
- data/scenarios/api_key_delete/ruby.mako +12 -0
- data/scenarios/api_key_list/definition.rb +1 -0
- data/scenarios/api_key_list/request.rb +2 -0
- data/scenarios/api_key_list/ruby.mako +28 -0
- data/scenarios/api_key_show/definition.rb +1 -0
- data/scenarios/api_key_show/request.rb +2 -0
- data/scenarios/api_key_show/ruby.mako +18 -0
- data/scenarios/{customer_add_bank_account → bank_account_associate_to_customer}/definition.rb +0 -0
- data/scenarios/bank_account_associate_to_customer/request.rb +3 -0
- data/scenarios/bank_account_associate_to_customer/ruby.mako +49 -0
- data/scenarios/bank_account_create/definition.rb +1 -1
- data/scenarios/bank_account_create/request.rb +1 -1
- data/scenarios/bank_account_create/ruby.mako +44 -7
- data/scenarios/{credit_create_existing_bank_account → bank_account_credit}/definition.rb +0 -0
- data/scenarios/bank_account_credit/request.rb +3 -0
- data/scenarios/bank_account_credit/ruby.mako +42 -0
- data/scenarios/bank_account_debit/definition.rb +1 -0
- data/scenarios/bank_account_debit/request.rb +5 -0
- data/scenarios/bank_account_debit/ruby.mako +50 -0
- data/scenarios/bank_account_delete/request.rb +1 -1
- data/scenarios/bank_account_delete/ruby.mako +5 -3
- data/scenarios/bank_account_list/ruby.mako +76 -2
- data/scenarios/bank_account_show/definition.rb +1 -1
- data/scenarios/bank_account_show/request.rb +1 -1
- data/scenarios/bank_account_show/ruby.mako +41 -5
- data/scenarios/bank_account_update/definition.rb +1 -0
- data/scenarios/bank_account_update/request.rb +6 -0
- data/scenarios/bank_account_update/ruby.mako +56 -0
- data/scenarios/bank_account_verification_create/request.rb +1 -1
- data/scenarios/bank_account_verification_create/ruby.mako +20 -3
- data/scenarios/bank_account_verification_show/definition.rb +1 -1
- data/scenarios/bank_account_verification_show/request.rb +1 -1
- data/scenarios/bank_account_verification_show/ruby.mako +21 -4
- data/scenarios/bank_account_verification_update/definition.rb +1 -1
- data/scenarios/bank_account_verification_update/request.rb +5 -5
- data/scenarios/bank_account_verification_update/ruby.mako +24 -8
- data/scenarios/callback_create/definition.rb +1 -1
- data/scenarios/callback_create/request.rb +2 -2
- data/scenarios/callback_create/ruby.mako +22 -0
- data/scenarios/callback_delete/definition.rb +1 -1
- data/scenarios/callback_delete/request.rb +2 -2
- data/scenarios/callback_delete/ruby.mako +12 -0
- data/scenarios/callback_list/definition.rb +1 -1
- data/scenarios/callback_list/request.rb +1 -2
- data/scenarios/callback_list/ruby.mako +20 -0
- data/scenarios/callback_show/definition.rb +1 -1
- data/scenarios/callback_show/request.rb +1 -1
- data/scenarios/callback_show/ruby.mako +20 -0
- data/scenarios/{customer_add_card → card_associate_to_customer}/definition.rb +0 -0
- data/scenarios/card_associate_to_customer/request.rb +3 -0
- data/scenarios/card_associate_to_customer/ruby.mako +49 -0
- data/scenarios/card_create/request.rb +1 -2
- data/scenarios/card_create/ruby.mako +44 -7
- data/scenarios/card_debit/definition.rb +1 -0
- data/scenarios/card_debit/request.rb +5 -0
- data/scenarios/card_debit/ruby.mako +49 -0
- data/scenarios/card_delete/request.rb +1 -1
- data/scenarios/card_delete/ruby.mako +5 -3
- data/scenarios/card_hold_capture/definition.rb +1 -0
- data/scenarios/card_hold_capture/request.rb +5 -0
- data/scenarios/card_hold_capture/ruby.mako +49 -0
- data/scenarios/card_hold_create/definition.rb +1 -0
- data/scenarios/card_hold_create/request.rb +5 -0
- data/scenarios/card_hold_create/ruby.mako +38 -0
- data/scenarios/card_hold_list/definition.rb +1 -0
- data/scenarios/card_hold_list/request.rb +2 -0
- data/scenarios/card_hold_list/ruby.mako +60 -0
- data/scenarios/card_hold_show/definition.rb +1 -0
- data/scenarios/card_hold_show/request.rb +2 -0
- data/scenarios/card_hold_show/ruby.mako +36 -0
- data/scenarios/card_hold_update/definition.rb +1 -0
- data/scenarios/card_hold_update/request.rb +7 -0
- data/scenarios/card_hold_update/ruby.mako +42 -0
- data/scenarios/card_hold_void/definition.rb +1 -0
- data/scenarios/card_hold_void/request.rb +3 -0
- data/scenarios/card_hold_void/ruby.mako +36 -0
- data/scenarios/card_list/definition.rb +1 -1
- data/scenarios/card_list/request.rb +1 -1
- data/scenarios/card_list/ruby.mako +78 -5
- data/scenarios/card_show/definition.rb +1 -1
- data/scenarios/card_show/request.rb +1 -1
- data/scenarios/card_show/ruby.mako +42 -4
- data/scenarios/card_update/definition.rb +1 -1
- data/scenarios/card_update/request.rb +1 -1
- data/scenarios/card_update/ruby.mako +45 -4
- data/scenarios/credit_list/request.rb +1 -3
- data/scenarios/credit_list/ruby.mako +34 -4
- data/scenarios/{credit_bank_account_list → credit_list_bank_account}/definition.rb +0 -0
- data/scenarios/credit_list_bank_account/request.rb +3 -0
- data/scenarios/credit_list_bank_account/ruby.mako +13 -0
- data/scenarios/credit_show/definition.rb +1 -1
- data/scenarios/credit_show/request.rb +1 -3
- data/scenarios/credit_show/ruby.mako +35 -5
- data/scenarios/{credit_create_new_bank_account → credit_update}/definition.rb +0 -0
- data/scenarios/credit_update/request.rb +7 -0
- data/scenarios/credit_update/ruby.mako +48 -0
- data/scenarios/customer_create/request.rb +4 -1
- data/scenarios/customer_create/ruby.mako +60 -3
- data/scenarios/customer_delete/request.rb +1 -1
- data/scenarios/customer_delete/ruby.mako +4 -2
- data/scenarios/customer_list/definition.rb +1 -0
- data/scenarios/customer_list/request.rb +2 -0
- data/scenarios/customer_list/ruby.mako +105 -0
- data/scenarios/customer_show/definition.rb +1 -0
- data/scenarios/customer_show/request.rb +2 -0
- data/scenarios/customer_show/ruby.mako +58 -0
- data/scenarios/customer_update/definition.rb +1 -0
- data/scenarios/customer_update/request.rb +7 -0
- data/scenarios/customer_update/ruby.mako +64 -0
- data/scenarios/debit_list/request.rb +1 -3
- data/scenarios/debit_list/ruby.mako +70 -4
- data/scenarios/debit_show/definition.rb +1 -1
- data/scenarios/debit_show/request.rb +1 -1
- data/scenarios/debit_show/ruby.mako +39 -4
- data/scenarios/debit_update/definition.rb +1 -1
- data/scenarios/debit_update/request.rb +1 -1
- data/scenarios/debit_update/ruby.mako +39 -4
- data/scenarios/event_list/definition.rb +1 -1
- data/scenarios/event_list/request.rb +1 -2
- data/scenarios/event_list/ruby.mako +54 -5
- data/scenarios/event_show/definition.rb +1 -1
- data/scenarios/event_show/request.rb +1 -1
- data/scenarios/event_show/ruby.mako +54 -4
- data/scenarios/helpers.rb +29 -2
- data/scenarios/order_create/definition.rb +1 -0
- data/scenarios/order_create/request.rb +5 -0
- data/scenarios/order_create/ruby.mako +46 -0
- data/scenarios/order_list/definition.rb +1 -0
- data/scenarios/order_list/request.rb +2 -0
- data/scenarios/order_list/ruby.mako +42 -0
- data/scenarios/order_show/definition.rb +1 -0
- data/scenarios/order_show/request.rb +2 -0
- data/scenarios/order_show/ruby.mako +44 -0
- data/scenarios/order_update/definition.rb +1 -0
- data/scenarios/order_update/request.rb +7 -0
- data/scenarios/order_update/ruby.mako +50 -0
- data/scenarios/refund_create/definition.rb +1 -1
- data/scenarios/refund_create/request.rb +2 -1
- data/scenarios/refund_create/ruby.mako +33 -5
- data/scenarios/refund_list/request.rb +1 -3
- data/scenarios/refund_list/ruby.mako +30 -4
- data/scenarios/refund_show/definition.rb +1 -1
- data/scenarios/refund_show/request.rb +1 -1
- data/scenarios/refund_show/ruby.mako +32 -4
- data/scenarios/refund_update/definition.rb +1 -1
- data/scenarios/refund_update/request.rb +1 -1
- data/scenarios/refund_update/ruby.mako +32 -4
- data/scenarios/render_mako.rb +59 -4
- data/scenarios/reversal_create/definition.rb +1 -0
- data/scenarios/reversal_create/request.rb +9 -0
- data/scenarios/reversal_create/ruby.mako +45 -0
- data/scenarios/reversal_list/definition.rb +1 -0
- data/scenarios/reversal_list/request.rb +2 -0
- data/scenarios/reversal_list/ruby.mako +36 -0
- data/scenarios/reversal_show/definition.rb +1 -0
- data/scenarios/reversal_show/request.rb +2 -0
- data/scenarios/reversal_show/ruby.mako +37 -0
- data/scenarios/reversal_update/definition.rb +1 -0
- data/scenarios/reversal_update/request.rb +7 -0
- data/scenarios/reversal_update/ruby.mako +44 -0
- data/spec/balanced/error_spec.rb +7 -7
- data/spec/balanced/pager_spec.rb +10 -10
- data/spec/balanced/resources/api_key_spec.rb +6 -35
- data/spec/balanced/resources/bank_account_spec.rb +123 -218
- data/spec/balanced/resources/callback_spec.rb +12 -13
- data/spec/balanced/resources/card_hold_spec.rb +103 -0
- data/spec/balanced/resources/card_spec.rb +101 -27
- data/spec/balanced/resources/credit_spec.rb +69 -35
- data/spec/balanced/resources/customer_spec.rb +91 -271
- data/spec/balanced/resources/debit_spec.rb +95 -0
- data/spec/balanced/resources/marketplace_spec.rb +17 -170
- data/spec/balanced/resources/order_spec.rb +364 -0
- data/spec/balanced/resources/resource_spec.rb +25 -32
- data/spec/balanced_spec.rb +18 -36
- data/spec/client_spec.rb +7 -7
- data/spec/spec_helper.rb +19 -18
- data/spec/utils_spec.rb +5 -5
- metadata +123 -165
- data/examples/bank_account_debits.rb +0 -57
- data/examples/customers.rb +0 -114
- data/examples/events_and_callbacks.rb +0 -81
- data/examples/examples.rb +0 -162
- data/examples/exception_handling.rb +0 -44
- data/lib/balanced/resources/account.rb +0 -179
- data/lib/balanced/resources/hold.rb +0 -61
- data/lib/balanced/resources/invoice.rb +0 -11
- data/lib/balanced/resources/merchant.rb +0 -21
- data/lib/balanced/resources/transaction.rb +0 -17
- data/scenarios/account_add_card/definition.rb +0 -1
- data/scenarios/account_add_card/request.rb +0 -3
- data/scenarios/account_add_card/ruby.mako +0 -11
- data/scenarios/account_capture_hold/definition.rb +0 -1
- data/scenarios/account_capture_hold/request.rb +0 -3
- data/scenarios/account_capture_hold/ruby.mako +0 -11
- data/scenarios/account_create/definition.rb +0 -1
- data/scenarios/account_create/request.rb +0 -2
- data/scenarios/account_create/ruby.mako +0 -10
- data/scenarios/account_create_buyer/definition.rb +0 -1
- data/scenarios/account_create_buyer/request.rb +0 -5
- data/scenarios/account_create_buyer/ruby.mako +0 -13
- data/scenarios/account_create_debit/definition.rb +0 -1
- data/scenarios/account_create_debit/request.rb +0 -3
- data/scenarios/account_create_debit/ruby.mako +0 -11
- data/scenarios/account_create_hold/definition.rb +0 -1
- data/scenarios/account_create_hold/request.rb +0 -3
- data/scenarios/account_create_hold/ruby.mako +0 -11
- data/scenarios/account_create_merchant/definition.rb +0 -1
- data/scenarios/account_create_merchant/request.rb +0 -3
- data/scenarios/account_create_merchant/ruby.mako +0 -11
- data/scenarios/account_underwrite_business/definition.rb +0 -1
- data/scenarios/account_underwrite_business/request.rb +0 -17
- data/scenarios/account_underwrite_business/ruby.mako +0 -37
- data/scenarios/account_underwrite_person/definition.rb +0 -1
- data/scenarios/account_underwrite_person/request.rb +0 -18
- data/scenarios/account_underwrite_person/ruby.mako +0 -31
- data/scenarios/bank_account_find_and_credit/definition.rb +0 -1
- data/scenarios/bank_account_find_and_credit/request.rb +0 -5
- data/scenarios/bank_account_find_and_credit/ruby.mako +0 -13
- data/scenarios/bank_account_find_and_delete/definition.rb +0 -1
- data/scenarios/bank_account_find_and_delete/request.rb +0 -3
- data/scenarios/bank_account_find_and_delete/ruby.mako +0 -10
- data/scenarios/bank_account_invalid_routing_number/definition.rb +0 -1
- data/scenarios/bank_account_invalid_routing_number/request.rb +0 -11
- data/scenarios/bank_account_invalid_routing_number/ruby.mako +0 -16
- data/scenarios/card_invalidate/definition.rb +0 -1
- data/scenarios/card_invalidate/request.rb +0 -3
- data/scenarios/card_invalidate/ruby.mako +0 -10
- data/scenarios/credit_account_list/definition.rb +0 -1
- data/scenarios/credit_account_list/request.rb +0 -3
- data/scenarios/credit_account_list/ruby.mako +0 -10
- data/scenarios/credit_account_merchant_create/definition.rb +0 -1
- data/scenarios/credit_account_merchant_create/request.rb +0 -5
- data/scenarios/credit_account_merchant_create/ruby.mako +0 -12
- data/scenarios/credit_bank_account_list/request.rb +0 -5
- data/scenarios/credit_bank_account_list/ruby.mako +0 -12
- data/scenarios/credit_create_existing_bank_account/request.rb +0 -5
- data/scenarios/credit_create_existing_bank_account/ruby.mako +0 -12
- data/scenarios/credit_create_new_bank_account/request.rb +0 -10
- data/scenarios/credit_create_new_bank_account/ruby.mako +0 -21
- data/scenarios/credit_customer_list/definition.rb +0 -1
- data/scenarios/credit_customer_list/request.rb +0 -4
- data/scenarios/credit_customer_list/ruby.mako +0 -12
- data/scenarios/credit_failed_state/definition.rb +0 -1
- data/scenarios/credit_failed_state/request.rb +0 -10
- data/scenarios/credit_failed_state/ruby.mako +0 -18
- data/scenarios/credit_paid_state/definition.rb +0 -1
- data/scenarios/credit_paid_state/request.rb +0 -11
- data/scenarios/credit_paid_state/ruby.mako +0 -19
- data/scenarios/credit_pending_state/definition.rb +0 -1
- data/scenarios/credit_pending_state/request.rb +0 -9
- data/scenarios/credit_pending_state/ruby.mako +0 -17
- data/scenarios/customer_add_bank_account/request.rb +0 -3
- data/scenarios/customer_add_bank_account/ruby.mako +0 -11
- data/scenarios/customer_add_card/request.rb +0 -3
- data/scenarios/customer_add_card/ruby.mako +0 -11
- data/scenarios/customer_capture_hold/definition.rb +0 -1
- data/scenarios/customer_capture_hold/request.rb +0 -3
- data/scenarios/customer_capture_hold/ruby.mako +0 -0
- data/scenarios/customer_create_debit/definition.rb +0 -1
- data/scenarios/customer_create_debit/request.rb +0 -3
- data/scenarios/customer_create_debit/ruby.mako +0 -11
- data/scenarios/customer_create_hold/definition.rb +0 -1
- data/scenarios/customer_create_hold/request.rb +0 -3
- data/scenarios/customer_create_hold/ruby.mako +0 -11
- data/scenarios/customer_credit/definition.rb +0 -1
- data/scenarios/customer_credit/request.rb +0 -2
- data/scenarios/customer_credit/ruby.mako +0 -8
- data/scenarios/debit_account_list/definition.rb +0 -1
- data/scenarios/debit_account_list/request.rb +0 -3
- data/scenarios/debit_account_list/ruby.mako +0 -10
- data/scenarios/debit_create/definition.rb +0 -1
- data/scenarios/debit_create/request.rb +0 -5
- data/scenarios/debit_create/ruby.mako +0 -15
- data/scenarios/debit_customer_list/definition.rb +0 -1
- data/scenarios/debit_customer_list/request.rb +0 -4
- data/scenarios/debit_customer_list/ruby.mako +0 -12
- data/scenarios/debit_refund/definition.rb +0 -1
- data/scenarios/debit_refund/request.rb +0 -3
- data/scenarios/debit_refund/ruby.mako +0 -10
- data/scenarios/delete.rb +0 -7
- data/scenarios/event_replay/definition.rb +0 -0
- data/scenarios/event_replay/request.rb +0 -1
- data/scenarios/event_replay/ruby.mako +0 -0
- data/scenarios/execute.rb +0 -27
- data/scenarios/hold_account_list/definition.rb +0 -1
- data/scenarios/hold_account_list/request.rb +0 -3
- data/scenarios/hold_account_list/ruby.mako +0 -10
- data/scenarios/hold_capture/definition.rb +0 -1
- data/scenarios/hold_capture/request.rb +0 -5
- data/scenarios/hold_capture/ruby.mako +0 -15
- data/scenarios/hold_create/definition.rb +0 -1
- data/scenarios/hold_create/request.rb +0 -5
- data/scenarios/hold_create/ruby.mako +0 -14
- data/scenarios/hold_customer_list/definition.rb +0 -1
- data/scenarios/hold_customer_list/request.rb +0 -3
- data/scenarios/hold_customer_list/ruby.mako +0 -11
- data/scenarios/hold_list/definition.rb +0 -1
- data/scenarios/hold_list/request.rb +0 -4
- data/scenarios/hold_list/ruby.mako +0 -11
- data/scenarios/hold_show/definition.rb +0 -1
- data/scenarios/hold_show/request.rb +0 -2
- data/scenarios/hold_show/ruby.mako +0 -10
- data/scenarios/hold_update/definition.rb +0 -1
- data/scenarios/hold_update/request.rb +0 -7
- data/scenarios/hold_update/ruby.mako +0 -16
- data/scenarios/hold_void/definition.rb +0 -1
- data/scenarios/hold_void/request.rb +0 -3
- data/scenarios/hold_void/ruby.mako +0 -10
- data/scenarios/refund_account_list/definition.rb +0 -1
- data/scenarios/refund_account_list/request.rb +0 -3
- data/scenarios/refund_account_list/ruby.mako +0 -10
- data/scenarios/refund_customer_list/definition.rb +0 -1
- data/scenarios/refund_customer_list/request.rb +0 -3
- data/scenarios/refund_customer_list/ruby.mako +0 -11
- data/scenarios/render.rb +0 -32
- data/scenarios/render_one.rb +0 -32
- data/spec/balanced/resources/account_spec.rb +0 -636
- data/spec/balanced/resources/hold_spec.rb +0 -48
- data/spec/balanced/resources/merchant_spec.rb +0 -6
- data/spec/scenarios_spec.rb +0 -39
- data/upload_docs.rb +0 -40
@@ -1 +0,0 @@
|
|
1
|
-
Balanced::Account.promote_to_merchant
|
@@ -1,17 +0,0 @@
|
|
1
|
-
<%= boiler_plate %>
|
2
|
-
|
3
|
-
merchant_data = {
|
4
|
-
<%= params_to_hash.call(payload['merchant']).indent(2) %>,
|
5
|
-
}
|
6
|
-
|
7
|
-
account = Balanced::Marketplace.my_marketplace.create_account
|
8
|
-
|
9
|
-
begin
|
10
|
-
account.promote_to_merchant(merchant_data)
|
11
|
-
rescue Balanced::MoreInformationRequired => error
|
12
|
-
# could not identify this account.
|
13
|
-
puts 'redirect merchant to: ' + error.redirect_uri
|
14
|
-
rescue Balanced::Error => error
|
15
|
-
# TODO: handle 400 and 409 exceptions as required
|
16
|
-
raise
|
17
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
% if mode == 'definition':
|
2
|
-
Balanced::Account.promote_to_merchant
|
3
|
-
|
4
|
-
% else:
|
5
|
-
require 'balanced'
|
6
|
-
Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
|
7
|
-
|
8
|
-
|
9
|
-
merchant_data = {
|
10
|
-
:name => 'Skripts4Kids',
|
11
|
-
:person => {
|
12
|
-
:dob => '1989-12',
|
13
|
-
:name => 'Timmy Q. CopyPasta',
|
14
|
-
:phone_number => '+14089999999',
|
15
|
-
:postal_code => '94110',
|
16
|
-
:street_address => '121 Skriptkid Row'
|
17
|
-
},
|
18
|
-
:phone_number => '+140899188155',
|
19
|
-
:postal_code => '91111',
|
20
|
-
:street_address => '555 VoidMain Road',
|
21
|
-
:tax_id => '211111111',
|
22
|
-
:type => 'business',
|
23
|
-
}
|
24
|
-
|
25
|
-
account = Balanced::Marketplace.my_marketplace.create_account
|
26
|
-
|
27
|
-
begin
|
28
|
-
account.promote_to_merchant(merchant_data)
|
29
|
-
rescue Balanced::MoreInformationRequired => error
|
30
|
-
# could not identify this account.
|
31
|
-
puts 'redirect merchant to: ' + error.redirect_uri
|
32
|
-
rescue Balanced::Error => error
|
33
|
-
# TODO: handle 400 and 409 exceptions as required
|
34
|
-
raise
|
35
|
-
end
|
36
|
-
|
37
|
-
% endif
|
@@ -1 +0,0 @@
|
|
1
|
-
Balanced::Account.promote_to_merchant
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<%= boiler_plate %>
|
2
|
-
marketplace = Balanced::Marketplace.my_marketplace
|
3
|
-
|
4
|
-
merchant_data = {
|
5
|
-
<%= params_to_hash.call(payload['merchant']) %>
|
6
|
-
}
|
7
|
-
|
8
|
-
account = Balanced::Marketplace.my_marketplace.create_account
|
9
|
-
|
10
|
-
begin
|
11
|
-
account.promote_to_merchant(merchant_data)
|
12
|
-
rescue Balanced::MoreInformationRequired => error
|
13
|
-
# could not identify this account.
|
14
|
-
puts 'redirect merchant to: ' + error.redirect_uri
|
15
|
-
rescue Balanced::Error => error
|
16
|
-
# TODO: handle 400 and 409 exceptions as required
|
17
|
-
raise
|
18
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
% if mode == 'definition':
|
2
|
-
Balanced::Account.promote_to_merchant
|
3
|
-
|
4
|
-
% else:
|
5
|
-
require 'balanced'
|
6
|
-
Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
|
7
|
-
|
8
|
-
marketplace = Balanced::Marketplace.my_marketplace
|
9
|
-
|
10
|
-
merchant_data = {
|
11
|
-
:dob => '1989-12',
|
12
|
-
:name => 'Timmy Q. CopyPasta',
|
13
|
-
:phone_number => '+14089999999',
|
14
|
-
:postal_code => '94110',
|
15
|
-
:street_address => '121 Skriptkid Row',
|
16
|
-
:type => 'person'
|
17
|
-
}
|
18
|
-
|
19
|
-
account = Balanced::Marketplace.my_marketplace.create_account
|
20
|
-
|
21
|
-
begin
|
22
|
-
account.promote_to_merchant(merchant_data)
|
23
|
-
rescue Balanced::MoreInformationRequired => error
|
24
|
-
# could not identify this account.
|
25
|
-
puts 'redirect merchant to: ' + error.redirect_uri
|
26
|
-
rescue Balanced::Error => error
|
27
|
-
# TODO: handle 400 and 409 exceptions as required
|
28
|
-
raise
|
29
|
-
end
|
30
|
-
|
31
|
-
% endif
|
@@ -1 +0,0 @@
|
|
1
|
-
|
@@ -1,13 +0,0 @@
|
|
1
|
-
% if mode == 'definition':
|
2
|
-
|
3
|
-
|
4
|
-
% else:
|
5
|
-
require 'balanced'
|
6
|
-
Balanced.configure('8af725c6d54611e2bf5e026ba7f8ec28')
|
7
|
-
|
8
|
-
marketplace = Balanced::Marketplace.my_marketplace
|
9
|
-
|
10
|
-
bank_account = Balanced::BankAccount.find('/v1/bank_accounts/BA5ONs53HNn1Od9g99v0GNFJ')
|
11
|
-
bank_account.credit('1000')
|
12
|
-
|
13
|
-
% endif
|
@@ -1 +0,0 @@
|
|
1
|
-
% if request is not UNDEFINED:
|
@@ -1 +0,0 @@
|
|
1
|
-
Balanced::BadRequest
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<%= boiler_plate %>
|
2
|
-
bank_account = Balanced::BankAccount.new(
|
3
|
-
:uri => '<%=request['uri']%>',
|
4
|
-
<%= params_to_hash.call(payload).indent(2) %>
|
5
|
-
)
|
6
|
-
|
7
|
-
begin
|
8
|
-
bank_account.save
|
9
|
-
rescue Balanced::BadRequest => ex
|
10
|
-
raise "Key is not returned!" unless ex.extras.has_key? "routing_number"
|
11
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
% if mode == 'definition':
|
2
|
-
Balanced::BadRequest
|
3
|
-
|
4
|
-
% else:
|
5
|
-
require 'balanced'
|
6
|
-
Balanced.configure('8af725c6d54611e2bf5e026ba7f8ec28')
|
7
|
-
|
8
|
-
bank_account = Balanced::BankAccount.new( :uri => '/v1/marketplaces/TEST-MP4erLnXCYoaeyr3tx95WSKc/bank_accounts', :account_number => '9900000001',:name => 'Johann Bernoulli',:routing_number => '100000007',:type => 'checking')
|
9
|
-
|
10
|
-
begin
|
11
|
-
bank_account.save
|
12
|
-
rescue Balanced::BadRequest => ex
|
13
|
-
raise "Key is not returned!" unless ex.extras.has_key? "routing_number"
|
14
|
-
end
|
15
|
-
|
16
|
-
% endif
|
@@ -1 +0,0 @@
|
|
1
|
-
Balanced::Card.invalidate()
|
@@ -1,10 +0,0 @@
|
|
1
|
-
% if mode == 'definition':
|
2
|
-
Balanced::Card.invalidate()
|
3
|
-
|
4
|
-
% else:
|
5
|
-
require 'balanced'
|
6
|
-
Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
|
7
|
-
|
8
|
-
card = Balanced::Card.find('/v1/marketplaces/TEST-MP4h8BxozeLxe7VAllP6b5gj/cards/CC5ZP031cwTSKE3pSIHNNMRi')
|
9
|
-
card.invalidate
|
10
|
-
% endif
|
@@ -1 +0,0 @@
|
|
1
|
-
Balanced::Account.credits
|
@@ -1,10 +0,0 @@
|
|
1
|
-
% if mode == 'definition':
|
2
|
-
Balanced::Account.credits
|
3
|
-
|
4
|
-
% else:
|
5
|
-
require 'balanced'
|
6
|
-
Balanced.configure('8af725c6d54611e2bf5e026ba7f8ec28')
|
7
|
-
|
8
|
-
merchant = Balanced::Account.find('/v1/marketplaces/TEST-MP4erLnXCYoaeyr3tx95WSKc/accounts/AC4FqqEyFyTcd3eHhh2YXL4c')
|
9
|
-
credits = merchant.credits
|
10
|
-
% endif
|
@@ -1 +0,0 @@
|
|
1
|
-
Balanced::Account.credit()
|
@@ -1,12 +0,0 @@
|
|
1
|
-
% if mode == 'definition':
|
2
|
-
Balanced::Account.credit()
|
3
|
-
|
4
|
-
% else:
|
5
|
-
require 'balanced'
|
6
|
-
Balanced.configure('8af725c6d54611e2bf5e026ba7f8ec28')
|
7
|
-
|
8
|
-
marketplace = Balanced::Marketplace.my_marketplace
|
9
|
-
|
10
|
-
merchant = Balanced::Account.find('/v1/marketplaces/TEST-MP4erLnXCYoaeyr3tx95WSKc/accounts/AC4FqqEyFyTcd3eHhh2YXL4c')
|
11
|
-
merchant.credit('100')
|
12
|
-
% endif
|
@@ -1,12 +0,0 @@
|
|
1
|
-
% if mode == 'definition':
|
2
|
-
Balanced::BankAccount.credits
|
3
|
-
|
4
|
-
% else:
|
5
|
-
require 'balanced'
|
6
|
-
Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
|
7
|
-
|
8
|
-
marketplace = Balanced::Marketplace.my_marketplace
|
9
|
-
|
10
|
-
bank_account = Balanced::BankAccount.find('/v1/bank_accounts/BA5S3reJdyJBbAYKepbneBe2')
|
11
|
-
credits = bank_account.credits
|
12
|
-
% endif
|
@@ -1,12 +0,0 @@
|
|
1
|
-
% if mode == 'definition':
|
2
|
-
Balanced::BankAccount.credit
|
3
|
-
|
4
|
-
% else:
|
5
|
-
require 'balanced'
|
6
|
-
Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
|
7
|
-
|
8
|
-
marketplace = Balanced::Marketplace.my_marketplace
|
9
|
-
|
10
|
-
bank_account = Balanced::BankAccount.find('/v1/bank_accounts/BA5S3reJdyJBbAYKepbneBe2')
|
11
|
-
bank_account.credit(:amount => '10000')
|
12
|
-
% endif
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<%= boiler_plate %>
|
2
|
-
marketplace = Balanced::Marketplace.my_marketplace
|
3
|
-
|
4
|
-
bank_account_info = {
|
5
|
-
<%= params_to_hash.call(request['bank_account']).indent(2) %>
|
6
|
-
}
|
7
|
-
credit = Balanced::Credit.new(
|
8
|
-
:amount => <%= request['amount'] %>,
|
9
|
-
:bank_account => bank_account_info
|
10
|
-
).save
|
@@ -1,21 +0,0 @@
|
|
1
|
-
% if mode == 'definition':
|
2
|
-
Balanced::Credit.save
|
3
|
-
|
4
|
-
% else:
|
5
|
-
require 'balanced'
|
6
|
-
Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
|
7
|
-
|
8
|
-
marketplace = Balanced::Marketplace.my_marketplace
|
9
|
-
|
10
|
-
bank_account_info = {
|
11
|
-
:account_number => '9900000001',
|
12
|
-
:name => 'Johann Bernoulli',
|
13
|
-
:routing_number => '121000358',
|
14
|
-
:type => 'checking'
|
15
|
-
}
|
16
|
-
credit = Balanced::Credit.new(
|
17
|
-
:amount => 10000,
|
18
|
-
:bank_account => bank_account_info
|
19
|
-
).save
|
20
|
-
|
21
|
-
% endif
|
@@ -1 +0,0 @@
|
|
1
|
-
Balanced::Customer.credits
|
@@ -1 +0,0 @@
|
|
1
|
-
Balanced::Credit.save
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<%= boiler_plate %>
|
2
|
-
marketplace = Balanced::Marketplace.my_marketplace
|
3
|
-
|
4
|
-
bank_account_info = {
|
5
|
-
<%= params_to_hash.call(request['bank_account']).indent(2) %>
|
6
|
-
}
|
7
|
-
credit = Balanced::Credit.new(
|
8
|
-
:amount => <%= request['amount'] %>,
|
9
|
-
:bank_account => bank_account_info
|
10
|
-
).save
|
@@ -1,18 +0,0 @@
|
|
1
|
-
% if mode == 'definition':
|
2
|
-
Balanced::Credit.save
|
3
|
-
|
4
|
-
% else:
|
5
|
-
require 'balanced'
|
6
|
-
Balanced.configure('8af725c6d54611e2bf5e026ba7f8ec28')
|
7
|
-
|
8
|
-
marketplace = Balanced::Marketplace.my_marketplace
|
9
|
-
|
10
|
-
bank_account_info = {
|
11
|
-
:account_number => '9900000004',:name => 'Johann Bernoulli',:routing_number => '121000358',:type => 'checking',
|
12
|
-
}
|
13
|
-
credit = Balanced::Credit.new(
|
14
|
-
:amount => 10000,
|
15
|
-
:bank_account => bank_account_info
|
16
|
-
).save
|
17
|
-
|
18
|
-
% endif
|
@@ -1 +0,0 @@
|
|
1
|
-
Balanced::Credit.save
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<%= boiler_plate %>
|
2
|
-
marketplace = Balanced::Marketplace.my_marketplace
|
3
|
-
|
4
|
-
bank_account_info = {
|
5
|
-
<%= params_to_hash.call(request['bank_account']).indent(2) %>
|
6
|
-
}
|
7
|
-
|
8
|
-
credit = Balanced::Credit.new(
|
9
|
-
:amount => <%= request['amount'] %>,
|
10
|
-
:bank_account => bank_account_info
|
11
|
-
).save
|
@@ -1,19 +0,0 @@
|
|
1
|
-
% if mode == 'definition':
|
2
|
-
Balanced::Credit.save
|
3
|
-
|
4
|
-
% else:
|
5
|
-
require 'balanced'
|
6
|
-
Balanced.configure('8af725c6d54611e2bf5e026ba7f8ec28')
|
7
|
-
|
8
|
-
marketplace = Balanced::Marketplace.my_marketplace
|
9
|
-
|
10
|
-
bank_account_info = {
|
11
|
-
:account_number => '9900000003',:name => 'Johann Bernoulli',:routing_number => '121000358',:type => 'checking',
|
12
|
-
}
|
13
|
-
|
14
|
-
credit = Balanced::Credit.new(
|
15
|
-
:amount => 10000,
|
16
|
-
:bank_account => bank_account_info
|
17
|
-
).save
|
18
|
-
|
19
|
-
% endif
|
@@ -1 +0,0 @@
|
|
1
|
-
Balanced::Credit.save
|