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::ApiKey.unstore
3
3
  % elif mode == 'request':
4
4
  require 'balanced'
5
- Balanced.configure('ak-test-2q80HU8DISm2atgm0iRKRVIePzDb34qYp')
5
+ Balanced.configure('ak-test-YoVGJWMjOpkCPo6dWMfuiYbBYIB8q2JX')
6
6
 
7
- key = Balanced::ApiKey.fetch('/api_keys/AK1B3lNyPQ63pRQa1JDC5os5')
7
+ key = Balanced::ApiKey.fetch('/api_keys/AK6gw2iNQrFpQk7jb8ONNjdb')
8
8
  key.unstore
9
9
 
10
10
  % elif mode == 'response':
@@ -2,27 +2,27 @@
2
2
  Balanced::ApiKey.all
3
3
  % elif mode == 'request':
4
4
  require 'balanced'
5
- Balanced.configure('ak-test-2q80HU8DISm2atgm0iRKRVIePzDb34qYp')
5
+ Balanced.configure('ak-test-YoVGJWMjOpkCPo6dWMfuiYbBYIB8q2JX')
6
6
 
7
7
  card = Balanced::ApiKey.all
8
8
 
9
9
  % elif mode == 'response':
10
- [#<Balanced::ApiKey:0x007fa7d409cc10
10
+ [#<Balanced::ApiKey:0x007fcde3ae3c20
11
11
  @attributes=
12
- {"created_at"=>"2014-05-15T00:38:16.692063Z",
13
- "href"=>"/api_keys/AK1B3lNyPQ63pRQa1JDC5os5",
14
- "id"=>"AK1B3lNyPQ63pRQa1JDC5os5",
12
+ {"created_at"=>"2014-12-17T21:24:11.308489Z",
13
+ "href"=>"/api_keys/AK6gw2iNQrFpQk7jb8ONNjdb",
14
+ "id"=>"AK6gw2iNQrFpQk7jb8ONNjdb",
15
15
  "links"=>{},
16
16
  "meta"=>{}},
17
17
  @hyperlinks={}>,
18
- #<Balanced::ApiKey:0x007fa7d409ca58
18
+ #<Balanced::ApiKey:0x007fcde3ae3a68
19
19
  @attributes=
20
- {"created_at"=>"2014-05-15T00:38:03.172007Z",
21
- "href"=>"/api_keys/AK1lQQL8kjXl6bLc7VE4wkUV",
22
- "id"=>"AK1lQQL8kjXl6bLc7VE4wkUV",
20
+ {"created_at"=>"2014-12-17T21:23:56.753175Z",
21
+ "href"=>"/api_keys/AK609iYW4vCKAiy9TqR73hDi",
22
+ "id"=>"AK609iYW4vCKAiy9TqR73hDi",
23
23
  "links"=>{},
24
24
  "meta"=>{},
25
- "secret"=>"ak-test-2q80HU8DISm2atgm0iRKRVIePzDb34qYp"},
25
+ "secret"=>"ak-test-YoVGJWMjOpkCPo6dWMfuiYbBYIB8q2JX"},
26
26
  @hyperlinks={}>]
27
27
 
28
28
  % endif
@@ -2,15 +2,15 @@
2
2
  Balanced::ApiKey.fetch
3
3
  % elif mode == 'request':
4
4
  require 'balanced'
5
- Balanced.configure('ak-test-2q80HU8DISm2atgm0iRKRVIePzDb34qYp')
5
+ Balanced.configure('ak-test-YoVGJWMjOpkCPo6dWMfuiYbBYIB8q2JX')
6
6
 
7
- card = Balanced::ApiKey.fetch('/api_keys/AK1B3lNyPQ63pRQa1JDC5os5')
7
+ card = Balanced::ApiKey.fetch('/api_keys/AK6gw2iNQrFpQk7jb8ONNjdb')
8
8
  % elif mode == 'response':
9
- #<Balanced::ApiKey:0x007fa7d4086aa0
9
+ #<Balanced::ApiKey:0x007fcde3af2658
10
10
  @attributes=
11
- {"created_at"=>"2014-05-15T00:38:16.692063Z",
12
- "href"=>"/api_keys/AK1B3lNyPQ63pRQa1JDC5os5",
13
- "id"=>"AK1B3lNyPQ63pRQa1JDC5os5",
11
+ {"created_at"=>"2014-12-17T21:24:11.308489Z",
12
+ "href"=>"/api_keys/AK6gw2iNQrFpQk7jb8ONNjdb",
13
+ "id"=>"AK6gw2iNQrFpQk7jb8ONNjdb",
14
14
  "links"=>{},
15
15
  "meta"=>{}},
16
16
  @hyperlinks={}>
@@ -3,13 +3,13 @@ Balanced::BankAccount.associate_to_customer
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
- bank_account = Balanced::BankAccount.fetch("/bank_accounts/BA2RqFlRIm0xqCNnHJNLYWMd")
9
- bank_account.associate_to_customer("/customers/CU2L981m9AtPY8pjpGpjnjnf")
8
+ bank_account = Balanced::BankAccount.fetch("/bank_accounts/BA6FZjm2W2mK0DIQibA1sjHv")
9
+ bank_account.associate_to_customer("/customers/CU68iUpvvUwpRpuuBL3u9Slq")
10
10
 
11
11
  % elif mode == 'response':
12
- #<Balanced::BankAccount:0x007fa7d4077f00
12
+ #<Balanced::BankAccount:0x007fcde18f7da0
13
13
  @attributes=
14
14
  {"account_number"=>"xxxxxx0001",
15
15
  "account_type"=>"checking",
@@ -23,27 +23,29 @@ bank_account.associate_to_customer("/customers/CU2L981m9AtPY8pjpGpjnjnf")
23
23
  "bank_name"=>"BANK OF AMERICA, N.A.",
24
24
  "can_credit"=>true,
25
25
  "can_debit"=>false,
26
- "created_at"=>"2014-05-15T00:39:26.378338Z",
26
+ "created_at"=>"2014-12-17T21:24:33.958576Z",
27
27
  "fingerprint"=>
28
28
  "5f0ba9fa3f1122ef13b944a40abfe44e7eba9e16934e64200913cb4c402ace14",
29
- "href"=>"/bank_accounts/BA2RqFlRIm0xqCNnHJNLYWMd",
30
- "id"=>"BA2RqFlRIm0xqCNnHJNLYWMd",
29
+ "href"=>"/bank_accounts/BA6FZjm2W2mK0DIQibA1sjHv",
30
+ "id"=>"BA6FZjm2W2mK0DIQibA1sjHv",
31
31
  "links"=>
32
- {"bank_account_verification"=>nil, "customer"=>"CU2L981m9AtPY8pjpGpjnjnf"},
32
+ {"bank_account_verification"=>nil, "customer"=>"CU68iUpvvUwpRpuuBL3u9Slq"},
33
33
  "meta"=>{},
34
34
  "name"=>"Johann Bernoulli",
35
35
  "routing_number"=>"121000358",
36
- "updated_at"=>"2014-05-15T00:39:27.323054Z"},
36
+ "updated_at"=>"2014-12-17T21:24:34.483147Z"},
37
37
  @hyperlinks=
38
38
  {"bank_account_verification"=>
39
- #<Proc:0x007fa7d40772d0/lib/balanced/utils.rb:6 (lambda)>,
39
+ #<Proc:0x007fcde18f7238/lib/balanced/utils.rb:6 (lambda)>,
40
40
  "bank_account_verifications"=>
41
- #<Proc:0x007fa7d4075340/lib/balanced/utils.rb:6 (lambda)>,
41
+ #<Proc:0x007fcde18f52f8/lib/balanced/utils.rb:6 (lambda)>,
42
42
  "credits"=>
43
- #<Proc:0x007fa7d401f0d0/lib/balanced/utils.rb:6 (lambda)>,
43
+ #<Proc:0x007fcde18ff348/lib/balanced/utils.rb:6 (lambda)>,
44
44
  "customer"=>
45
- #<Proc:0x007fa7d401d730/lib/balanced/resources/resource.rb:60 (lambda)>,
45
+ #<Proc:0x007fcde18fd9a8/lib/balanced/resources/resource.rb:56 (lambda)>,
46
46
  "debits"=>
47
- #<Proc:0x007fa7d30164e0/lib/balanced/utils.rb:6 (lambda)>}>
47
+ #<Proc:0x007fcde1907a20/lib/balanced/utils.rb:6 (lambda)>,
48
+ "settlements"=>
49
+ #<Proc:0x007fcde1905ae0/lib/balanced/utils.rb:6 (lambda)>}>
48
50
 
49
51
  % endif
@@ -3,7 +3,7 @@ Balanced::BankAccount.new
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
  bank_account = Balanced::BankAccount.new(
9
9
  :account_number => '9900000001',
@@ -13,7 +13,7 @@ bank_account = Balanced::BankAccount.new(
13
13
  ).save
14
14
 
15
15
  % elif mode == 'response':
16
- #<Balanced::BankAccount:0x007fa7d1e706c8
16
+ #<Balanced::BankAccount:0x007fcde19251d8
17
17
  @attributes=
18
18
  {"account_number"=>"xxxxxx0001",
19
19
  "account_type"=>"checking",
@@ -27,26 +27,28 @@ bank_account = Balanced::BankAccount.new(
27
27
  "bank_name"=>"BANK OF AMERICA, N.A.",
28
28
  "can_credit"=>true,
29
29
  "can_debit"=>false,
30
- "created_at"=>"2014-05-15T00:39:26.378338Z",
30
+ "created_at"=>"2014-12-17T21:24:33.958576Z",
31
31
  "fingerprint"=>
32
32
  "5f0ba9fa3f1122ef13b944a40abfe44e7eba9e16934e64200913cb4c402ace14",
33
- "href"=>"/bank_accounts/BA2RqFlRIm0xqCNnHJNLYWMd",
34
- "id"=>"BA2RqFlRIm0xqCNnHJNLYWMd",
33
+ "href"=>"/bank_accounts/BA6FZjm2W2mK0DIQibA1sjHv",
34
+ "id"=>"BA6FZjm2W2mK0DIQibA1sjHv",
35
35
  "links"=>{"bank_account_verification"=>nil, "customer"=>nil},
36
36
  "meta"=>{},
37
37
  "name"=>"Johann Bernoulli",
38
38
  "routing_number"=>"121000358",
39
- "updated_at"=>"2014-05-15T00:39:26.378342Z"},
39
+ "updated_at"=>"2014-12-17T21:24:33.958578Z"},
40
40
  @hyperlinks=
41
41
  {"bank_account_verification"=>
42
- #<Proc:0x007fa7d1e69468/lib/balanced/utils.rb:6 (lambda)>,
42
+ #<Proc:0x007fcde1924670/lib/balanced/utils.rb:6 (lambda)>,
43
43
  "bank_account_verifications"=>
44
- #<Proc:0x007fa7d1e5b0e8/lib/balanced/utils.rb:6 (lambda)>,
44
+ #<Proc:0x007fcde192e710/lib/balanced/utils.rb:6 (lambda)>,
45
45
  "credits"=>
46
- #<Proc:0x007fa7d1e50cd8/lib/balanced/utils.rb:6 (lambda)>,
46
+ #<Proc:0x007fcde192c7a8/lib/balanced/utils.rb:6 (lambda)>,
47
47
  "customer"=>
48
- #<Proc:0x007fa7d1e534b0/lib/balanced/utils.rb:6 (lambda)>,
48
+ #<Proc:0x007fcde1937d88/lib/balanced/utils.rb:6 (lambda)>,
49
49
  "debits"=>
50
- #<Proc:0x007fa7d1e43538/lib/balanced/utils.rb:6 (lambda)>}>
50
+ #<Proc:0x007fcde1935e48/lib/balanced/utils.rb:6 (lambda)>,
51
+ "settlements"=>
52
+ #<Proc:0x007fcde193fec0/lib/balanced/utils.rb:6 (lambda)>}>
51
53
 
52
54
  % endif
@@ -3,40 +3,40 @@ Balanced::BankAccount.credit
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
- bank_account = Balanced::BankAccount.fetch('/bank_accounts/BA2RqFlRIm0xqCNnHJNLYWMd')
8
+ bank_account = Balanced::BankAccount.fetch('/bank_accounts/BA6FZjm2W2mK0DIQibA1sjHv')
9
9
  bank_account.credit(:amount => 5000)
10
10
  % elif mode == 'response':
11
- #<Balanced::Credit:0x007fa7d1dbbe08
11
+ #<Balanced::Credit:0x007fcde195f158
12
12
  @attributes=
13
13
  {"amount"=>5000,
14
14
  "appears_on_statement_as"=>"example.com",
15
- "created_at"=>"2014-05-15T00:43:41.582121Z",
15
+ "created_at"=>"2014-12-17T21:26:05.270762Z",
16
16
  "currency"=>"USD",
17
17
  "description"=>nil,
18
18
  "failure_reason"=>nil,
19
19
  "failure_reason_code"=>nil,
20
- "href"=>"/credits/CR7ushK6kWjPJYdh24QoM1A9",
21
- "id"=>"CR7ushK6kWjPJYdh24QoM1A9",
20
+ "href"=>"/credits/CRxBIVaPCDZEbVgE1Jb0jkc",
21
+ "id"=>"CRxBIVaPCDZEbVgE1Jb0jkc",
22
22
  "links"=>
23
- {"customer"=>"CU2L981m9AtPY8pjpGpjnjnf",
24
- "destination"=>"BA2RqFlRIm0xqCNnHJNLYWMd",
23
+ {"customer"=>"CU68iUpvvUwpRpuuBL3u9Slq",
24
+ "destination"=>"BA6FZjm2W2mK0DIQibA1sjHv",
25
25
  "order"=>nil},
26
26
  "meta"=>{},
27
- "status"=>"succeeded",
28
- "transaction_number"=>"CR169-215-3928",
29
- "updated_at"=>"2014-05-15T00:43:46.428002Z"},
27
+ "status"=>"pending",
28
+ "transaction_number"=>"CRO2C-OJ8-PQSK",
29
+ "updated_at"=>"2014-12-17T21:26:05.739244Z"},
30
30
  @hyperlinks=
31
31
  {"customer"=>
32
- #<Proc:0x007fa7d1db3910/lib/balanced/resources/resource.rb:60 (lambda)>,
32
+ #<Proc:0x007fcde195d628/lib/balanced/resources/resource.rb:56 (lambda)>,
33
33
  "destination"=>
34
- #<Proc:0x007fa7d1daaea0/lib/balanced/resources/resource.rb:60 (lambda)>,
34
+ #<Proc:0x007fcde1967c90/lib/balanced/resources/resource.rb:56 (lambda)>,
35
35
  "events"=>
36
- #<Proc:0x007fa7d1da23e0/lib/balanced/utils.rb:6 (lambda)>,
36
+ #<Proc:0x007fcde1965ee0/lib/balanced/utils.rb:6 (lambda)>,
37
37
  "order"=>
38
- #<Proc:0x007fa7d1da0f68/lib/balanced/utils.rb:6 (lambda)>,
38
+ #<Proc:0x007fcde1965508/lib/balanced/utils.rb:6 (lambda)>,
39
39
  "reversals"=>
40
- #<Proc:0x007fa7d1d913b0/lib/balanced/utils.rb:6 (lambda)>}>
40
+ #<Proc:0x007fcde196f710/lib/balanced/utils.rb:6 (lambda)>}>
41
41
 
42
42
  % endif
@@ -3,9 +3,9 @@ Balanced::BankAccount.debit
3
3
 
4
4
  % elif mode == 'request':
5
5
  require 'balanced'
6
- Balanced.configure('ak-test-2q80HU8DISm2atgm0iRKRVIePzDb34qYp')
6
+ Balanced.configure('ak-test-25ZY8HQwZPuQtDecrxb671LilUya5t5G0')
7
7
 
8
- bank_account = Balanced::BankAccount.fetch('/bank_accounts/BA1W9SQLf5YRaGbUGiNIO2fb')
8
+ bank_account = Balanced::BankAccount.fetch('/bank_accounts/BA17zYxBNrmg9isvicjz9Ae4')
9
9
  bank_account.debit(
10
10
  :amount => 5000,
11
11
  :appears_on_statement_as => 'Statement text',
@@ -13,38 +13,41 @@ bank_account.debit(
13
13
  )
14
14
 
15
15
  % elif mode == 'response':
16
- #<Balanced::Debit:0x007fa7d1d437c8
16
+ #<Balanced::Debit:0x007fb1e9473a68
17
17
  @attributes=
18
18
  {"amount"=>5000,
19
19
  "appears_on_statement_as"=>"BAL*Statement text",
20
- "created_at"=>"2014-05-15T00:39:29.277773Z",
20
+ "created_at"=>"2014-11-14T19:28:20.531858Z",
21
21
  "currency"=>"USD",
22
22
  "description"=>"Some descriptive text for the debit in the dashboard",
23
23
  "failure_reason"=>nil,
24
24
  "failure_reason_code"=>nil,
25
- "href"=>"/debits/WD2UGQIxoTJkklZqAj2lpR9X",
26
- "id"=>"WD2UGQIxoTJkklZqAj2lpR9X",
25
+ "href"=>"/debits/WD2rNbc5IxoDIyiumypsUMtv",
26
+ "id"=>"WD2rNbc5IxoDIyiumypsUMtv",
27
27
  "links"=>
28
- {"customer"=>nil,
28
+ {"card_hold"=>nil,
29
+ "customer"=>nil,
29
30
  "dispute"=>nil,
30
31
  "order"=>nil,
31
- "source"=>"BA1W9SQLf5YRaGbUGiNIO2fb"},
32
+ "source"=>"BA17zYxBNrmg9isvicjz9Ae4"},
32
33
  "meta"=>{},
33
- "status"=>"succeeded",
34
- "transaction_number"=>"W708-603-3376",
35
- "updated_at"=>"2014-05-15T00:39:31.007857Z"},
34
+ "status"=>"pending",
35
+ "transaction_number"=>"WSVJ-8FD-G2UK",
36
+ "updated_at"=>"2014-11-14T19:28:20.985200Z"},
36
37
  @hyperlinks=
37
- {"customer"=>
38
- #<Proc:0x007fa7d1d31c80/lib/balanced/utils.rb:6 (lambda)>,
38
+ {"card_hold"=>
39
+ #<Proc:0x007fb1e9472f28@/Users/ben/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/balanced-1.1.1/lib/balanced/utils.rb:6 (lambda)>,
40
+ "customer"=>
41
+ #<Proc:0x007fb1e94725a0@/Users/ben/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/balanced-1.1.1/lib/balanced/utils.rb:6 (lambda)>,
39
42
  "dispute"=>
40
- #<Proc:0x007fa7d1d2be98/lib/balanced/utils.rb:6 (lambda)>,
43
+ #<Proc:0x007fb1e9471c18@/Users/ben/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/balanced-1.1.1/lib/balanced/utils.rb:6 (lambda)>,
41
44
  "events"=>
42
- #<Proc:0x007fa7d1d28c70/lib/balanced/utils.rb:6 (lambda)>,
45
+ #<Proc:0x007fb1e947bd58@/Users/ben/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/balanced-1.1.1/lib/balanced/utils.rb:6 (lambda)>,
43
46
  "order"=>
44
- #<Proc:0x007fa7d1d231f8/lib/balanced/utils.rb:6 (lambda)>,
47
+ #<Proc:0x007fb1e947b380@/Users/ben/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/balanced-1.1.1/lib/balanced/utils.rb:6 (lambda)>,
45
48
  "refunds"=>
46
- #<Proc:0x007fa7d1d19ce8/lib/balanced/utils.rb:6 (lambda)>,
49
+ #<Proc:0x007fb1e9479530@/Users/ben/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/balanced-1.1.1/lib/balanced/utils.rb:6 (lambda)>,
47
50
  "source"=>
48
- #<Proc:0x007fa7d1d139d8/lib/balanced/resources/resource.rb:60 (lambda)>}>
51
+ #<Proc:0x007fb1e9483b48@/Users/ben/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/balanced-1.1.1/lib/balanced/resources/resource.rb:60 (lambda)>}>
49
52
 
50
53
  % endif
@@ -0,0 +1 @@
1
+ Balanced::Order.debit_from
@@ -0,0 +1,7 @@
1
+ <%= boiler_plate %>
2
+ order = Balanced::Order.fetch('<%= request['order_href'] %>')
3
+ bank_account = Balanced::BankAccount.fetch('<%= request['bank_account_href'] %>')
4
+ order.debit_from(
5
+ :source => bank_account,
6
+ :amount => <%= request['payload']['amount'] %>
7
+ )
@@ -0,0 +1,52 @@
1
+ % if mode == 'definition':
2
+ Balanced::Order.debit_from
3
+ % elif mode == 'request':
4
+ require 'balanced'
5
+ Balanced.configure('ak-test-YoVGJWMjOpkCPo6dWMfuiYbBYIB8q2JX')
6
+
7
+ order = Balanced::Order.fetch('/orders/OR6c6n11zKSFfjE6kGNKtsE8')
8
+ bank_account = Balanced::BankAccount.fetch('/bank_accounts/BA6m4zboF7ocvKbkhjszP5NS')
9
+ order.debit_from(
10
+ :source => bank_account,
11
+ :amount => 5000
12
+ )
13
+
14
+ % elif mode == 'response':
15
+ #<Balanced::Debit:0x007fcde1984598
16
+ @attributes=
17
+ {"amount"=>5000,
18
+ "appears_on_statement_as"=>"BAL*example.com",
19
+ "created_at"=>"2014-12-17T21:24:36.080525Z",
20
+ "currency"=>"USD",
21
+ "description"=>"Order #12341234",
22
+ "failure_reason"=>nil,
23
+ "failure_reason_code"=>nil,
24
+ "href"=>"/debits/WD6InqCi6JBE8YNoH0co1Wla",
25
+ "id"=>"WD6InqCi6JBE8YNoH0co1Wla",
26
+ "links"=>
27
+ {"card_hold"=>nil,
28
+ "customer"=>nil,
29
+ "dispute"=>nil,
30
+ "order"=>"OR6c6n11zKSFfjE6kGNKtsE8",
31
+ "source"=>"BA6m4zboF7ocvKbkhjszP5NS"},
32
+ "meta"=>{},
33
+ "status"=>"pending",
34
+ "transaction_number"=>"WC7M-IMJ-2SSI",
35
+ "updated_at"=>"2014-12-17T21:24:36.328328Z"},
36
+ @hyperlinks=
37
+ {"card_hold"=>
38
+ #<Proc:0x007fcde198fa10/lib/balanced/utils.rb:6 (lambda)>,
39
+ "customer"=>
40
+ #<Proc:0x007fcde198f088/lib/balanced/utils.rb:6 (lambda)>,
41
+ "dispute"=>
42
+ #<Proc:0x007fcde198e700/lib/balanced/utils.rb:6 (lambda)>,
43
+ "events"=>
44
+ #<Proc:0x007fcde198c888/lib/balanced/utils.rb:6 (lambda)>,
45
+ "order"=>
46
+ #<Proc:0x007fcde1996e78/lib/balanced/resources/resource.rb:56 (lambda)>,
47
+ "refunds"=>
48
+ #<Proc:0x007fcde1995028/lib/balanced/utils.rb:6 (lambda)>,
49
+ "source"=>
50
+ #<Proc:0x007fcde199f668/lib/balanced/resources/resource.rb:56 (lambda)>}>
51
+
52
+ % endif
@@ -3,9 +3,9 @@ Balanced::BankAccount.unstore
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
- bank_account = Balanced::BankAccount.fetch('/bank_accounts/BA2EmblHC08bmwiwwNrbI0Rj')
8
+ bank_account = Balanced::BankAccount.fetch('/bank_accounts/BA6z9hDVGj7utvQSiIhHuuhf')
9
9
  bank_account.unstore
10
10
 
11
11
  % elif mode == 'response':
@@ -3,12 +3,12 @@ Balanced::BankAccount.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
  Balanced::BankAccount.all
9
9
 
10
10
  % elif mode == 'response':
11
- [#<Balanced::BankAccount:0x007fa7d1c9b410
11
+ [#<Balanced::BankAccount:0x007fcde197e7d8
12
12
  @attributes=
13
13
  {"account_number"=>"xxxxxx0001",
14
14
  "account_type"=>"checking",
@@ -22,28 +22,30 @@ Balanced::BankAccount.all
22
22
  "bank_name"=>"BANK OF AMERICA, N.A.",
23
23
  "can_credit"=>true,
24
24
  "can_debit"=>false,
25
- "created_at"=>"2014-05-15T00:39:14.751497Z",
25
+ "created_at"=>"2014-12-17T21:24:27.877249Z",
26
26
  "fingerprint"=>
27
27
  "5f0ba9fa3f1122ef13b944a40abfe44e7eba9e16934e64200913cb4c402ace14",
28
- "href"=>"/bank_accounts/BA2EmblHC08bmwiwwNrbI0Rj",
29
- "id"=>"BA2EmblHC08bmwiwwNrbI0Rj",
28
+ "href"=>"/bank_accounts/BA6z9hDVGj7utvQSiIhHuuhf",
29
+ "id"=>"BA6z9hDVGj7utvQSiIhHuuhf",
30
30
  "links"=>{"bank_account_verification"=>nil, "customer"=>nil},
31
31
  "meta"=>{},
32
32
  "name"=>"Johann Bernoulli",
33
33
  "routing_number"=>"121000358",
34
- "updated_at"=>"2014-05-15T00:39:14.751501Z"},
34
+ "updated_at"=>"2014-12-17T21:24:27.877250Z"},
35
35
  @hyperlinks=
36
36
  {"bank_account_verification"=>
37
- #<Proc:0x007fa7d1c93260/lib/balanced/utils.rb:6 (lambda)>,
37
+ #<Proc:0x007fcde197dc70/lib/balanced/utils.rb:6 (lambda)>,
38
38
  "bank_account_verifications"=>
39
- #<Proc:0x007fa7d1c83860/lib/balanced/utils.rb:6 (lambda)>,
39
+ #<Proc:0x007fcde195fc48/lib/balanced/utils.rb:6 (lambda)>,
40
40
  "credits"=>
41
- #<Proc:0x007fa7d1c7b1b0/lib/balanced/utils.rb:6 (lambda)>,
41
+ #<Proc:0x007fcde195dce0/lib/balanced/utils.rb:6 (lambda)>,
42
42
  "customer"=>
43
- #<Proc:0x007fa7d1c79720/lib/balanced/utils.rb:6 (lambda)>,
43
+ #<Proc:0x007fcde195d330/lib/balanced/utils.rb:6 (lambda)>,
44
44
  "debits"=>
45
- #<Proc:0x007fa7d1c6af90/lib/balanced/utils.rb:6 (lambda)>}>,
46
- #<Balanced::BankAccount:0x007fa7d1c6af40
45
+ #<Proc:0x007fcde19272d0/lib/balanced/utils.rb:6 (lambda)>,
46
+ "settlements"=>
47
+ #<Proc:0x007fcde19252f0/lib/balanced/utils.rb:6 (lambda)>}>,
48
+ #<Balanced::BankAccount:0x007fcde19252a0
47
49
  @attributes=
48
50
  {"account_number"=>"xxxxxx0001",
49
51
  "account_type"=>"checking",
@@ -57,28 +59,30 @@ Balanced::BankAccount.all
57
59
  "bank_name"=>"BANK OF AMERICA, N.A.",
58
60
  "can_credit"=>true,
59
61
  "can_debit"=>true,
60
- "created_at"=>"2014-05-15T00:38:35.458618Z",
62
+ "created_at"=>"2014-12-17T21:24:16.246660Z",
61
63
  "fingerprint"=>
62
64
  "5f0ba9fa3f1122ef13b944a40abfe44e7eba9e16934e64200913cb4c402ace14",
63
- "href"=>"/bank_accounts/BA1W9SQLf5YRaGbUGiNIO2fb",
64
- "id"=>"BA1W9SQLf5YRaGbUGiNIO2fb",
65
+ "href"=>"/bank_accounts/BA6m4zboF7ocvKbkhjszP5NS",
66
+ "id"=>"BA6m4zboF7ocvKbkhjszP5NS",
65
67
  "links"=>
66
- {"bank_account_verification"=>"BZ2hpl7vb9rgWVZxrXRzZb93",
68
+ {"bank_account_verification"=>"BZ6tLSIRoUIhzntA96EfMaQl",
67
69
  "customer"=>nil},
68
70
  "meta"=>{},
69
71
  "name"=>"Johann Bernoulli",
70
72
  "routing_number"=>"121000358",
71
- "updated_at"=>"2014-05-15T00:39:12.506691Z"},
73
+ "updated_at"=>"2014-12-17T21:24:26.167634Z"},
72
74
  @hyperlinks=
73
75
  {"bank_account_verification"=>
74
- #<Proc:0x007fa7d1c68330/lib/balanced/resources/resource.rb:60 (lambda)>,
76
+ #<Proc:0x007fcde18f77b0/lib/balanced/resources/resource.rb:56 (lambda)>,
75
77
  "bank_account_verifications"=>
76
- #<Proc:0x007fa7d1c58548/lib/balanced/utils.rb:6 (lambda)>,
78
+ #<Proc:0x007fcde18f5898/lib/balanced/utils.rb:6 (lambda)>,
77
79
  "credits"=>
78
- #<Proc:0x007fa7d1c4bbe0/lib/balanced/utils.rb:6 (lambda)>,
80
+ #<Proc:0x007fcde18ef920/lib/balanced/utils.rb:6 (lambda)>,
79
81
  "customer"=>
80
- #<Proc:0x007fa7d1c48ee0/lib/balanced/utils.rb:6 (lambda)>,
82
+ #<Proc:0x007fcde18eef70/lib/balanced/utils.rb:6 (lambda)>,
81
83
  "debits"=>
82
- #<Proc:0x007fa7d1c320c8/lib/balanced/utils.rb:6 (lambda)>}>]
84
+ #<Proc:0x007fcde18ecef0/lib/balanced/utils.rb:6 (lambda)>,
85
+ "settlements"=>
86
+ #<Proc:0x007fcde3af2fb8/lib/balanced/utils.rb:6 (lambda)>}>]
83
87
 
84
88
  % endif