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
@@ -3,11 +3,11 @@ Balanced::Card.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
- card = Balanced::Card.fetch('/cards/CC4gG6BE70pMOYKPBive9qoF')
8
+ card = Balanced::Card.fetch('/cards/CC73IyzxPUu2z89NH8GrJhLn')
9
9
  % elif mode == 'response':
10
- #<Balanced::Card:0x007fa7d32ed1c8
10
+ #<Balanced::Card:0x007fcde1937900
11
11
  @attributes=
12
12
  {"address"=>
13
13
  {"city"=>nil,
@@ -19,12 +19,12 @@ card = Balanced::Card.fetch('/cards/CC4gG6BE70pMOYKPBive9qoF')
19
19
  "avs_postal_match"=>nil,
20
20
  "avs_result"=>nil,
21
21
  "avs_street_match"=>nil,
22
- "bank"=>"BANK OF HAWAII",
22
+ "bank_name"=>"BANK OF HAWAII",
23
23
  "brand"=>"MasterCard",
24
24
  "can_credit"=>false,
25
25
  "can_debit"=>true,
26
- "category"=>nil,
27
- "created_at"=>"2014-05-15T00:40:43.949061Z",
26
+ "category"=>"other",
27
+ "created_at"=>"2014-12-17T21:24:55.056930Z",
28
28
  "cvv"=>"xxx",
29
29
  "cvv_match"=>"yes",
30
30
  "cvv_result"=>"Match",
@@ -32,25 +32,23 @@ card = Balanced::Card.fetch('/cards/CC4gG6BE70pMOYKPBive9qoF')
32
32
  "expiration_year"=>2020,
33
33
  "fingerprint"=>
34
34
  "fc4ccd5de54f42a5e75f76fbfde60948440c7a382ee7d21b2bc509ab9cfed788",
35
- "href"=>"/cards/CC4gG6BE70pMOYKPBive9qoF",
36
- "id"=>"CC4gG6BE70pMOYKPBive9qoF",
35
+ "href"=>"/cards/CC73IyzxPUu2z89NH8GrJhLn",
36
+ "id"=>"CC73IyzxPUu2z89NH8GrJhLn",
37
37
  "is_verified"=>true,
38
38
  "links"=>{"customer"=>nil},
39
39
  "meta"=>{},
40
40
  "name"=>nil,
41
41
  "number"=>"xxxxxxxxxxxx5100",
42
- "type"=>"",
43
- "updated_at"=>"2014-05-15T00:40:43.949064Z"},
42
+ "type"=>"credit",
43
+ "updated_at"=>"2014-12-17T21:24:55.056933Z"},
44
44
  @hyperlinks=
45
45
  {"card_holds"=>
46
- #<Proc:0x007fa7d32ea770/lib/balanced/utils.rb:6 (lambda)>,
47
- "credits"=>
48
- #<Proc:0x007fa7d32e8628/lib/balanced/utils.rb:6 (lambda)>,
46
+ #<Proc:0x007fcde19356f0/lib/balanced/utils.rb:6 (lambda)>,
49
47
  "customer"=>
50
- #<Proc:0x007fa7d32e7bb0/lib/balanced/utils.rb:6 (lambda)>,
48
+ #<Proc:0x007fcde1934d40/lib/balanced/utils.rb:6 (lambda)>,
51
49
  "debits"=>
52
- #<Proc:0x007fa7d32e5c70/lib/balanced/utils.rb:6 (lambda)>,
50
+ #<Proc:0x007fcde192d338/lib/balanced/utils.rb:6 (lambda)>,
53
51
  "disputes"=>
54
- #<Proc:0x007fa7d32b3478/lib/balanced/utils.rb:6 (lambda)>}>
52
+ #<Proc:0x007fcde191ea90/lib/balanced/utils.rb:6 (lambda)>}>
55
53
 
56
54
  % endif
@@ -3,9 +3,9 @@ Balanced::Card.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
- card = Balanced::Card.fetch('/cards/CC4gG6BE70pMOYKPBive9qoF')
8
+ card = Balanced::Card.fetch('/cards/CC73IyzxPUu2z89NH8GrJhLn')
9
9
  card.meta = {
10
10
  'facebook.user_id' => '0192837465',
11
11
  'my-own-customer-id' => '12345',
@@ -14,7 +14,7 @@ card.meta = {
14
14
  card.save
15
15
 
16
16
  % elif mode == 'response':
17
- #<Balanced::Card:0x007fa7d4216410
17
+ #<Balanced::Card:0x007fcde09e3328
18
18
  @attributes=
19
19
  {"address"=>
20
20
  {"city"=>nil,
@@ -26,12 +26,12 @@ card.save
26
26
  "avs_postal_match"=>nil,
27
27
  "avs_result"=>nil,
28
28
  "avs_street_match"=>nil,
29
- "bank"=>"BANK OF HAWAII",
29
+ "bank_name"=>"BANK OF HAWAII",
30
30
  "brand"=>"MasterCard",
31
31
  "can_credit"=>false,
32
32
  "can_debit"=>true,
33
- "category"=>nil,
34
- "created_at"=>"2014-05-15T00:40:43.949061Z",
33
+ "category"=>"other",
34
+ "created_at"=>"2014-12-17T21:24:55.056930Z",
35
35
  "cvv"=>"xxx",
36
36
  "cvv_match"=>"yes",
37
37
  "cvv_result"=>"Match",
@@ -39,8 +39,8 @@ card.save
39
39
  "expiration_year"=>2020,
40
40
  "fingerprint"=>
41
41
  "fc4ccd5de54f42a5e75f76fbfde60948440c7a382ee7d21b2bc509ab9cfed788",
42
- "href"=>"/cards/CC4gG6BE70pMOYKPBive9qoF",
43
- "id"=>"CC4gG6BE70pMOYKPBive9qoF",
42
+ "href"=>"/cards/CC73IyzxPUu2z89NH8GrJhLn",
43
+ "id"=>"CC73IyzxPUu2z89NH8GrJhLn",
44
44
  "is_verified"=>true,
45
45
  "links"=>{"customer"=>nil},
46
46
  "meta"=>
@@ -49,18 +49,16 @@ card.save
49
49
  "twitter.id"=>"1234987650"},
50
50
  "name"=>nil,
51
51
  "number"=>"xxxxxxxxxxxx5100",
52
- "type"=>"",
53
- "updated_at"=>"2014-05-15T00:40:47.925893Z"},
52
+ "type"=>"credit",
53
+ "updated_at"=>"2014-12-17T21:24:59.521759Z"},
54
54
  @hyperlinks=
55
55
  {"card_holds"=>
56
- #<Proc:0x007fa7d420ff20/lib/balanced/utils.rb:6 (lambda)>,
57
- "credits"=>
58
- #<Proc:0x007fa7d420da90/lib/balanced/utils.rb:6 (lambda)>,
56
+ #<Proc:0x007fcde09e1258/lib/balanced/utils.rb:6 (lambda)>,
59
57
  "customer"=>
60
- #<Proc:0x007fa7d420cfa0/lib/balanced/utils.rb:6 (lambda)>,
58
+ #<Proc:0x007fcde09e08a8/lib/balanced/utils.rb:6 (lambda)>,
61
59
  "debits"=>
62
- #<Proc:0x007fa7d4205ca0/lib/balanced/utils.rb:6 (lambda)>,
60
+ #<Proc:0x007fcde09b29d0/lib/balanced/utils.rb:6 (lambda)>,
63
61
  "disputes"=>
64
- #<Proc:0x007fa7d41ff3f0/lib/balanced/utils.rb:6 (lambda)>}>
62
+ #<Proc:0x007fcde09b0b58/lib/balanced/utils.rb:6 (lambda)>}>
65
63
 
66
64
  % endif
@@ -3,39 +3,69 @@ Balanced::Credit.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
  credits = Balanced::Credit.all
9
9
  % elif mode == 'response':
10
- [#<Balanced::Credit:0x007fa7d41ce638
10
+ [#<Balanced::Credit:0x007fcde19248f0
11
11
  @attributes=
12
12
  {"amount"=>5000,
13
13
  "appears_on_statement_as"=>"example.com",
14
- "created_at"=>"2014-05-15T00:41:13.829371Z",
14
+ "created_at"=>"2014-12-17T21:25:09.678154Z",
15
15
  "currency"=>"USD",
16
16
  "description"=>nil,
17
17
  "failure_reason"=>nil,
18
18
  "failure_reason_code"=>nil,
19
- "href"=>"/credits/CR4OhD4V9LuxGe5kXaNpUULD",
20
- "id"=>"CR4OhD4V9LuxGe5kXaNpUULD",
19
+ "href"=>"/credits/CR7k9iyKSImqoPcvZyPNAcbm",
20
+ "id"=>"CR7k9iyKSImqoPcvZyPNAcbm",
21
21
  "links"=>
22
- {"customer"=>"CU2L981m9AtPY8pjpGpjnjnf",
23
- "destination"=>"BA2RqFlRIm0xqCNnHJNLYWMd",
22
+ {"customer"=>"CU68iUpvvUwpRpuuBL3u9Slq",
23
+ "destination"=>"BA6FZjm2W2mK0DIQibA1sjHv",
24
24
  "order"=>nil},
25
25
  "meta"=>{},
26
+ "status"=>"pending",
27
+ "transaction_number"=>"CRRWI-1PN-WA3D",
28
+ "updated_at"=>"2014-12-17T21:25:10.040086Z"},
29
+ @hyperlinks=
30
+ {"customer"=>
31
+ #<Proc:0x007fcde18eee30/lib/balanced/resources/resource.rb:56 (lambda)>,
32
+ "destination"=>
33
+ #<Proc:0x007fcde18ed468/lib/balanced/resources/resource.rb:56 (lambda)>,
34
+ "events"=>
35
+ #<Proc:0x007fcde3af35a8/lib/balanced/utils.rb:6 (lambda)>,
36
+ "order"=>
37
+ #<Proc:0x007fcde3af2b80/lib/balanced/utils.rb:6 (lambda)>,
38
+ "reversals"=>
39
+ #<Proc:0x007fcde3af0d30/lib/balanced/utils.rb:6 (lambda)>}>,
40
+ #<Balanced::Credit:0x007fcde3af0ce0
41
+ @attributes=
42
+ {"amount"=>5000,
43
+ "appears_on_statement_as"=>"example.com",
44
+ "created_at"=>"2014-12-17T21:25:06.303877Z",
45
+ "currency"=>"USD",
46
+ "description"=>"Order #12341234",
47
+ "failure_reason"=>nil,
48
+ "failure_reason_code"=>nil,
49
+ "href"=>"/credits/CR7gmj42wn3NG2br01RjK1k9",
50
+ "id"=>"CR7gmj42wn3NG2br01RjK1k9",
51
+ "links"=>
52
+ {"customer"=>"CU68iUpvvUwpRpuuBL3u9Slq",
53
+ "destination"=>"CC7bBGoeKPe5DBKWgduZd5Cl",
54
+ "order"=>"OR6c6n11zKSFfjE6kGNKtsE8"},
55
+ "meta"=>{},
26
56
  "status"=>"succeeded",
27
- "transaction_number"=>"CR666-433-9281",
28
- "updated_at"=>"2014-05-15T00:41:14.822162Z"},
57
+ "transaction_number"=>"CRPDQ-Y1M-24PV",
58
+ "updated_at"=>"2014-12-17T21:25:06.683745Z"},
29
59
  @hyperlinks=
30
60
  {"customer"=>
31
- #<Proc:0x007fa7d41cc978/lib/balanced/resources/resource.rb:60 (lambda)>,
61
+ #<Proc:0x007fcde13831d0/lib/balanced/resources/resource.rb:56 (lambda)>,
32
62
  "destination"=>
33
- #<Proc:0x007fa7d41c6f50/lib/balanced/resources/resource.rb:60 (lambda)>,
63
+ #<Proc:0x007fcde13817e0/lib/balanced/resources/resource.rb:56 (lambda)>,
34
64
  "events"=>
35
- #<Proc:0x007fa7d41c4c78/lib/balanced/utils.rb:6 (lambda)>,
65
+ #<Proc:0x007fcde1373a00/lib/balanced/utils.rb:6 (lambda)>,
36
66
  "order"=>
37
- #<Proc:0x007fa7d41c4228/lib/balanced/utils.rb:6 (lambda)>,
67
+ #<Proc:0x007fcde1372060/lib/balanced/resources/resource.rb:56 (lambda)>,
38
68
  "reversals"=>
39
- #<Proc:0x007fa7d41bdf18/lib/balanced/utils.rb:6 (lambda)>}>]
69
+ #<Proc:0x007fcde1370170/lib/balanced/utils.rb:6 (lambda)>}>]
40
70
 
41
71
  % endif
@@ -3,11 +3,11 @@ Balanced::BankAccount.credits
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
  credits = bank_account.credits
10
10
  % elif mode == 'response':
11
- {}
11
+ []
12
12
 
13
13
  % endif
@@ -1,7 +1,7 @@
1
1
  <%= boiler_plate %>
2
- order = Balanced::Order.fetch('<%= request['order_href'] %>')
2
+ order = Balanced::Order.fetch('<%= request['order_href'] %>')
3
3
  bank_account = Balanced::BankAccount.fetch('<%= request['bank_account_href'] %>')
4
4
  order.credit_to(
5
- :source => bank_account,
5
+ :destination => bank_account,
6
6
  :amount => <%= request['payload']['amount'] %>
7
7
  )
@@ -3,24 +3,45 @@ Balanced::Order.credit_to
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
- order = Balanced::Order.fetch('/orders/OR4R53c8wdUiVEUiegSHpwaN')
9
- bank_account = Balanced::BankAccount.fetch('/bank_accounts/BA2EmblHC08bmwiwwNrbI0Rj/credits')
8
+ order = Balanced::Order.fetch('/orders/OR6c6n11zKSFfjE6kGNKtsE8')
9
+ bank_account = Balanced::BankAccount.fetch('/bank_accounts/BA6FZjm2W2mK0DIQibA1sjHv/credits')
10
10
  order.credit_to(
11
- :source => bank_account,
11
+ :destination => bank_account,
12
12
  :amount => 5000
13
13
  )
14
14
  % elif mode == 'response':
15
- {"errors"=>
16
- [{"additional"=>nil,
17
- "category_code"=>"order",
18
- "category_type"=>"logical",
19
- "description"=>
20
- "Funding instrument BA2EmblHC08bmwiwwNrbI0Rj is not associated with order customer CU2L981m9AtPY8pjpGpjnjnf or marketplace owner customer CU1mlBGw9Cybp1cbj3Lltvcp Your request id is OHMa013033cdbc911e38d4506429171ffad.",
21
- "extras"=>{},
22
- "request_id"=>"OHMa013033cdbc911e38d4506429171ffad",
23
- "status"=>"Conflict",
24
- "status_code"=>409}]}
15
+ #<Balanced::Credit:0x007fcde122fec8
16
+ @attributes=
17
+ {"amount"=>5000,
18
+ "appears_on_statement_as"=>"example.com",
19
+ "created_at"=>"2014-12-17T21:25:08.281495Z",
20
+ "currency"=>"USD",
21
+ "description"=>"Order #12341234",
22
+ "failure_reason"=>
23
+ "Marketplace TEST-MP60wtbv6zZrMK3XxOQ9r4xW has insufficient funds to cover a transfer of 5000.",
24
+ "failure_reason_code"=>"insufficient-funds",
25
+ "href"=>"/credits/CR7iAdaI3eSWUiwQ5Z6sozE9",
26
+ "id"=>"CR7iAdaI3eSWUiwQ5Z6sozE9",
27
+ "links"=>
28
+ {"customer"=>"CU68iUpvvUwpRpuuBL3u9Slq",
29
+ "destination"=>"BA6FZjm2W2mK0DIQibA1sjHv",
30
+ "order"=>"OR6c6n11zKSFfjE6kGNKtsE8"},
31
+ "meta"=>{},
32
+ "status"=>"failed",
33
+ "transaction_number"=>"CRF9L-4Z2-W9RN",
34
+ "updated_at"=>"2014-12-17T21:25:08.310906Z"},
35
+ @hyperlinks=
36
+ {"customer"=>
37
+ #<Proc:0x007fcde126bb30/lib/balanced/resources/resource.rb:56 (lambda)>,
38
+ "destination"=>
39
+ #<Proc:0x007fcde1269510/lib/balanced/resources/resource.rb:56 (lambda)>,
40
+ "events"=>
41
+ #<Proc:0x007fcde1272d40/lib/balanced/utils.rb:6 (lambda)>,
42
+ "order"=>
43
+ #<Proc:0x007fcde1271238/lib/balanced/resources/resource.rb:56 (lambda)>,
44
+ "reversals"=>
45
+ #<Proc:0x007fcde122ace8/lib/balanced/utils.rb:6 (lambda)>}>
25
46
 
26
47
  % endif
@@ -3,39 +3,39 @@ Balanced::Credit.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
- credit = Balanced::Credit.fetch('/credits/CR4OhD4V9LuxGe5kXaNpUULD')
8
+ credit = Balanced::Credit.fetch('/credits/CR7k9iyKSImqoPcvZyPNAcbm')
9
9
  % elif mode == 'response':
10
- #<Balanced::Credit:0x007fa7d415c650
10
+ #<Balanced::Credit:0x007fcde12109b0
11
11
  @attributes=
12
12
  {"amount"=>5000,
13
13
  "appears_on_statement_as"=>"example.com",
14
- "created_at"=>"2014-05-15T00:41:13.829371Z",
14
+ "created_at"=>"2014-12-17T21:25:09.678154Z",
15
15
  "currency"=>"USD",
16
16
  "description"=>nil,
17
17
  "failure_reason"=>nil,
18
18
  "failure_reason_code"=>nil,
19
- "href"=>"/credits/CR4OhD4V9LuxGe5kXaNpUULD",
20
- "id"=>"CR4OhD4V9LuxGe5kXaNpUULD",
19
+ "href"=>"/credits/CR7k9iyKSImqoPcvZyPNAcbm",
20
+ "id"=>"CR7k9iyKSImqoPcvZyPNAcbm",
21
21
  "links"=>
22
- {"customer"=>"CU2L981m9AtPY8pjpGpjnjnf",
23
- "destination"=>"BA2RqFlRIm0xqCNnHJNLYWMd",
22
+ {"customer"=>"CU68iUpvvUwpRpuuBL3u9Slq",
23
+ "destination"=>"BA6FZjm2W2mK0DIQibA1sjHv",
24
24
  "order"=>nil},
25
25
  "meta"=>{},
26
- "status"=>"succeeded",
27
- "transaction_number"=>"CR666-433-9281",
28
- "updated_at"=>"2014-05-15T00:41:14.822162Z"},
26
+ "status"=>"pending",
27
+ "transaction_number"=>"CRRWI-1PN-WA3D",
28
+ "updated_at"=>"2014-12-17T21:25:10.040086Z"},
29
29
  @hyperlinks=
30
30
  {"customer"=>
31
- #<Proc:0x007fa7d4156688/lib/balanced/resources/resource.rb:60 (lambda)>,
31
+ #<Proc:0x007fcde120ae20/lib/balanced/resources/resource.rb:56 (lambda)>,
32
32
  "destination"=>
33
- #<Proc:0x007fa7d41541a8/lib/balanced/resources/resource.rb:60 (lambda)>,
33
+ #<Proc:0x007fcde1209480/lib/balanced/resources/resource.rb:56 (lambda)>,
34
34
  "events"=>
35
- #<Proc:0x007fa7d414e230/lib/balanced/utils.rb:6 (lambda)>,
35
+ #<Proc:0x007fcde12035a8/lib/balanced/utils.rb:6 (lambda)>,
36
36
  "order"=>
37
- #<Proc:0x007fa7d414d830/lib/balanced/utils.rb:6 (lambda)>,
37
+ #<Proc:0x007fcde1202bd0/lib/balanced/utils.rb:6 (lambda)>,
38
38
  "reversals"=>
39
- #<Proc:0x007fa7d4147778/lib/balanced/utils.rb:6 (lambda)>}>
39
+ #<Proc:0x007fcde1200c90/lib/balanced/utils.rb:6 (lambda)>}>
40
40
 
41
41
  % endif
@@ -3,9 +3,9 @@ Balanced::Credit.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
- credit = Balanced::Credit.fetch('/credits/CR4OhD4V9LuxGe5kXaNpUULD')
8
+ credit = Balanced::Credit.fetch('/credits/CR7k9iyKSImqoPcvZyPNAcbm')
9
9
  credit.description = 'New description for credit'
10
10
  credit.meta = {
11
11
  'anykey' => 'valuegoeshere',
@@ -14,35 +14,35 @@ credit.meta = {
14
14
  credit.save
15
15
 
16
16
  % elif mode == 'response':
17
- #<Balanced::Credit:0x007fa7d4127568
17
+ #<Balanced::Credit:0x007fcde11e9298
18
18
  @attributes=
19
19
  {"amount"=>5000,
20
20
  "appears_on_statement_as"=>"example.com",
21
- "created_at"=>"2014-05-15T00:41:13.829371Z",
21
+ "created_at"=>"2014-12-17T21:25:09.678154Z",
22
22
  "currency"=>"USD",
23
23
  "description"=>"New description for credit",
24
24
  "failure_reason"=>nil,
25
25
  "failure_reason_code"=>nil,
26
- "href"=>"/credits/CR4OhD4V9LuxGe5kXaNpUULD",
27
- "id"=>"CR4OhD4V9LuxGe5kXaNpUULD",
26
+ "href"=>"/credits/CR7k9iyKSImqoPcvZyPNAcbm",
27
+ "id"=>"CR7k9iyKSImqoPcvZyPNAcbm",
28
28
  "links"=>
29
- {"customer"=>"CU2L981m9AtPY8pjpGpjnjnf",
30
- "destination"=>"BA2RqFlRIm0xqCNnHJNLYWMd",
29
+ {"customer"=>"CU68iUpvvUwpRpuuBL3u9Slq",
30
+ "destination"=>"BA6FZjm2W2mK0DIQibA1sjHv",
31
31
  "order"=>nil},
32
32
  "meta"=>{"anykey"=>"valuegoeshere", "facebook.id"=>"1234567890"},
33
- "status"=>"succeeded",
34
- "transaction_number"=>"CR666-433-9281",
35
- "updated_at"=>"2014-05-15T00:41:21.980193Z"},
33
+ "status"=>"pending",
34
+ "transaction_number"=>"CRRWI-1PN-WA3D",
35
+ "updated_at"=>"2014-12-17T21:25:14.629393Z"},
36
36
  @hyperlinks=
37
37
  {"customer"=>
38
- #<Proc:0x007fa7d4125588/lib/balanced/resources/resource.rb:60 (lambda)>,
38
+ #<Proc:0x007fcde11e3780/lib/balanced/resources/resource.rb:56 (lambda)>,
39
39
  "destination"=>
40
- #<Proc:0x007fa7d411f818/lib/balanced/resources/resource.rb:60 (lambda)>,
40
+ #<Proc:0x007fcde11e1db8/lib/balanced/resources/resource.rb:56 (lambda)>,
41
41
  "events"=>
42
- #<Proc:0x007fa7d411c848/lib/balanced/utils.rb:6 (lambda)>,
42
+ #<Proc:0x007fcde125be60/lib/balanced/utils.rb:6 (lambda)>,
43
43
  "order"=>
44
- #<Proc:0x007fa7d41177f8/lib/balanced/utils.rb:6 (lambda)>,
44
+ #<Proc:0x007fcde125b410/lib/balanced/utils.rb:6 (lambda)>,
45
45
  "reversals"=>
46
- #<Proc:0x007fa7d4115318/lib/balanced/utils.rb:6 (lambda)>}>
46
+ #<Proc:0x007fcde1259598/lib/balanced/utils.rb:6 (lambda)>}>
47
47
 
48
48
  % endif
@@ -3,7 +3,7 @@ Balanced::Customer.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
  customer = Balanced::Customer.new(
9
9
  :address => {
@@ -16,7 +16,7 @@ customer = Balanced::Customer.new(
16
16
  customer.save
17
17
 
18
18
  % elif mode == 'response':
19
- #<Balanced::Customer:0x007fa7d40c7488
19
+ #<Balanced::Customer:0x007fcde18bf590
20
20
  @attributes=
21
21
  {"address"=>
22
22
  {"city"=>nil,
@@ -26,46 +26,48 @@ customer.save
26
26
  "postal_code"=>"48120",
27
27
  "state"=>nil},
28
28
  "business_name"=>nil,
29
- "created_at"=>"2014-05-15T00:41:30.318855Z",
29
+ "created_at"=>"2014-12-17T21:25:22.336415Z",
30
30
  "dob_month"=>7,
31
31
  "dob_year"=>1963,
32
32
  "ein"=>nil,
33
33
  "email"=>nil,
34
- "href"=>"/customers/CU56PvhKAwSiV6LahZCcBMJ7",
35
- "id"=>"CU56PvhKAwSiV6LahZCcBMJ7",
34
+ "href"=>"/customers/CU7yoUz1HuDE7t7p9GcVNYbz",
35
+ "id"=>"CU7yoUz1HuDE7t7p9GcVNYbz",
36
36
  "links"=>{"destination"=>nil, "source"=>nil},
37
37
  "merchant_status"=>"underwritten",
38
38
  "meta"=>{},
39
39
  "name"=>"Henry Ford",
40
40
  "phone"=>nil,
41
41
  "ssn_last4"=>nil,
42
- "updated_at"=>"2014-05-15T00:41:34.844176Z"},
42
+ "updated_at"=>"2014-12-17T21:25:22.548971Z"},
43
43
  @hyperlinks=
44
- {"bank_accounts"=>
45
- #<Proc:0x007fa7d40bd230/lib/balanced/utils.rb:6 (lambda)>,
44
+ {"accounts"=>
45
+ #<Proc:0x007fcde18bd470/lib/balanced/utils.rb:6 (lambda)>,
46
+ "bank_accounts"=>
47
+ #<Proc:0x007fcde18b7548/lib/balanced/utils.rb:6 (lambda)>,
46
48
  "card_holds"=>
47
- #<Proc:0x007fa7d40b5788/lib/balanced/utils.rb:6 (lambda)>,
49
+ #<Proc:0x007fcde18b5608/lib/balanced/utils.rb:6 (lambda)>,
48
50
  "cards"=>
49
- #<Proc:0x007fa7d40af860/lib/balanced/utils.rb:6 (lambda)>,
51
+ #<Proc:0x007fcde18af690/lib/balanced/utils.rb:6 (lambda)>,
50
52
  "credits"=>
51
- #<Proc:0x007fa7d40ad9e8/lib/balanced/utils.rb:6 (lambda)>,
53
+ #<Proc:0x007fcde18ad660/lib/balanced/utils.rb:6 (lambda)>,
52
54
  "debits"=>
53
- #<Proc:0x007fa7d409f758/lib/balanced/utils.rb:6 (lambda)>,
55
+ #<Proc:0x007fcde18a7440/lib/balanced/utils.rb:6 (lambda)>,
54
56
  "destination"=>
55
- #<Proc:0x007fa7d409ecb8/lib/balanced/utils.rb:6 (lambda)>,
57
+ #<Proc:0x007fcde18a6a40/lib/balanced/utils.rb:6 (lambda)>,
56
58
  "disputes"=>
57
- #<Proc:0x007fa7d409ca08/lib/balanced/utils.rb:6 (lambda)>,
59
+ #<Proc:0x007fcde18a4948/lib/balanced/utils.rb:6 (lambda)>,
58
60
  "external_accounts"=>
59
- #<Proc:0x007fa7d4096950/lib/balanced/utils.rb:6 (lambda)>,
61
+ #<Proc:0x007fcde189e318/lib/balanced/utils.rb:6 (lambda)>,
60
62
  "orders"=>
61
- #<Proc:0x007fa7d40947e0/lib/balanced/utils.rb:6 (lambda)>,
63
+ #<Proc:0x007fcde189c108/lib/balanced/utils.rb:6 (lambda)>,
62
64
  "refunds"=>
63
- #<Proc:0x007fa7d408e750/lib/balanced/utils.rb:6 (lambda)>,
65
+ #<Proc:0x007fcde1895d80/lib/balanced/utils.rb:6 (lambda)>,
64
66
  "reversals"=>
65
- #<Proc:0x007fa7d408c4f0/lib/balanced/utils.rb:6 (lambda)>,
67
+ #<Proc:0x007fcde188fde0/lib/balanced/utils.rb:6 (lambda)>,
66
68
  "source"=>
67
- #<Proc:0x007fa7d4087a90/lib/balanced/utils.rb:6 (lambda)>,
69
+ #<Proc:0x007fcde188ee68/lib/balanced/utils.rb:6 (lambda)>,
68
70
  "transactions"=>
69
- #<Proc:0x007fa7d4085bf0/lib/balanced/utils.rb:6 (lambda)>}>
71
+ #<Proc:0x007fcde188ce38/lib/balanced/utils.rb:6 (lambda)>}>
70
72
 
71
73
  % endif