balanced 1.1.1 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +10 -6
  4. data/CHANGELOG.md +4 -0
  5. data/README.md +1 -1
  6. data/lib/balanced/resources.rb +2 -0
  7. data/lib/balanced/resources/account.rb +33 -0
  8. data/lib/balanced/resources/card.rb +1 -1
  9. data/lib/balanced/resources/customer.rb +8 -0
  10. data/lib/balanced/resources/resource.rb +4 -6
  11. data/lib/balanced/resources/settlement.rb +12 -0
  12. data/lib/balanced/response/balanced_exception_middleware.rb +1 -1
  13. data/lib/balanced/utils.rb +1 -1
  14. data/lib/balanced/version.rb +1 -1
  15. data/scenarios/account_credit/definition.rb +1 -0
  16. data/scenarios/account_credit/request.rb +5 -0
  17. data/scenarios/account_credit/ruby.mako +49 -0
  18. data/scenarios/account_list/definition.rb +1 -0
  19. data/scenarios/account_list/request.rb +2 -0
  20. data/scenarios/account_list/ruby.mako +64 -0
  21. data/scenarios/account_list_customer/definition.rb +1 -0
  22. data/scenarios/account_list_customer/request.rb +3 -0
  23. data/scenarios/account_list_customer/ruby.mako +38 -0
  24. data/scenarios/account_show/definition.rb +1 -0
  25. data/scenarios/account_show/request.rb +2 -0
  26. data/scenarios/account_show/ruby.mako +37 -0
  27. data/scenarios/api_key_create/ruby.mako +6 -6
  28. data/scenarios/api_key_delete/ruby.mako +2 -2
  29. data/scenarios/api_key_list/ruby.mako +10 -10
  30. data/scenarios/api_key_show/ruby.mako +6 -6
  31. data/scenarios/bank_account_associate_to_customer/ruby.mako +16 -14
  32. data/scenarios/bank_account_create/ruby.mako +13 -11
  33. data/scenarios/bank_account_credit/ruby.mako +16 -16
  34. data/scenarios/bank_account_debit/ruby.mako +21 -18
  35. data/scenarios/bank_account_debit_order/definition.rb +1 -0
  36. data/scenarios/bank_account_debit_order/request.rb +7 -0
  37. data/scenarios/bank_account_debit_order/ruby.mako +52 -0
  38. data/scenarios/bank_account_delete/ruby.mako +2 -2
  39. data/scenarios/bank_account_list/ruby.mako +26 -22
  40. data/scenarios/bank_account_show/ruby.mako +14 -12
  41. data/scenarios/bank_account_update/ruby.mako +14 -12
  42. data/scenarios/bank_account_verification_create/ruby.mako +10 -10
  43. data/scenarios/bank_account_verification_show/ruby.mako +10 -10
  44. data/scenarios/bank_account_verification_update/ruby.mako +9 -9
  45. data/scenarios/callback_create/ruby.mako +4 -4
  46. data/scenarios/callback_delete/ruby.mako +2 -2
  47. data/scenarios/callback_list/ruby.mako +4 -4
  48. data/scenarios/callback_show/ruby.mako +5 -5
  49. data/scenarios/card_associate_to_customer/ruby.mako +26 -26
  50. data/scenarios/card_create/ruby.mako +13 -15
  51. data/scenarios/card_create_creditable/ruby.mako +11 -11
  52. data/scenarios/card_create_dispute/ruby.mako +13 -13
  53. data/scenarios/card_credit/ruby.mako +16 -14
  54. data/scenarios/card_credit_order/definition.rb +1 -0
  55. data/scenarios/card_credit_order/request.rb +7 -0
  56. data/scenarios/card_credit_order/ruby.mako +45 -0
  57. data/scenarios/card_debit/ruby.mako +20 -17
  58. data/scenarios/card_debit_dispute/ruby.mako +20 -17
  59. data/scenarios/card_delete/ruby.mako +2 -2
  60. data/scenarios/card_hold_capture/ruby.mako +20 -17
  61. data/scenarios/card_hold_create/ruby.mako +16 -14
  62. data/scenarios/card_hold_list/ruby.mako +33 -27
  63. data/scenarios/card_hold_order/definition.rb +1 -0
  64. data/scenarios/card_hold_order/request.rb +6 -0
  65. data/scenarios/card_hold_order/ruby.mako +45 -0
  66. data/scenarios/card_hold_show/ruby.mako +16 -14
  67. data/scenarios/card_hold_update/ruby.mako +16 -14
  68. data/scenarios/card_hold_void/ruby.mako +17 -15
  69. data/scenarios/card_list/ruby.mako +25 -29
  70. data/scenarios/card_show/ruby.mako +14 -16
  71. data/scenarios/card_update/ruby.mako +14 -16
  72. data/scenarios/credit_list/ruby.mako +44 -14
  73. data/scenarios/credit_list_bank_account/ruby.mako +3 -3
  74. data/scenarios/credit_order/request.rb +2 -2
  75. data/scenarios/credit_order/ruby.mako +35 -14
  76. data/scenarios/credit_show/ruby.mako +16 -16
  77. data/scenarios/credit_update/ruby.mako +16 -16
  78. data/scenarios/customer_create/ruby.mako +22 -20
  79. data/scenarios/customer_delete/ruby.mako +1 -1
  80. data/scenarios/customer_list/ruby.mako +43 -39
  81. data/scenarios/customer_show/ruby.mako +23 -21
  82. data/scenarios/customer_update/ruby.mako +23 -21
  83. data/scenarios/debit_dispute_show/ruby.mako +12 -12
  84. data/scenarios/debit_list/ruby.mako +43 -37
  85. data/scenarios/debit_order/ruby.mako +22 -19
  86. data/scenarios/debit_show/ruby.mako +20 -17
  87. data/scenarios/debit_update/ruby.mako +20 -17
  88. data/scenarios/dispute_list/ruby.mako +11 -11
  89. data/scenarios/dispute_show/ruby.mako +12 -12
  90. data/scenarios/event_list/ruby.mako +55 -81
  91. data/scenarios/event_show/ruby.mako +35 -45
  92. data/scenarios/order_create/ruby.mako +16 -14
  93. data/scenarios/order_list/ruby.mako +33 -29
  94. data/scenarios/order_show/ruby.mako +16 -14
  95. data/scenarios/order_update/ruby.mako +16 -14
  96. data/scenarios/refund_create/ruby.mako +13 -13
  97. data/scenarios/refund_list/ruby.mako +12 -12
  98. data/scenarios/refund_show/ruby.mako +13 -13
  99. data/scenarios/refund_update/ruby.mako +13 -13
  100. data/scenarios/reversal_create/ruby.mako +13 -13
  101. data/scenarios/reversal_list/ruby.mako +12 -12
  102. data/scenarios/reversal_show/ruby.mako +13 -13
  103. data/scenarios/reversal_update/ruby.mako +13 -13
  104. data/scenarios/settlement_create/definition.rb +1 -0
  105. data/scenarios/settlement_create/request.rb +5 -0
  106. data/scenarios/settlement_create/ruby.mako +48 -0
  107. data/scenarios/settlement_list/definition.rb +1 -0
  108. data/scenarios/settlement_list/request.rb +2 -0
  109. data/scenarios/settlement_list/ruby.mako +40 -0
  110. data/scenarios/settlement_list_account/definition.rb +1 -0
  111. data/scenarios/settlement_list_account/request.rb +3 -0
  112. data/scenarios/settlement_list_account/ruby.mako +41 -0
  113. data/scenarios/settlement_show/definition.rb +1 -0
  114. data/scenarios/settlement_show/request.rb +2 -0
  115. data/scenarios/settlement_show/ruby.mako +40 -0
  116. data/snippets/account-balance.rb +1 -0
  117. data/snippets/bank-account-create.rb +6 -0
  118. data/snippets/bank-account-debit.rb +9 -0
  119. data/snippets/bank-account-verification-confirm.rb +5 -0
  120. data/snippets/bank-account-verification-create.rb +1 -0
  121. data/snippets/callback-create.rb +4 -0
  122. data/snippets/card-associate-to-customer.rb +2 -0
  123. data/snippets/card-create-dispute.rb +6 -0
  124. data/snippets/card-create.rb +7 -0
  125. data/snippets/card-credit.rb +9 -0
  126. data/snippets/card-debit.rb +9 -0
  127. data/snippets/card-hold-capture.rb +6 -0
  128. data/snippets/card-hold-create.rb +6 -0
  129. data/snippets/card-hold-void.rb +3 -0
  130. data/snippets/create-buyer-and-card.rb +13 -0
  131. data/snippets/credit-create.rb +8 -0
  132. data/snippets/credit-fetch.rb +1 -0
  133. data/snippets/credit-marketplace-escrow.rb +4 -0
  134. data/snippets/credit-reverse.rb +1 -0
  135. data/snippets/credit-soft-descriptor.rb +9 -0
  136. data/snippets/credit-split.rb +13 -0
  137. data/snippets/customer-create.rb +8 -0
  138. data/snippets/debit-dispute-show.rb +3 -0
  139. data/snippets/debit-fetch.rb +1 -0
  140. data/snippets/debit-marketplace-escrow.rb +4 -0
  141. data/snippets/debit-refund.rb +1 -0
  142. data/snippets/dispute-list.rb +1 -0
  143. data/snippets/dispute-show.rb +2 -0
  144. data/snippets/examine-order-after-refund.rb +3 -0
  145. data/snippets/examine-order-after-reversal.rb +3 -0
  146. data/snippets/example.rb +1 -0
  147. data/snippets/marketplace-in-escrow.rb +1 -0
  148. data/snippets/merchant-payable-account-fetch.rb +2 -0
  149. data/snippets/order-amount-escrowed.rb +3 -0
  150. data/snippets/order-bank-account-create.rb +8 -0
  151. data/snippets/order-create.rb +1 -0
  152. data/snippets/order-credit-marketplace.rb +5 -0
  153. data/snippets/order-credit-merchant-payable-account.rb +4 -0
  154. data/snippets/order-credit.rb +4 -0
  155. data/snippets/order-credits-fetch.rb +1 -0
  156. data/snippets/order-debit.rb +4 -0
  157. data/snippets/order-debits-fetch.rb +1 -0
  158. data/snippets/order-fetch.rb +1 -0
  159. data/snippets/order-update.rb +5 -0
  160. data/snippets/refund-create.rb +13 -0
  161. data/snippets/reversal-create.rb +13 -0
  162. data/snippets/settlement-create.rb +5 -0
  163. data/spec/balanced/resources/account_spec.rb +265 -0
  164. data/spec/balanced/resources/card_spec.rb +6 -6
  165. metadata +86 -2
@@ -2,9 +2,9 @@
2
2
  Balanced::Credit.reverse
3
3
  % elif mode == 'request':
4
4
  require 'balanced'
5
- Balanced.configure('ak-test-2q80HU8DISm2atgm0iRKRVIePzDb34qYp')
5
+ Balanced.configure('ak-test-YoVGJWMjOpkCPo6dWMfuiYbBYIB8q2JX')
6
6
 
7
- reversal = Balanced::Credit.fetch('/credits/CR7ushK6kWjPJYdh24QoM1A9')
7
+ reversal = Balanced::Credit.fetch('/credits/CRxBIVaPCDZEbVgE1Jb0jkc')
8
8
  credit.reverse(
9
9
  :amount => 3000,
10
10
  :description => 'Reversal for Order #1111',
@@ -16,30 +16,30 @@ credit.reverse(
16
16
  )
17
17
 
18
18
  % elif mode == 'response':
19
- #<Balanced::Reversal:0x007fa7d417fe70
19
+ #<Balanced::Reversal:0x007fcde09636f0
20
20
  @attributes=
21
21
  {"amount"=>3000,
22
- "created_at"=>"2014-05-15T00:43:48.266113Z",
22
+ "created_at"=>"2014-12-17T21:26:06.246868Z",
23
23
  "currency"=>"USD",
24
24
  "description"=>"Reversal for Order #1111",
25
25
  "failure_reason"=>nil,
26
26
  "failure_reason_code"=>nil,
27
- "href"=>"/reversals/RV7BYCqyLOKwcWigapAoGWdr",
28
- "id"=>"RV7BYCqyLOKwcWigapAoGWdr",
29
- "links"=>{"credit"=>"CR7ushK6kWjPJYdh24QoM1A9", "order"=>nil},
27
+ "href"=>"/reversals/RVyHZ2toyTu9BCvGNLsOvLi",
28
+ "id"=>"RVyHZ2toyTu9BCvGNLsOvLi",
29
+ "links"=>{"credit"=>"CRxBIVaPCDZEbVgE1Jb0jkc", "order"=>nil},
30
30
  "meta"=>
31
31
  {"fulfillment.item.condition"=>"OK",
32
32
  "merchant.feedback"=>"positive",
33
33
  "user.refund_reason"=>"not happy with product"},
34
- "status"=>"succeeded",
35
- "transaction_number"=>"RV689-626-0403",
36
- "updated_at"=>"2014-05-15T00:43:53.755588Z"},
34
+ "status"=>"pending",
35
+ "transaction_number"=>"RV71F-IRJ-GYVF",
36
+ "updated_at"=>"2014-12-17T21:26:06.517468Z"},
37
37
  @hyperlinks=
38
38
  {"credit"=>
39
- #<Proc:0x007fa7d417e1b0/lib/balanced/resources/resource.rb:60 (lambda)>,
39
+ #<Proc:0x007fcde09614b8/lib/balanced/resources/resource.rb:56 (lambda)>,
40
40
  "events"=>
41
- #<Proc:0x007fa7d4177c48/lib/balanced/utils.rb:6 (lambda)>,
41
+ #<Proc:0x007fcde093f020/lib/balanced/utils.rb:6 (lambda)>,
42
42
  "order"=>
43
- #<Proc:0x007fa7d4176af0/lib/balanced/utils.rb:6 (lambda)>}>
43
+ #<Proc:0x007fcde093e670/lib/balanced/utils.rb:6 (lambda)>}>
44
44
 
45
45
  % endif
@@ -3,34 +3,34 @@ Balanced::Reversal.all
3
3
 
4
4
  % elif mode == 'request':
5
5
  require 'balanced'
6
- Balanced.configure('ak-test-2q80HU8DISm2atgm0iRKRVIePzDb34qYp')
6
+ Balanced.configure('ak-test-YoVGJWMjOpkCPo6dWMfuiYbBYIB8q2JX')
7
7
 
8
8
  reversals = Balanced::Reversal.all
9
9
  % elif mode == 'response':
10
- [#<Balanced::Reversal:0x007fa7d414f158
10
+ [#<Balanced::Reversal:0x007fcde3aa0da8
11
11
  @attributes=
12
12
  {"amount"=>3000,
13
- "created_at"=>"2014-05-15T00:43:48.266113Z",
13
+ "created_at"=>"2014-12-17T21:26:06.246868Z",
14
14
  "currency"=>"USD",
15
15
  "description"=>"Reversal for Order #1111",
16
16
  "failure_reason"=>nil,
17
17
  "failure_reason_code"=>nil,
18
- "href"=>"/reversals/RV7BYCqyLOKwcWigapAoGWdr",
19
- "id"=>"RV7BYCqyLOKwcWigapAoGWdr",
20
- "links"=>{"credit"=>"CR7ushK6kWjPJYdh24QoM1A9", "order"=>nil},
18
+ "href"=>"/reversals/RVyHZ2toyTu9BCvGNLsOvLi",
19
+ "id"=>"RVyHZ2toyTu9BCvGNLsOvLi",
20
+ "links"=>{"credit"=>"CRxBIVaPCDZEbVgE1Jb0jkc", "order"=>nil},
21
21
  "meta"=>
22
22
  {"fulfillment.item.condition"=>"OK",
23
23
  "merchant.feedback"=>"positive",
24
24
  "user.refund_reason"=>"not happy with product"},
25
- "status"=>"succeeded",
26
- "transaction_number"=>"RV689-626-0403",
27
- "updated_at"=>"2014-05-15T00:43:53.755588Z"},
25
+ "status"=>"pending",
26
+ "transaction_number"=>"RV71F-IRJ-GYVF",
27
+ "updated_at"=>"2014-12-17T21:26:06.517468Z"},
28
28
  @hyperlinks=
29
29
  {"credit"=>
30
- #<Proc:0x007fa7d414d4e8/lib/balanced/resources/resource.rb:60 (lambda)>,
30
+ #<Proc:0x007fcde3a93c98/lib/balanced/resources/resource.rb:56 (lambda)>,
31
31
  "events"=>
32
- #<Proc:0x007fa7d4147458/lib/balanced/utils.rb:6 (lambda)>,
32
+ #<Proc:0x007fcde3a73448/lib/balanced/utils.rb:6 (lambda)>,
33
33
  "order"=>
34
- #<Proc:0x007fa7d4146a08/lib/balanced/utils.rb:6 (lambda)>}>]
34
+ #<Proc:0x007fcde3a71198/lib/balanced/utils.rb:6 (lambda)>}>]
35
35
 
36
36
  % endif
@@ -3,35 +3,35 @@ Balanced::Reversal.fetch
3
3
 
4
4
  % elif mode == 'request':
5
5
  require 'balanced'
6
- Balanced.configure('ak-test-2q80HU8DISm2atgm0iRKRVIePzDb34qYp')
6
+ Balanced.configure('ak-test-YoVGJWMjOpkCPo6dWMfuiYbBYIB8q2JX')
7
7
 
8
- reversal = Balanced::Reversal.fetch('/reversals/RV7BYCqyLOKwcWigapAoGWdr')
8
+ reversal = Balanced::Reversal.fetch('/reversals/RVyHZ2toyTu9BCvGNLsOvLi')
9
9
 
10
10
  % elif mode == 'response':
11
- #<Balanced::Reversal:0x007fa7d41277e8
11
+ #<Balanced::Reversal:0x007fcde39d6940
12
12
  @attributes=
13
13
  {"amount"=>3000,
14
- "created_at"=>"2014-05-15T00:43:48.266113Z",
14
+ "created_at"=>"2014-12-17T21:26:06.246868Z",
15
15
  "currency"=>"USD",
16
16
  "description"=>"Reversal for Order #1111",
17
17
  "failure_reason"=>nil,
18
18
  "failure_reason_code"=>nil,
19
- "href"=>"/reversals/RV7BYCqyLOKwcWigapAoGWdr",
20
- "id"=>"RV7BYCqyLOKwcWigapAoGWdr",
21
- "links"=>{"credit"=>"CR7ushK6kWjPJYdh24QoM1A9", "order"=>nil},
19
+ "href"=>"/reversals/RVyHZ2toyTu9BCvGNLsOvLi",
20
+ "id"=>"RVyHZ2toyTu9BCvGNLsOvLi",
21
+ "links"=>{"credit"=>"CRxBIVaPCDZEbVgE1Jb0jkc", "order"=>nil},
22
22
  "meta"=>
23
23
  {"fulfillment.item.condition"=>"OK",
24
24
  "merchant.feedback"=>"positive",
25
25
  "user.refund_reason"=>"not happy with product"},
26
- "status"=>"succeeded",
27
- "transaction_number"=>"RV689-626-0403",
28
- "updated_at"=>"2014-05-15T00:43:53.755588Z"},
26
+ "status"=>"pending",
27
+ "transaction_number"=>"RV71F-IRJ-GYVF",
28
+ "updated_at"=>"2014-12-17T21:26:06.517468Z"},
29
29
  @hyperlinks=
30
30
  {"credit"=>
31
- #<Proc:0x007fa7d41258d0/lib/balanced/resources/resource.rb:60 (lambda)>,
31
+ #<Proc:0x007fcde39cf050/lib/balanced/resources/resource.rb:56 (lambda)>,
32
32
  "events"=>
33
- #<Proc:0x007fa7d411f4a8/lib/balanced/utils.rb:6 (lambda)>,
33
+ #<Proc:0x007fcde39c4a88/lib/balanced/utils.rb:6 (lambda)>,
34
34
  "order"=>
35
- #<Proc:0x007fa7d411e968/lib/balanced/utils.rb:6 (lambda)>}>
35
+ #<Proc:0x007fcde39bfb00/lib/balanced/utils.rb:6 (lambda)>}>
36
36
 
37
37
  % endif
@@ -3,9 +3,9 @@ Balanced::Reversal.save
3
3
 
4
4
  % elif mode == 'request':
5
5
  require 'balanced'
6
- Balanced.configure('ak-test-2q80HU8DISm2atgm0iRKRVIePzDb34qYp')
6
+ Balanced.configure('ak-test-YoVGJWMjOpkCPo6dWMfuiYbBYIB8q2JX')
7
7
 
8
- reversal = Balanced::Reversal.fetch('/reversals/RV7BYCqyLOKwcWigapAoGWdr')
8
+ reversal = Balanced::Reversal.fetch('/reversals/RVyHZ2toyTu9BCvGNLsOvLi')
9
9
  reversal.description = 'update this description'
10
10
  reversal.meta = {
11
11
  'refund.reason' => 'user not happy with product',
@@ -15,30 +15,30 @@ reversal.meta = {
15
15
  reversal.save
16
16
 
17
17
  % elif mode == 'response':
18
- #<Balanced::Reversal:0x007fa7d40df150
18
+ #<Balanced::Reversal:0x007fcde3986b70
19
19
  @attributes=
20
20
  {"amount"=>3000,
21
- "created_at"=>"2014-05-15T00:43:48.266113Z",
21
+ "created_at"=>"2014-12-17T21:26:06.246868Z",
22
22
  "currency"=>"USD",
23
23
  "description"=>"update this description",
24
24
  "failure_reason"=>nil,
25
25
  "failure_reason_code"=>nil,
26
- "href"=>"/reversals/RV7BYCqyLOKwcWigapAoGWdr",
27
- "id"=>"RV7BYCqyLOKwcWigapAoGWdr",
28
- "links"=>{"credit"=>"CR7ushK6kWjPJYdh24QoM1A9", "order"=>nil},
26
+ "href"=>"/reversals/RVyHZ2toyTu9BCvGNLsOvLi",
27
+ "id"=>"RVyHZ2toyTu9BCvGNLsOvLi",
28
+ "links"=>{"credit"=>"CRxBIVaPCDZEbVgE1Jb0jkc", "order"=>nil},
29
29
  "meta"=>
30
30
  {"refund.reason"=>"user not happy with product",
31
31
  "user.notes"=>"very polite on the phone",
32
32
  "user.satisfaction"=>"6"},
33
- "status"=>"succeeded",
34
- "transaction_number"=>"RV689-626-0403",
35
- "updated_at"=>"2014-05-15T00:43:58.209158Z"},
33
+ "status"=>"pending",
34
+ "transaction_number"=>"RV71F-IRJ-GYVF",
35
+ "updated_at"=>"2014-12-17T21:26:10.853518Z"},
36
36
  @hyperlinks=
37
37
  {"credit"=>
38
- #<Proc:0x007fa7d40dd0a8/lib/balanced/resources/resource.rb:60 (lambda)>,
38
+ #<Proc:0x007fcde397f550/lib/balanced/resources/resource.rb:56 (lambda)>,
39
39
  "events"=>
40
- #<Proc:0x007fa7d40d70e0/lib/balanced/utils.rb:6 (lambda)>,
40
+ #<Proc:0x007fcde3964cc8/lib/balanced/utils.rb:6 (lambda)>,
41
41
  "order"=>
42
- #<Proc:0x007fa7d40d5678/lib/balanced/utils.rb:6 (lambda)>}>
42
+ #<Proc:0x007fcde395f0e8/lib/balanced/utils.rb:6 (lambda)>}>
43
43
 
44
44
  % endif
@@ -0,0 +1 @@
1
+ Balanced::Account.settle
@@ -0,0 +1,5 @@
1
+ <%= boiler_plate %>
2
+ account = Balanced::Account.fetch('<%= request['account_href'] %>')
3
+ account.settle(
4
+ <%= params_to_hash.call(payload).indent(2) %>
5
+ )
@@ -0,0 +1,48 @@
1
+ % if mode == 'definition':
2
+ Balanced::Account.settle
3
+
4
+ % elif mode == 'request':
5
+ require 'balanced'
6
+ Balanced.configure('ak-test-YoVGJWMjOpkCPo6dWMfuiYbBYIB8q2JX')
7
+
8
+ account = Balanced::Account.fetch('/accounts/AT68yF0GzJByks2OxU6oNjPy')
9
+ account.settle(
10
+ :appears_on_statement_as => 'ThingsCo',
11
+ :description => 'Payout A',
12
+ :funding_instrument => '/bank_accounts/BA6FZjm2W2mK0DIQibA1sjHv',
13
+ :meta => {
14
+ :group => 'alpha'
15
+ }
16
+ )
17
+ % elif mode == 'response':
18
+ #<Balanced::Settlement:0x007fcde3925550
19
+ @attributes=
20
+ {"amount"=>1000,
21
+ "appears_on_statement_as"=>"BAL*ThingsCo",
22
+ "created_at"=>"2014-12-17T21:26:13.225998Z",
23
+ "currency"=>"USD",
24
+ "description"=>"Payout A",
25
+ "failure_reason"=>nil,
26
+ "failure_reason_code"=>nil,
27
+ "href"=>"/settlements/STGy49Zg44ROAgkEbZP9T2w",
28
+ "id"=>"STGy49Zg44ROAgkEbZP9T2w",
29
+ "links"=>
30
+ {"destination"=>"BA6FZjm2W2mK0DIQibA1sjHv",
31
+ "source"=>"AT68yF0GzJByks2OxU6oNjPy"},
32
+ "meta"=>{"group"=>"alpha"},
33
+ "status"=>"pending",
34
+ "transaction_number"=>"SC3TJ-2PT-D0F1",
35
+ "updated_at"=>"2014-12-17T21:26:13.566850Z"},
36
+ @hyperlinks=
37
+ {"credits"=>
38
+ #<Proc:0x007fcde391e9f8/lib/balanced/utils.rb:6 (lambda)>,
39
+ "destination"=>
40
+ #<Proc:0x007fcde39160a0/lib/balanced/resources/resource.rb:56 (lambda)>,
41
+ "events"=>
42
+ #<Proc:0x007fcde390f660/lib/balanced/utils.rb:6 (lambda)>,
43
+ "reversals"=>
44
+ #<Proc:0x007fcde39070f0/lib/balanced/utils.rb:6 (lambda)>,
45
+ "source"=>
46
+ #<Proc:0x007fcde3907b18/lib/balanced/resources/resource.rb:56 (lambda)>}>
47
+
48
+ % endif
@@ -0,0 +1 @@
1
+ Balanced::Settlement.all
@@ -0,0 +1,2 @@
1
+ <%= boiler_plate %>
2
+ Balanced::Settlement.all
@@ -0,0 +1,40 @@
1
+ % if mode == 'definition':
2
+ Balanced::Settlement.all
3
+ % elif mode == 'request':
4
+ require 'balanced'
5
+ Balanced.configure('ak-test-YoVGJWMjOpkCPo6dWMfuiYbBYIB8q2JX')
6
+
7
+ Balanced::Settlement.all
8
+
9
+ % elif mode == 'response':
10
+ [#<Balanced::Settlement:0x007fcde389e988
11
+ @attributes=
12
+ {"amount"=>1000,
13
+ "appears_on_statement_as"=>"BAL*ThingsCo",
14
+ "created_at"=>"2014-12-17T21:26:13.225998Z",
15
+ "currency"=>"USD",
16
+ "description"=>"Payout A",
17
+ "failure_reason"=>nil,
18
+ "failure_reason_code"=>nil,
19
+ "href"=>"/settlements/STGy49Zg44ROAgkEbZP9T2w",
20
+ "id"=>"STGy49Zg44ROAgkEbZP9T2w",
21
+ "links"=>
22
+ {"destination"=>"BA6FZjm2W2mK0DIQibA1sjHv",
23
+ "source"=>"AT68yF0GzJByks2OxU6oNjPy"},
24
+ "meta"=>{"group"=>"alpha"},
25
+ "status"=>"pending",
26
+ "transaction_number"=>"SC3TJ-2PT-D0F1",
27
+ "updated_at"=>"2014-12-17T21:26:13.566850Z"},
28
+ @hyperlinks=
29
+ {"credits"=>
30
+ #<Proc:0x007fcde1170c58/lib/balanced/utils.rb:6 (lambda)>,
31
+ "destination"=>
32
+ #<Proc:0x007fcde1162d60/lib/balanced/resources/resource.rb:56 (lambda)>,
33
+ "events"=>
34
+ #<Proc:0x007fcde1152f00/lib/balanced/utils.rb:6 (lambda)>,
35
+ "reversals"=>
36
+ #<Proc:0x007fcde1143500/lib/balanced/utils.rb:6 (lambda)>,
37
+ "source"=>
38
+ #<Proc:0x007fcde1139960/lib/balanced/resources/resource.rb:56 (lambda)>}>]
39
+
40
+ % endif
@@ -0,0 +1 @@
1
+ Balanced::Account.settlements
@@ -0,0 +1,3 @@
1
+ <%= boiler_plate %>
2
+ account = Balanced::Account.fetch('<%= request['account_href'] %>')
3
+ account.settlements
@@ -0,0 +1,41 @@
1
+ % if mode == 'definition':
2
+ Balanced::Account.settlements
3
+
4
+ % elif mode == 'request':
5
+ require 'balanced'
6
+ Balanced.configure('ak-test-YoVGJWMjOpkCPo6dWMfuiYbBYIB8q2JX')
7
+
8
+ account = Balanced::Account.fetch('/accounts/AT68yF0GzJByks2OxU6oNjPy')
9
+ account.settlements
10
+ % elif mode == 'response':
11
+ [#<Balanced::Settlement:0x007fcde10b5cc8
12
+ @attributes=
13
+ {"amount"=>1000,
14
+ "appears_on_statement_as"=>"BAL*ThingsCo",
15
+ "created_at"=>"2014-12-17T21:26:13.225998Z",
16
+ "currency"=>"USD",
17
+ "description"=>"Payout A",
18
+ "failure_reason"=>nil,
19
+ "failure_reason_code"=>nil,
20
+ "href"=>"/settlements/STGy49Zg44ROAgkEbZP9T2w",
21
+ "id"=>"STGy49Zg44ROAgkEbZP9T2w",
22
+ "links"=>
23
+ {"destination"=>"BA6FZjm2W2mK0DIQibA1sjHv",
24
+ "source"=>"AT68yF0GzJByks2OxU6oNjPy"},
25
+ "meta"=>{"group"=>"alpha"},
26
+ "status"=>"pending",
27
+ "transaction_number"=>"SC3TJ-2PT-D0F1",
28
+ "updated_at"=>"2014-12-17T21:26:13.566850Z"},
29
+ @hyperlinks=
30
+ {"credits"=>
31
+ #<Proc:0x007fcde10af580/lib/balanced/utils.rb:6 (lambda)>,
32
+ "destination"=>
33
+ #<Proc:0x007fcde10a3280/lib/balanced/resources/resource.rb:56 (lambda)>,
34
+ "events"=>
35
+ #<Proc:0x007fcde109a6a8/lib/balanced/utils.rb:6 (lambda)>,
36
+ "reversals"=>
37
+ #<Proc:0x007fcde1081ce8/lib/balanced/utils.rb:6 (lambda)>,
38
+ "source"=>
39
+ #<Proc:0x007fcde1808cc8/lib/balanced/resources/resource.rb:56 (lambda)>}>]
40
+
41
+ % endif
@@ -0,0 +1 @@
1
+ Balanced::Settlement.fetch
@@ -0,0 +1,2 @@
1
+ <%= boiler_plate %>
2
+ settlement = Balanced::Settlement.fetch('<%=request['uri']%>')
@@ -0,0 +1,40 @@
1
+ % if mode == 'definition':
2
+ Balanced::Settlement.fetch
3
+ % elif mode == 'request':
4
+ require 'balanced'
5
+ Balanced.configure('ak-test-YoVGJWMjOpkCPo6dWMfuiYbBYIB8q2JX')
6
+
7
+ settlement = Balanced::Settlement.fetch('/settlements/STGy49Zg44ROAgkEbZP9T2w')
8
+
9
+ % elif mode == 'response':
10
+ #<Balanced::Settlement:0x007fcde08a9570
11
+ @attributes=
12
+ {"amount"=>1000,
13
+ "appears_on_statement_as"=>"BAL*ThingsCo",
14
+ "created_at"=>"2014-12-17T21:26:13.225998Z",
15
+ "currency"=>"USD",
16
+ "description"=>"Payout A",
17
+ "failure_reason"=>nil,
18
+ "failure_reason_code"=>nil,
19
+ "href"=>"/settlements/STGy49Zg44ROAgkEbZP9T2w",
20
+ "id"=>"STGy49Zg44ROAgkEbZP9T2w",
21
+ "links"=>
22
+ {"destination"=>"BA6FZjm2W2mK0DIQibA1sjHv",
23
+ "source"=>"AT68yF0GzJByks2OxU6oNjPy"},
24
+ "meta"=>{"group"=>"alpha"},
25
+ "status"=>"pending",
26
+ "transaction_number"=>"SC3TJ-2PT-D0F1",
27
+ "updated_at"=>"2014-12-17T21:26:13.566850Z"},
28
+ @hyperlinks=
29
+ {"credits"=>
30
+ #<Proc:0x007fcde089a3b8/lib/balanced/utils.rb:6 (lambda)>,
31
+ "destination"=>
32
+ #<Proc:0x007fcde0882a88/lib/balanced/resources/resource.rb:56 (lambda)>,
33
+ "events"=>
34
+ #<Proc:0x007fcde084b5b0/lib/balanced/utils.rb:6 (lambda)>,
35
+ "reversals"=>
36
+ #<Proc:0x007fcde0843bd0/lib/balanced/utils.rb:6 (lambda)>,
37
+ "source"=>
38
+ #<Proc:0x007fcde0840f48/lib/balanced/resources/resource.rb:56 (lambda)>}>
39
+
40
+ % endif
@@ -0,0 +1 @@
1
+ account.balance
@@ -0,0 +1,6 @@
1
+ bank_account = Balanced::BankAccount.new(
2
+ :type => 'checking',
3
+ :routing_number => '121000358',
4
+ :name => 'Johann Bernoulli',
5
+ :account_number => '9900000001'
6
+ ).save
@@ -0,0 +1,9 @@
1
+ # bank_account_href is the stored href for the BankAccount
2
+ # order_href is the stored href for the Order
3
+ bank_account = Balanced::BankAccount.fetch(bank_account_href)
4
+ bank_account.debit(
5
+ :amount => 5000,
6
+ :appears_on_statement_as => 'Statement text',
7
+ :description => 'Some descriptive text for the debit in the dashboard',
8
+ :order => order_href
9
+ )
@@ -0,0 +1,5 @@
1
+ # time has elapsed, so find the BankAccountVerification
2
+ verification = Balanced::BankAccountVerification.find('/verifications/BZ6Hm2DoTpcgoDzbIr6dWHpw')
3
+ amount_1 = 1
4
+ amount_2 = 1
5
+ verification.confirm(amount_1, amount_2)
@@ -0,0 +1 @@
1
+ verification = bank_account.verify
@@ -0,0 +1,4 @@
1
+ callback = Balanced::Callback.new(
2
+ :method => 'post',
3
+ :url => 'http://www.example.com/callback'
4
+ ).save