balanced 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/Gemfile +1 -0
  4. data/balanced.gemspec +1 -1
  5. data/lib/balanced/client.rb +1 -2
  6. data/lib/balanced/error.rb +3 -3
  7. data/lib/balanced/resources/card.rb +15 -1
  8. data/lib/balanced/version.rb +1 -1
  9. data/scenarios/api_key_create/ruby.mako +6 -6
  10. data/scenarios/api_key_delete/ruby.mako +2 -2
  11. data/scenarios/api_key_list/ruby.mako +10 -10
  12. data/scenarios/api_key_show/ruby.mako +6 -6
  13. data/scenarios/bank_account_associate_to_customer/ruby.mako +14 -14
  14. data/scenarios/bank_account_create/ruby.mako +11 -11
  15. data/scenarios/bank_account_credit/ruby.mako +15 -15
  16. data/scenarios/bank_account_debit/ruby.mako +15 -15
  17. data/scenarios/bank_account_delete/ruby.mako +2 -2
  18. data/scenarios/bank_account_list/ruby.mako +22 -22
  19. data/scenarios/bank_account_show/ruby.mako +12 -12
  20. data/scenarios/bank_account_update/ruby.mako +12 -12
  21. data/scenarios/bank_account_verification_create/definition.rb +1 -1
  22. data/scenarios/bank_account_verification_create/ruby.mako +10 -10
  23. data/scenarios/bank_account_verification_show/definition.rb +1 -1
  24. data/scenarios/bank_account_verification_show/request.rb +1 -1
  25. data/scenarios/bank_account_verification_show/ruby.mako +10 -10
  26. data/scenarios/bank_account_verification_update/definition.rb +1 -1
  27. data/scenarios/bank_account_verification_update/request.rb +1 -1
  28. data/scenarios/bank_account_verification_update/ruby.mako +10 -10
  29. data/scenarios/callback_create/ruby.mako +4 -4
  30. data/scenarios/callback_delete/ruby.mako +2 -2
  31. data/scenarios/callback_list/ruby.mako +4 -4
  32. data/scenarios/callback_show/ruby.mako +5 -5
  33. data/scenarios/card_associate_to_customer/ruby.mako +21 -12
  34. data/scenarios/card_create/ruby.mako +18 -9
  35. data/scenarios/card_create_creditable/definition.rb +1 -0
  36. data/scenarios/card_create_creditable/request.rb +4 -0
  37. data/scenarios/card_create_creditable/ruby.mako +62 -0
  38. data/scenarios/card_create_dispute/ruby.mako +18 -9
  39. data/scenarios/card_credit/definition.rb +1 -0
  40. data/scenarios/card_credit/request.rb +5 -0
  41. data/scenarios/card_credit/ruby.mako +43 -0
  42. data/scenarios/card_debit/ruby.mako +16 -16
  43. data/scenarios/card_debit_dispute/ruby.mako +15 -15
  44. data/scenarios/card_delete/ruby.mako +2 -2
  45. data/scenarios/card_hold_capture/ruby.mako +16 -16
  46. data/scenarios/card_hold_create/ruby.mako +14 -14
  47. data/scenarios/card_hold_list/ruby.mako +25 -25
  48. data/scenarios/card_hold_show/ruby.mako +14 -14
  49. data/scenarios/card_hold_update/ruby.mako +14 -14
  50. data/scenarios/card_hold_void/ruby.mako +15 -15
  51. data/scenarios/card_list/ruby.mako +36 -18
  52. data/scenarios/card_show/ruby.mako +19 -10
  53. data/scenarios/card_update/ruby.mako +19 -10
  54. data/scenarios/credit_list/ruby.mako +14 -14
  55. data/scenarios/credit_list_bank_account/ruby.mako +2 -2
  56. data/scenarios/credit_order/definition.rb +1 -0
  57. data/scenarios/credit_order/request.rb +7 -0
  58. data/scenarios/credit_order/ruby.mako +26 -0
  59. data/scenarios/credit_show/ruby.mako +15 -15
  60. data/scenarios/credit_update/ruby.mako +15 -15
  61. data/scenarios/customer_create/ruby.mako +20 -18
  62. data/scenarios/customer_delete/ruby.mako +1 -1
  63. data/scenarios/customer_list/ruby.mako +39 -35
  64. data/scenarios/customer_show/ruby.mako +21 -19
  65. data/scenarios/customer_update/ruby.mako +21 -19
  66. data/scenarios/debit_dispute_show/ruby.mako +12 -12
  67. data/scenarios/debit_list/ruby.mako +34 -34
  68. data/scenarios/debit_order/definition.rb +1 -0
  69. data/scenarios/debit_order/request.rb +7 -0
  70. data/scenarios/debit_order/ruby.mako +49 -0
  71. data/scenarios/debit_show/ruby.mako +16 -16
  72. data/scenarios/debit_update/ruby.mako +16 -16
  73. data/scenarios/dispute_list/ruby.mako +11 -11
  74. data/scenarios/dispute_show/ruby.mako +12 -12
  75. data/scenarios/event_list/ruby.mako +56 -55
  76. data/scenarios/event_show/ruby.mako +41 -35
  77. data/scenarios/order_create/ruby.mako +14 -14
  78. data/scenarios/order_list/ruby.mako +45 -13
  79. data/scenarios/order_show/ruby.mako +14 -14
  80. data/scenarios/order_update/ruby.mako +14 -14
  81. data/scenarios/refund_create/ruby.mako +13 -13
  82. data/scenarios/refund_list/ruby.mako +12 -12
  83. data/scenarios/refund_show/ruby.mako +13 -13
  84. data/scenarios/refund_update/ruby.mako +13 -13
  85. data/scenarios/render_mako.rb +1 -1
  86. data/scenarios/reversal_create/ruby.mako +12 -12
  87. data/scenarios/reversal_list/ruby.mako +11 -11
  88. data/scenarios/reversal_show/ruby.mako +12 -12
  89. data/scenarios/reversal_update/ruby.mako +12 -12
  90. data/spec/balanced/resources/card_spec.rb +73 -11
  91. data/spec/balanced/resources/credit_spec.rb +155 -26
  92. data/spec/balanced/response/balanced_exception_middleware_spec.rb +1 -2
  93. data/spec/spec_helper.rb +3 -1
  94. metadata +22 -4
@@ -3,11 +3,11 @@ Balanced::Customer.fetch
3
3
 
4
4
  % elif mode == 'request':
5
5
  require 'balanced'
6
- Balanced.configure('ak-test-22IOkhevjZlmRP2do6CZixkkDshTiOjTV')
6
+ Balanced.configure('ak-test-2q80HU8DISm2atgm0iRKRVIePzDb34qYp')
7
7
 
8
- customer = Balanced::Customer.fetch('/customers/CU4GAx8tZTDNIgAmwfV35e53')
8
+ customer = Balanced::Customer.fetch('/customers/CU4ZKTtaAaR7Rc5M8EP2gLlP')
9
9
  % elif mode == 'response':
10
- #<Balanced::Customer:0x007fa93e9f5c60
10
+ #<Balanced::Customer:0x007fa7d1c78d70
11
11
  @attributes=
12
12
  {"address"=>
13
13
  {"city"=>nil,
@@ -17,44 +17,46 @@ customer = Balanced::Customer.fetch('/customers/CU4GAx8tZTDNIgAmwfV35e53')
17
17
  "postal_code"=>"48120",
18
18
  "state"=>nil},
19
19
  "business_name"=>nil,
20
- "created_at"=>"2014-04-25T20:10:09.606769Z",
20
+ "created_at"=>"2014-05-15T00:41:24.028958Z",
21
21
  "dob_month"=>7,
22
22
  "dob_year"=>1963,
23
23
  "ein"=>nil,
24
24
  "email"=>nil,
25
- "href"=>"/customers/CU4GAx8tZTDNIgAmwfV35e53",
26
- "id"=>"CU4GAx8tZTDNIgAmwfV35e53",
25
+ "href"=>"/customers/CU4ZKTtaAaR7Rc5M8EP2gLlP",
26
+ "id"=>"CU4ZKTtaAaR7Rc5M8EP2gLlP",
27
27
  "links"=>{"destination"=>nil, "source"=>nil},
28
28
  "merchant_status"=>"underwritten",
29
29
  "meta"=>{},
30
30
  "name"=>"Henry Ford",
31
31
  "phone"=>nil,
32
32
  "ssn_last4"=>nil,
33
- "updated_at"=>"2014-04-25T20:10:09.810570Z"},
33
+ "updated_at"=>"2014-05-15T00:41:24.914750Z"},
34
34
  @hyperlinks=
35
35
  {"bank_accounts"=>
36
- #<Proc:0x007fa93ea1fb50/lib/balanced/utils.rb:6 (lambda)>,
36
+ #<Proc:0x007fa7d1c6aa40/lib/balanced/utils.rb:6 (lambda)>,
37
37
  "card_holds"=>
38
- #<Proc:0x007fa93ea1db48/lib/balanced/utils.rb:6 (lambda)>,
38
+ #<Proc:0x007fa7d1c63718/lib/balanced/utils.rb:6 (lambda)>,
39
39
  "cards"=>
40
- #<Proc:0x007fa93eb2ff40/lib/balanced/utils.rb:6 (lambda)>,
40
+ #<Proc:0x007fa7d1c53868/lib/balanced/utils.rb:6 (lambda)>,
41
41
  "credits"=>
42
- #<Proc:0x007fa93eb2e000/lib/balanced/utils.rb:6 (lambda)>,
42
+ #<Proc:0x007fa7d1c4ac68/lib/balanced/utils.rb:6 (lambda)>,
43
43
  "debits"=>
44
- #<Proc:0x007fa93eb2c070/lib/balanced/utils.rb:6 (lambda)>,
44
+ #<Proc:0x007fa7d1c33748/lib/balanced/utils.rb:6 (lambda)>,
45
45
  "destination"=>
46
- #<Proc:0x007fa93eb3f760/lib/balanced/utils.rb:6 (lambda)>,
46
+ #<Proc:0x007fa7d1c318f8/lib/balanced/utils.rb:6 (lambda)>,
47
+ "disputes"=>
48
+ #<Proc:0x007fa7d1c21bb0/lib/balanced/utils.rb:6 (lambda)>,
47
49
  "external_accounts"=>
48
- #<Proc:0x007fa93eb3d938/lib/balanced/utils.rb:6 (lambda)>,
50
+ #<Proc:0x007fa7d1c13880/lib/balanced/utils.rb:6 (lambda)>,
49
51
  "orders"=>
50
- #<Proc:0x007fa93eb5fa88/lib/balanced/utils.rb:6 (lambda)>,
52
+ #<Proc:0x007fa7d1bfad80/lib/balanced/utils.rb:6 (lambda)>,
51
53
  "refunds"=>
52
- #<Proc:0x007fa93eb5dc10/lib/balanced/utils.rb:6 (lambda)>,
54
+ #<Proc:0x007fa7d1c01db0/lib/balanced/utils.rb:6 (lambda)>,
53
55
  "reversals"=>
54
- #<Proc:0x007fa93eb67d50/lib/balanced/utils.rb:6 (lambda)>,
56
+ #<Proc:0x007fa7d1bf03a8/lib/balanced/utils.rb:6 (lambda)>,
55
57
  "source"=>
56
- #<Proc:0x007fa93eb673a0/lib/balanced/utils.rb:6 (lambda)>,
58
+ #<Proc:0x007fa7d1be6b00/lib/balanced/utils.rb:6 (lambda)>,
57
59
  "transactions"=>
58
- #<Proc:0x007fa93eb65550/lib/balanced/utils.rb:6 (lambda)>}>
60
+ #<Proc:0x007fa7d1bdacd8/lib/balanced/utils.rb:6 (lambda)>}>
59
61
 
60
62
  % endif
@@ -3,9 +3,9 @@ Balanced::Customer.save
3
3
 
4
4
  % elif mode == 'request':
5
5
  require 'balanced'
6
- Balanced.configure('ak-test-22IOkhevjZlmRP2do6CZixkkDshTiOjTV')
6
+ Balanced.configure('ak-test-2q80HU8DISm2atgm0iRKRVIePzDb34qYp')
7
7
 
8
- customer = Balanced::Customer.fetch('/customers/CU4GAx8tZTDNIgAmwfV35e53')
8
+ customer = Balanced::Customer.fetch('/customers/CU4ZKTtaAaR7Rc5M8EP2gLlP')
9
9
  customer.email = 'email@newdomain.com'
10
10
  customer.meta = {
11
11
  'shipping-preference' => 'ground'
@@ -13,7 +13,7 @@ customer.meta = {
13
13
  customer.save
14
14
 
15
15
  % elif mode == 'response':
16
- #<Balanced::Customer:0x007fa93eb95868
16
+ #<Balanced::Customer:0x007fa7d1b29fc8
17
17
  @attributes=
18
18
  {"address"=>
19
19
  {"city"=>nil,
@@ -23,44 +23,46 @@ customer.save
23
23
  "postal_code"=>"48120",
24
24
  "state"=>nil},
25
25
  "business_name"=>nil,
26
- "created_at"=>"2014-04-25T20:10:09.606769Z",
26
+ "created_at"=>"2014-05-15T00:41:24.028958Z",
27
27
  "dob_month"=>7,
28
28
  "dob_year"=>1963,
29
29
  "ein"=>nil,
30
30
  "email"=>"email@newdomain.com",
31
- "href"=>"/customers/CU4GAx8tZTDNIgAmwfV35e53",
32
- "id"=>"CU4GAx8tZTDNIgAmwfV35e53",
31
+ "href"=>"/customers/CU4ZKTtaAaR7Rc5M8EP2gLlP",
32
+ "id"=>"CU4ZKTtaAaR7Rc5M8EP2gLlP",
33
33
  "links"=>{"destination"=>nil, "source"=>nil},
34
34
  "merchant_status"=>"underwritten",
35
35
  "meta"=>{"shipping-preference"=>"ground"},
36
36
  "name"=>"Henry Ford",
37
37
  "phone"=>nil,
38
38
  "ssn_last4"=>nil,
39
- "updated_at"=>"2014-04-25T20:10:13.306289Z"},
39
+ "updated_at"=>"2014-05-15T00:41:28.733238Z"},
40
40
  @hyperlinks=
41
41
  {"bank_accounts"=>
42
- #<Proc:0x007fa93eb9f7a0/lib/balanced/utils.rb:6 (lambda)>,
42
+ #<Proc:0x007fa7d1b1a410/lib/balanced/utils.rb:6 (lambda)>,
43
43
  "card_holds"=>
44
- #<Proc:0x007fa93eb9d900/lib/balanced/utils.rb:6 (lambda)>,
44
+ #<Proc:0x007fa7d1b09a20/lib/balanced/utils.rb:6 (lambda)>,
45
45
  "cards"=>
46
- #<Proc:0x007fa93eba7a40/lib/balanced/utils.rb:6 (lambda)>,
46
+ #<Proc:0x007fa7d1af31d0/lib/balanced/utils.rb:6 (lambda)>,
47
47
  "credits"=>
48
- #<Proc:0x007fa93eba5bc8/lib/balanced/utils.rb:6 (lambda)>,
48
+ #<Proc:0x007fa7d1ae87f8/lib/balanced/utils.rb:6 (lambda)>,
49
49
  "debits"=>
50
- #<Proc:0x007fa93ebb7d00/lib/balanced/utils.rb:6 (lambda)>,
50
+ #<Proc:0x007fa7d1adba80/lib/balanced/utils.rb:6 (lambda)>,
51
51
  "destination"=>
52
- #<Proc:0x007fa93ebb7350/lib/balanced/utils.rb:6 (lambda)>,
52
+ #<Proc:0x007fa7d1ada4a0/lib/balanced/utils.rb:6 (lambda)>,
53
+ "disputes"=>
54
+ #<Proc:0x007fa7d1ad1c88/lib/balanced/utils.rb:6 (lambda)>,
53
55
  "external_accounts"=>
54
- #<Proc:0x007fa93ebb5528/lib/balanced/utils.rb:6 (lambda)>,
56
+ #<Proc:0x007fa7d1ac0190/lib/balanced/utils.rb:6 (lambda)>,
55
57
  "orders"=>
56
- #<Proc:0x007fa93ebbf668/lib/balanced/utils.rb:6 (lambda)>,
58
+ #<Proc:0x007fa7d1ab1028/lib/balanced/utils.rb:6 (lambda)>,
57
59
  "refunds"=>
58
- #<Proc:0x007fa93ebbd7f0/lib/balanced/utils.rb:6 (lambda)>,
60
+ #<Proc:0x007fa7d1aa2870/lib/balanced/utils.rb:6 (lambda)>,
59
61
  "reversals"=>
60
- #<Proc:0x007fa93ebc7930/lib/balanced/utils.rb:6 (lambda)>,
62
+ #<Proc:0x007fa7d1a93848/lib/balanced/utils.rb:6 (lambda)>,
61
63
  "source"=>
62
- #<Proc:0x007fa93ebc6f80/lib/balanced/utils.rb:6 (lambda)>,
64
+ #<Proc:0x007fa7d1a8ba80/lib/balanced/utils.rb:6 (lambda)>,
63
65
  "transactions"=>
64
- #<Proc:0x007fa93ebc5130/lib/balanced/utils.rb:6 (lambda)>}>
66
+ #<Proc:0x007fa7d1a812d8/lib/balanced/utils.rb:6 (lambda)>}>
65
67
 
66
68
  % endif
@@ -2,30 +2,30 @@
2
2
  Balanced::Debit.dispute
3
3
  % elif mode == 'request':
4
4
  require 'balanced'
5
- Balanced.configure('ak-test-22IOkhevjZlmRP2do6CZixkkDshTiOjTV')
5
+ Balanced.configure('ak-test-2q80HU8DISm2atgm0iRKRVIePzDb34qYp')
6
6
 
7
- debit = Balanced::Debit.fetch('/debits/WD4YCKAyFrQBFYuFCUCRynOx')
7
+ debit = Balanced::Debit.fetch('/debits/WD6mairBakAx5t8ETjMYFu7T')
8
8
  dispute = debit.dispute
9
9
 
10
10
  % elif mode == 'response':
11
- #<Balanced::Dispute:0x007fa93ebf4d68
11
+ #<Balanced::Dispute:0x007fa7d1a071e0
12
12
  @attributes=
13
13
  {"amount"=>5000,
14
- "created_at"=>"2014-04-25T20:18:33.022136Z",
14
+ "created_at"=>"2014-05-15T00:42:52.610582Z",
15
15
  "currency"=>"USD",
16
- "href"=>"/disputes/DT61IA2iRqyYBLqUCJNt5XNV",
17
- "id"=>"DT61IA2iRqyYBLqUCJNt5XNV",
18
- "initiated_at"=>"2014-04-25T20:10:26.554057Z",
19
- "links"=>{"transaction"=>"WD4YCKAyFrQBFYuFCUCRynOx"},
16
+ "href"=>"/disputes/DT6BoisMcacTIu3QWX32JVtl",
17
+ "id"=>"DT6BoisMcacTIu3QWX32JVtl",
18
+ "initiated_at"=>"2014-05-15T00:42:41.973330Z",
19
+ "links"=>{"transaction"=>"WD6mairBakAx5t8ETjMYFu7T"},
20
20
  "meta"=>{},
21
21
  "reason"=>"fraud",
22
- "respond_by"=>"2014-05-25T20:10:26.554061Z",
22
+ "respond_by"=>"2014-06-14T00:42:41.973334Z",
23
23
  "status"=>"pending",
24
- "updated_at"=>"2014-04-25T20:18:33.022139Z"},
24
+ "updated_at"=>"2014-05-15T00:42:52.610592Z"},
25
25
  @hyperlinks=
26
26
  {"events"=>
27
- #<Proc:0x007fa93ebfecc8/lib/balanced/utils.rb:6 (lambda)>,
27
+ #<Proc:0x007fa7d19fe0b8/lib/balanced/utils.rb:6 (lambda)>,
28
28
  "transaction"=>
29
- #<Proc:0x007fa93ebfd328/lib/balanced/resources/resource.rb:60 (lambda)>}>
29
+ #<Proc:0x007fa7d19f6ae8/lib/balanced/resources/resource.rb:60 (lambda)>}>
30
30
 
31
31
  % endif
@@ -3,75 +3,75 @@ Balanced::Debit.all
3
3
 
4
4
  % elif mode == 'request':
5
5
  require 'balanced'
6
- Balanced.configure('ak-test-22IOkhevjZlmRP2do6CZixkkDshTiOjTV')
6
+ Balanced.configure('ak-test-2q80HU8DISm2atgm0iRKRVIePzDb34qYp')
7
7
 
8
8
  debits = Balanced::Debit.all
9
9
  % elif mode == 'response':
10
- [#<Balanced::Debit:0x007fa93e9f7420
10
+ [#<Balanced::Debit:0x007fa7d1968d60
11
11
  @attributes=
12
12
  {"amount"=>5000,
13
- "appears_on_statement_as"=>"BAL*Statement text",
14
- "created_at"=>"2014-04-25T20:09:59.895549Z",
13
+ "appears_on_statement_as"=>"BAL*example.com",
14
+ "created_at"=>"2014-05-15T00:41:37.159166Z",
15
15
  "currency"=>"USD",
16
- "description"=>"Some descriptive text for the debit in the dashboard",
16
+ "description"=>"Order #12341234",
17
17
  "failure_reason"=>nil,
18
18
  "failure_reason_code"=>nil,
19
- "href"=>"/debits/WD4vEUJj36IpPHTnLKMYzHgh",
20
- "id"=>"WD4vEUJj36IpPHTnLKMYzHgh",
19
+ "href"=>"/debits/WD5ewolo9HEVQkv8dcyx87gd",
20
+ "id"=>"WD5ewolo9HEVQkv8dcyx87gd",
21
21
  "links"=>
22
- {"customer"=>"CU3VYCUIfwngJsidJWdGw2W5",
22
+ {"customer"=>"CU2L981m9AtPY8pjpGpjnjnf",
23
23
  "dispute"=>nil,
24
- "order"=>nil,
25
- "source"=>"CC4tvKLTKXcBJAgkGvPEW58N"},
24
+ "order"=>"OR4R53c8wdUiVEUiegSHpwaN",
25
+ "source"=>"CC4xXVOyMBDdk7FtzG9HwtBv"},
26
26
  "meta"=>{},
27
27
  "status"=>"succeeded",
28
- "transaction_number"=>"W296-328-8320",
29
- "updated_at"=>"2014-04-25T20:10:00.865462Z"},
28
+ "transaction_number"=>"W941-130-0831",
29
+ "updated_at"=>"2014-05-15T00:41:40.522871Z"},
30
30
  @hyperlinks=
31
31
  {"customer"=>
32
- #<Proc:0x007fa93e9f58a0/lib/balanced/resources/resource.rb:60 (lambda)>,
32
+ #<Proc:0x007fa7d1959f90/lib/balanced/resources/resource.rb:60 (lambda)>,
33
33
  "dispute"=>
34
- #<Proc:0x007fa93e9f4f18/lib/balanced/utils.rb:6 (lambda)>,
34
+ #<Proc:0x007fa7d1958ff0/lib/balanced/utils.rb:6 (lambda)>,
35
35
  "events"=>
36
- #<Proc:0x007fa93ec1ed98/lib/balanced/utils.rb:6 (lambda)>,
36
+ #<Proc:0x007fa7d1950648/lib/balanced/utils.rb:6 (lambda)>,
37
37
  "order"=>
38
- #<Proc:0x007fa93ec1e398/lib/balanced/utils.rb:6 (lambda)>,
38
+ #<Proc:0x007fa7d1940a68/lib/balanced/resources/resource.rb:60 (lambda)>,
39
39
  "refunds"=>
40
- #<Proc:0x007fa93ec17bb0/lib/balanced/utils.rb:6 (lambda)>,
40
+ #<Proc:0x007fa7d1930708/lib/balanced/utils.rb:6 (lambda)>,
41
41
  "source"=>
42
- #<Proc:0x007fa93ec16080/lib/balanced/resources/resource.rb:60 (lambda)>}>,
43
- #<Balanced::Debit:0x007fa93ec15fb8
42
+ #<Proc:0x007fa7d19235f8/lib/balanced/resources/resource.rb:60 (lambda)>}>,
43
+ #<Balanced::Debit:0x007fa7d1923558
44
44
  @attributes=
45
45
  {"amount"=>5000,
46
- "appears_on_statement_as"=>"BAL*ShowsUpOnStmt",
47
- "created_at"=>"2014-04-25T20:09:46.854710Z",
46
+ "appears_on_statement_as"=>"BAL*Statement text",
47
+ "created_at"=>"2014-05-15T00:41:07.283881Z",
48
48
  "currency"=>"USD",
49
49
  "description"=>"Some descriptive text for the debit in the dashboard",
50
50
  "failure_reason"=>nil,
51
51
  "failure_reason_code"=>nil,
52
- "href"=>"/debits/WD4gZDOJ1DB443FYcbwNN5EV",
53
- "id"=>"WD4gZDOJ1DB443FYcbwNN5EV",
52
+ "href"=>"/debits/WD4GV5z2pEIRZ9cBSuyuykQx",
53
+ "id"=>"WD4GV5z2pEIRZ9cBSuyuykQx",
54
54
  "links"=>
55
- {"customer"=>"CU3z3rwGWGazDwwyLy0rNqfj",
55
+ {"customer"=>"CU2L981m9AtPY8pjpGpjnjnf",
56
56
  "dispute"=>nil,
57
57
  "order"=>nil,
58
- "source"=>"CC4auQXiAWMBxJcEUIMYeZFj"},
59
- "meta"=>{"holding.for"=>"user1", "meaningful.key"=>"some.value"},
58
+ "source"=>"CC4xXVOyMBDdk7FtzG9HwtBv"},
59
+ "meta"=>{},
60
60
  "status"=>"succeeded",
61
- "transaction_number"=>"W815-967-5010",
62
- "updated_at"=>"2014-04-25T20:09:47.351487Z"},
61
+ "transaction_number"=>"W235-372-7348",
62
+ "updated_at"=>"2014-05-15T00:41:11.755100Z"},
63
63
  @hyperlinks=
64
64
  {"customer"=>
65
- #<Proc:0x007fa93ec14348/lib/balanced/resources/resource.rb:60 (lambda)>,
65
+ #<Proc:0x007fa7d191b010/lib/balanced/resources/resource.rb:60 (lambda)>,
66
66
  "dispute"=>
67
- #<Proc:0x007fa93ec0f708/lib/balanced/utils.rb:6 (lambda)>,
67
+ #<Proc:0x007fa7d1919b70/lib/balanced/utils.rb:6 (lambda)>,
68
68
  "events"=>
69
- #<Proc:0x007fa93ec077b0/lib/balanced/utils.rb:6 (lambda)>,
69
+ #<Proc:0x007fa7d1910e58/lib/balanced/utils.rb:6 (lambda)>,
70
70
  "order"=>
71
- #<Proc:0x007fa93ec06dd8/lib/balanced/utils.rb:6 (lambda)>,
71
+ #<Proc:0x007fa7d18ed6b0/lib/balanced/utils.rb:6 (lambda)>,
72
72
  "refunds"=>
73
- #<Proc:0x007fa93ec04f10/lib/balanced/utils.rb:6 (lambda)>,
73
+ #<Proc:0x007fa7d18d5fb0/lib/balanced/utils.rb:6 (lambda)>,
74
74
  "source"=>
75
- #<Proc:0x007fa93ebdf558/lib/balanced/resources/resource.rb:60 (lambda)>}>]
75
+ #<Proc:0x007fa7d18cddd8/lib/balanced/resources/resource.rb:60 (lambda)>}>]
76
76
 
77
77
  % 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
+ card = Balanced::Card.fetch('<%= request['card_href'] %>')
4
+ order.debit_from(
5
+ :source => card,
6
+ :amount => <%= request['payload']['amount'] %>
7
+ )
@@ -0,0 +1,49 @@
1
+ % if mode == 'definition':
2
+ Balanced::Order.debit_from
3
+ % elif mode == 'request':
4
+ require 'balanced'
5
+ Balanced.configure('ak-test-2q80HU8DISm2atgm0iRKRVIePzDb34qYp')
6
+
7
+ order = Balanced::Order.fetch('/orders/OR4R53c8wdUiVEUiegSHpwaN')
8
+ card = Balanced::Card.fetch('/cards/CC4xXVOyMBDdk7FtzG9HwtBv')
9
+ order.debit_from(
10
+ :source => card,
11
+ :amount => 5000
12
+ )
13
+
14
+ % elif mode == 'response':
15
+ #<Balanced::Debit:0x007fa7d40fd6a0
16
+ @attributes=
17
+ {"amount"=>5000,
18
+ "appears_on_statement_as"=>"BAL*example.com",
19
+ "created_at"=>"2014-05-15T00:41:37.159166Z",
20
+ "currency"=>"USD",
21
+ "description"=>"Order #12341234",
22
+ "failure_reason"=>nil,
23
+ "failure_reason_code"=>nil,
24
+ "href"=>"/debits/WD5ewolo9HEVQkv8dcyx87gd",
25
+ "id"=>"WD5ewolo9HEVQkv8dcyx87gd",
26
+ "links"=>
27
+ {"customer"=>"CU2L981m9AtPY8pjpGpjnjnf",
28
+ "dispute"=>nil,
29
+ "order"=>"OR4R53c8wdUiVEUiegSHpwaN",
30
+ "source"=>"CC4xXVOyMBDdk7FtzG9HwtBv"},
31
+ "meta"=>{},
32
+ "status"=>"succeeded",
33
+ "transaction_number"=>"W941-130-0831",
34
+ "updated_at"=>"2014-05-15T00:41:40.522871Z"},
35
+ @hyperlinks=
36
+ {"customer"=>
37
+ #<Proc:0x007fa7d4187b48/lib/balanced/resources/resource.rb:60 (lambda)>,
38
+ "dispute"=>
39
+ #<Proc:0x007fa7d41871c0/lib/balanced/utils.rb:6 (lambda)>,
40
+ "events"=>
41
+ #<Proc:0x007fa7d4185370/lib/balanced/utils.rb:6 (lambda)>,
42
+ "order"=>
43
+ #<Proc:0x007fa7d418f988/lib/balanced/resources/resource.rb:60 (lambda)>,
44
+ "refunds"=>
45
+ #<Proc:0x007fa7d418db38/lib/balanced/utils.rb:6 (lambda)>,
46
+ "source"=>
47
+ #<Proc:0x007fa7d418c1c0/lib/balanced/resources/resource.rb:60 (lambda)>}>
48
+
49
+ % endif
@@ -3,43 +3,43 @@ Balanced::Debit.fetch
3
3
 
4
4
  % elif mode == 'request':
5
5
  require 'balanced'
6
- Balanced.configure('ak-test-22IOkhevjZlmRP2do6CZixkkDshTiOjTV')
6
+ Balanced.configure('ak-test-2q80HU8DISm2atgm0iRKRVIePzDb34qYp')
7
7
 
8
- debit = Balanced::Debit.fetch('/debits/WD4vEUJj36IpPHTnLKMYzHgh')
8
+ debit = Balanced::Debit.fetch('/debits/WD4GV5z2pEIRZ9cBSuyuykQx')
9
9
 
10
10
  % elif mode == 'response':
11
- #<Balanced::Debit:0x007fa93eb35288
11
+ #<Balanced::Debit:0x007fa7d4196bc0
12
12
  @attributes=
13
13
  {"amount"=>5000,
14
14
  "appears_on_statement_as"=>"BAL*Statement text",
15
- "created_at"=>"2014-04-25T20:09:59.895549Z",
15
+ "created_at"=>"2014-05-15T00:41:07.283881Z",
16
16
  "currency"=>"USD",
17
17
  "description"=>"Some descriptive text for the debit in the dashboard",
18
18
  "failure_reason"=>nil,
19
19
  "failure_reason_code"=>nil,
20
- "href"=>"/debits/WD4vEUJj36IpPHTnLKMYzHgh",
21
- "id"=>"WD4vEUJj36IpPHTnLKMYzHgh",
20
+ "href"=>"/debits/WD4GV5z2pEIRZ9cBSuyuykQx",
21
+ "id"=>"WD4GV5z2pEIRZ9cBSuyuykQx",
22
22
  "links"=>
23
- {"customer"=>"CU3VYCUIfwngJsidJWdGw2W5",
23
+ {"customer"=>"CU2L981m9AtPY8pjpGpjnjnf",
24
24
  "dispute"=>nil,
25
25
  "order"=>nil,
26
- "source"=>"CC4tvKLTKXcBJAgkGvPEW58N"},
26
+ "source"=>"CC4xXVOyMBDdk7FtzG9HwtBv"},
27
27
  "meta"=>{},
28
28
  "status"=>"succeeded",
29
- "transaction_number"=>"W296-328-8320",
30
- "updated_at"=>"2014-04-25T20:10:00.865462Z"},
29
+ "transaction_number"=>"W235-372-7348",
30
+ "updated_at"=>"2014-05-15T00:41:11.755100Z"},
31
31
  @hyperlinks=
32
32
  {"customer"=>
33
- #<Proc:0x007fa93eb276b0/lib/balanced/resources/resource.rb:60 (lambda)>,
33
+ #<Proc:0x007fa7d4195068/lib/balanced/resources/resource.rb:60 (lambda)>,
34
34
  "dispute"=>
35
- #<Proc:0x007fa93eb26d28/lib/balanced/utils.rb:6 (lambda)>,
35
+ #<Proc:0x007fa7d4194460/lib/balanced/utils.rb:6 (lambda)>,
36
36
  "events"=>
37
- #<Proc:0x007fa93eb24e88/lib/balanced/utils.rb:6 (lambda)>,
37
+ #<Proc:0x007fa7d40a65d0/lib/balanced/utils.rb:6 (lambda)>,
38
38
  "order"=>
39
- #<Proc:0x007fa93eb244b0/lib/balanced/utils.rb:6 (lambda)>,
39
+ #<Proc:0x007fa7d40a5bd0/lib/balanced/utils.rb:6 (lambda)>,
40
40
  "refunds"=>
41
- #<Proc:0x007fa93eb1c0a8/lib/balanced/utils.rb:6 (lambda)>,
41
+ #<Proc:0x007fa7d4043d40/lib/balanced/utils.rb:6 (lambda)>,
42
42
  "source"=>
43
- #<Proc:0x007fa93eb07ab8/lib/balanced/resources/resource.rb:60 (lambda)>}>
43
+ #<Proc:0x007fa7d40423c8/lib/balanced/resources/resource.rb:60 (lambda)>}>
44
44
 
45
45
  % endif
@@ -3,9 +3,9 @@ Balanced::Debit.save
3
3
 
4
4
  % elif mode == 'request':
5
5
  require 'balanced'
6
- Balanced.configure('ak-test-22IOkhevjZlmRP2do6CZixkkDshTiOjTV')
6
+ Balanced.configure('ak-test-2q80HU8DISm2atgm0iRKRVIePzDb34qYp')
7
7
 
8
- debit = Balanced::Debit.fetch('/debits/WD4vEUJj36IpPHTnLKMYzHgh')
8
+ debit = Balanced::Debit.fetch('/debits/WD4GV5z2pEIRZ9cBSuyuykQx')
9
9
  debit.description = 'New description for debit'
10
10
  debit.meta = {
11
11
  'anykey' => 'valuegoeshere',
@@ -14,38 +14,38 @@ debit.meta = {
14
14
  debit.save
15
15
 
16
16
  % elif mode == 'response':
17
- #<Balanced::Debit:0x007fa93eade398
17
+ #<Balanced::Debit:0x007fa7d3452d38
18
18
  @attributes=
19
19
  {"amount"=>5000,
20
20
  "appears_on_statement_as"=>"BAL*Statement text",
21
- "created_at"=>"2014-04-25T20:09:59.895549Z",
21
+ "created_at"=>"2014-05-15T00:41:07.283881Z",
22
22
  "currency"=>"USD",
23
23
  "description"=>"New description for debit",
24
24
  "failure_reason"=>nil,
25
25
  "failure_reason_code"=>nil,
26
- "href"=>"/debits/WD4vEUJj36IpPHTnLKMYzHgh",
27
- "id"=>"WD4vEUJj36IpPHTnLKMYzHgh",
26
+ "href"=>"/debits/WD4GV5z2pEIRZ9cBSuyuykQx",
27
+ "id"=>"WD4GV5z2pEIRZ9cBSuyuykQx",
28
28
  "links"=>
29
- {"customer"=>"CU3VYCUIfwngJsidJWdGw2W5",
29
+ {"customer"=>"CU2L981m9AtPY8pjpGpjnjnf",
30
30
  "dispute"=>nil,
31
31
  "order"=>nil,
32
- "source"=>"CC4tvKLTKXcBJAgkGvPEW58N"},
32
+ "source"=>"CC4xXVOyMBDdk7FtzG9HwtBv"},
33
33
  "meta"=>{"anykey"=>"valuegoeshere", "facebook.id"=>"1234567890"},
34
34
  "status"=>"succeeded",
35
- "transaction_number"=>"W296-328-8320",
36
- "updated_at"=>"2014-04-25T20:10:19.169392Z"},
35
+ "transaction_number"=>"W235-372-7348",
36
+ "updated_at"=>"2014-05-15T00:41:44.238176Z"},
37
37
  @hyperlinks=
38
38
  {"customer"=>
39
- #<Proc:0x007fa93eadc7c8/lib/balanced/resources/resource.rb:60 (lambda)>,
39
+ #<Proc:0x007fa7d3451078/lib/balanced/resources/resource.rb:60 (lambda)>,
40
40
  "dispute"=>
41
- #<Proc:0x007fa93ead7db8/lib/balanced/utils.rb:6 (lambda)>,
41
+ #<Proc:0x007fa7d3450560/lib/balanced/utils.rb:6 (lambda)>,
42
42
  "events"=>
43
- #<Proc:0x007fa93ead5ea0/lib/balanced/utils.rb:6 (lambda)>,
43
+ #<Proc:0x007fa7d310a5b8/lib/balanced/utils.rb:6 (lambda)>,
44
44
  "order"=>
45
- #<Proc:0x007fa93ead54a0/lib/balanced/utils.rb:6 (lambda)>,
45
+ #<Proc:0x007fa7d3109b68/lib/balanced/utils.rb:6 (lambda)>,
46
46
  "refunds"=>
47
- #<Proc:0x007fa93eacf438/lib/balanced/utils.rb:6 (lambda)>,
47
+ #<Proc:0x007fa7d3103c40/lib/balanced/utils.rb:6 (lambda)>,
48
48
  "source"=>
49
- #<Proc:0x007fa93eacda48/lib/balanced/resources/resource.rb:60 (lambda)>}>
49
+ #<Proc:0x007fa7d3102070/lib/balanced/resources/resource.rb:60 (lambda)>}>
50
50
 
51
51
  % endif