bill_forward 1.2014.296 → 1.2015.183

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +29 -27
  3. data/.idea/compiler.xml +23 -23
  4. data/.idea/copyright/profiles_settings.xml +2 -2
  5. data/.idea/encodings.xml +5 -5
  6. data/.idea/inspectionProfiles/Project_Default.xml +10 -10
  7. data/.idea/inspectionProfiles/profiles_settings.xml +6 -6
  8. data/.idea/misc.xml +23 -23
  9. data/.idea/modules.xml +9 -9
  10. data/.idea/scopes/scope_settings.xml +4 -4
  11. data/.idea/vcs.xml +7 -7
  12. data/.rspec +1 -1
  13. data/Gemfile +13 -9
  14. data/LICENSE.md +22 -22
  15. data/README.md +285 -227
  16. data/Rakefile +73 -73
  17. data/bill_forward.gemspec +28 -29
  18. data/bill_forward.iml +28 -28
  19. data/lib/bill_forward/billing_entity.rb +295 -262
  20. data/lib/bill_forward/client.rb +350 -355
  21. data/lib/bill_forward/entities/account.rb +18 -18
  22. data/lib/bill_forward/entities/amendments/issue_invoice_amendment.rb +10 -0
  23. data/lib/bill_forward/entities/amendments/product_rate_plan_migration_amendment.rb +18 -0
  24. data/lib/bill_forward/entities/api_configuration.rb +12 -0
  25. data/lib/bill_forward/entities/invoice.rb +29 -3
  26. data/lib/bill_forward/entities/invoice_parts/taxation_link.rb +5 -5
  27. data/lib/bill_forward/entities/organisation.rb +36 -36
  28. data/lib/bill_forward/entities/payment_method.rb +4 -4
  29. data/lib/bill_forward/entities/payment_method_subscription_link.rb +5 -5
  30. data/lib/bill_forward/entities/pricing_component.rb +21 -21
  31. data/lib/bill_forward/entities/pricing_component_tier.rb +5 -5
  32. data/lib/bill_forward/entities/pricing_component_value.rb +5 -5
  33. data/lib/bill_forward/entities/pricing_component_value_migration_amendment_mapping.rb +31 -0
  34. data/lib/bill_forward/entities/product.rb +5 -5
  35. data/lib/bill_forward/entities/product_rate_plan.rb +43 -19
  36. data/lib/bill_forward/entities/profile.rb +14 -14
  37. data/lib/bill_forward/entities/refund.rb +5 -0
  38. data/lib/bill_forward/entities/role.rb +3 -3
  39. data/lib/bill_forward/entities/stripe_ach_token.rb +9 -0
  40. data/lib/bill_forward/entities/subscription.rb +83 -53
  41. data/lib/bill_forward/entities/subscription_charge.rb +14 -0
  42. data/lib/bill_forward/insertable_entity.rb +21 -31
  43. data/lib/bill_forward/mutable_entity.rb +26 -46
  44. data/lib/bill_forward/resource_path.rb +10 -10
  45. data/lib/bill_forward/type_check.rb +20 -20
  46. data/lib/bill_forward/version.rb +4 -4
  47. data/lib/bill_forward.rb +17 -17
  48. data/scratch/Gemfile +9 -0
  49. data/scratch/scratch.example.rb +8 -0
  50. data/spec/component/account_spec.rb +199 -199
  51. data/spec/component/billing_entity_spec.rb +152 -152
  52. data/spec/functional/account_spec.rb +24 -24
  53. data/spec/functional/bad_citizen/account_spec.rb +102 -102
  54. data/spec/functional/bad_citizen/credit_note_spec.rb +14 -13
  55. data/spec/functional/bad_citizen/payment_method_spec.rb +1 -1
  56. data/spec/functional/bad_citizen/product_rate_plan_migration_amendment_spec.rb +379 -0
  57. data/spec/functional/bad_citizen/product_rate_plan_spec.rb +103 -47
  58. data/spec/functional/bad_citizen/product_spec.rb +16 -9
  59. data/spec/functional/bad_citizen/situational/authorize_net_token_spec.rb +4 -0
  60. data/spec/functional/bad_citizen/situational/malordered_entity_spec.rb +1 -1
  61. data/spec/functional/bad_citizen/situational/payment_method_spec.rb +6 -1
  62. data/spec/functional/bad_citizen/situational/subscription_chargeable_spec.rb +96 -65
  63. data/spec/functional/bad_citizen/subscription_spec.rb +99 -60
  64. data/spec/functional/bad_citizen/subscription_with_credit_spec.rb +121 -91
  65. data/spec/functional/bad_citizen/unit_of_measure_spec.rb +14 -7
  66. data/spec/functional/client_spec.rb +23 -23
  67. data/spec/functional/organisation_spec.rb +27 -27
  68. data/spec/setup_test_constants.rb +72 -72
  69. data/spec/spec_helper.rb +10 -10
  70. data/spec/syntax/account_spec.rb +23 -23
  71. data/spec/syntax/billing_entity_spec.rb +92 -92
  72. data/tools/RSpec hardcoded.sublime-build +16 -0
  73. data/tools/RSpec.sublime-build +13 -0
  74. data/tools/Ruby legacy.sublime-build +7 -0
  75. data/tools/local_bundle_build.sh +8 -0
  76. data/tools/local_bundle_install.sh +9 -0
  77. metadata +30 -85
@@ -1,153 +1,153 @@
1
- require File.join(File.expand_path(File.dirname(__FILE__)), "..", "spec_helper")
2
-
3
- describe BillForward::BillingEntity do
4
- before :all do
5
- @client = BillForwardTest::TEST_CLIENT
6
- BillForward::Client.default_client = @client
7
- end
8
- before :each do
9
- # skip OAuth request
10
- allow_any_instance_of(BillForward::Client).to receive(:get_token).and_return('fake token')
11
- end
12
- context 'upon getting entity' do
13
- before :each do
14
- response = double
15
- allow(response).to receive(:to_str).and_return(canned_entity)
16
- allow(RestClient::Request).to receive(:execute).and_return(response)
17
-
18
- @entity = BillForward::Account.get_by_id 'anything'
19
- end
20
- subject (:entity) { @entity }
21
- context 'using dot syntax' do
22
- it "can get property" do
23
- expect(entity.id).to eq('74DA7D63-EAEB-431B-9745-76F9109FD842')
24
- end
25
- it "can change property" do
26
- newid = 'whatever'
27
- entity.id = newid
28
- expect(entity.id).to eq(newid)
29
- end
30
- it "can add property" do
31
- value = 'whatever'
32
- entity.fun = value
33
- expect(entity.fun).to eq(value)
34
- end
35
- describe 'nested array of entities' do
36
- context 'once unserialized' do
37
- subject :roles do
38
- roles = entity.roles
39
- end
40
- subject :role do
41
- roles.first
42
- end
43
- it 'is an array' do
44
- expect(roles.class).to eq(Array)
45
- end
46
- describe 'some element' do
47
- it 'is an entity' do
48
- expect(role.class).to eq(BillForward::Role)
49
- end
50
- it 'has expected properties' do
51
- expect(role.role).to eq('user')
52
- end
53
- it 'has mutable properties' do
54
- expect(role.role).to eq('user')
55
- new_role = 'abuser'
56
- role.role = new_role
57
- expect(role.role).to eq(new_role)
58
- end
59
- end
60
- end
61
- end
62
- describe 'nested entity' do
63
- context 'once unserialized' do
64
- subject :profile do
65
- profile = entity.profile
66
- end
67
- it 'is an entity' do
68
- expect(profile.class).to eq(BillForward::Profile)
69
- end
70
- it 'has expected properties' do
71
- expect(profile.firstName).to eq('Test')
72
- end
73
- it 'has mutable properties' do
74
- expect(profile.firstName).to eq('Test')
75
- new_name = 'Best'
76
- profile.firstName = new_name
77
- expect(profile.firstName).to eq(new_name)
78
- end
79
- end
80
- end
81
- end
82
- context 'using array access syntax' do
83
- it "can get property" do
84
- expect(entity['@type']).to eq('account')
85
- end
86
- it "can change property" do
87
- newid = 'notever'
88
- entity['id'] = newid
89
- expect(entity['id']).to eq(newid)
90
- end
91
- end
92
- end
93
- end
94
-
95
- def canned_entity
96
- '{
97
- "executionTime": 1070093,
98
- "results": [
99
- {
100
- "successfulSubscriptions": 0,
101
- "@type": "account",
102
- "roles": [
103
- {
104
- "id": "B4E623C2-2CE0-11E3-894A-FA163E717A7F",
105
- "accountID": "74DA7D63-EAEB-431B-9745-76F9109FD842",
106
- "role": "user",
107
- "created": "2014-09-04T17:43:44Z",
108
- "changedBy": "7872F2F4-ED96-4038-BC82-39F7DDFECE60"
109
- }
110
- ],
111
- "profile": {
112
- "firstName": "Test",
113
- "addresses": [
114
- {
115
- "landline": "02000000000",
116
- "addressLine3": "address line 3",
117
- "addressLine2": "address line 2",
118
- "addressLine1": "address line 1",
119
- "country": "United Kingdom",
120
- "deleted": false,
121
- "city": "London",
122
- "profileID": "1B07A310-8B0F-4CFA-B2CF-48D206DC79C3",
123
- "id": "34B5A980-A133-4B5F-9045-F1A41F20F2D6",
124
- "primaryAddress": true,
125
- "province": "London",
126
- "created": "2014-09-04T17:43:44Z",
127
- "postcode": "SW1 1AS",
128
- "changedBy": "7872F2F4-ED96-4038-BC82-39F7DDFECE60",
129
- "organizationID": "F60667D7-583A-4A01-B4DC-F74CC45ACAE3"
130
- }
131
- ],
132
- "id": "1B07A310-8B0F-4CFA-B2CF-48D206DC79C3",
133
- "updated": "2014-09-04T17:43:44Z",
134
- "email": "always@testing.is.moe",
135
- "created": "2014-09-04T17:43:44Z",
136
- "changedBy": "7872F2F4-ED96-4038-BC82-39F7DDFECE60",
137
- "organizationID": "F60667D7-583A-4A01-B4DC-F74CC45ACAE3",
138
- "accountID": "74DA7D63-EAEB-431B-9745-76F9109FD842"
139
- },
140
- "deleted": false,
141
- "crmID": null,
142
- "id": "74DA7D63-EAEB-431B-9745-76F9109FD842",
143
- "updated": "2014-09-04T17:43:43Z",
144
- "created": "2014-09-04T17:43:43Z",
145
- "paymentMethods": [
146
-
147
- ],
148
- "changedBy": "7872F2F4-ED96-4038-BC82-39F7DDFECE60",
149
- "organizationID": "F60667D7-583A-4A01-B4DC-F74CC45ACAE3"
150
- }
151
- ]
152
- }'
1
+ require File.join(File.expand_path(File.dirname(__FILE__)), "..", "spec_helper")
2
+
3
+ describe BillForward::BillingEntity do
4
+ before :all do
5
+ @client = BillForwardTest::TEST_CLIENT
6
+ BillForward::Client.default_client = @client
7
+ end
8
+ before :each do
9
+ # skip OAuth request
10
+ allow_any_instance_of(BillForward::Client).to receive(:get_token).and_return('fake token')
11
+ end
12
+ context 'upon getting entity' do
13
+ before :each do
14
+ response = double
15
+ allow(response).to receive(:to_str).and_return(canned_entity)
16
+ allow(RestClient::Request).to receive(:execute).and_return(response)
17
+
18
+ @entity = BillForward::Account.get_by_id 'anything'
19
+ end
20
+ subject (:entity) { @entity }
21
+ context 'using dot syntax' do
22
+ it "can get property" do
23
+ expect(entity.id).to eq('74DA7D63-EAEB-431B-9745-76F9109FD842')
24
+ end
25
+ it "can change property" do
26
+ newid = 'whatever'
27
+ entity.id = newid
28
+ expect(entity.id).to eq(newid)
29
+ end
30
+ it "can add property" do
31
+ value = 'whatever'
32
+ entity.fun = value
33
+ expect(entity.fun).to eq(value)
34
+ end
35
+ describe 'nested array of entities' do
36
+ context 'once unserialized' do
37
+ subject :roles do
38
+ roles = entity.roles
39
+ end
40
+ subject :role do
41
+ roles.first
42
+ end
43
+ it 'is an array' do
44
+ expect(roles.class).to eq(Array)
45
+ end
46
+ describe 'some element' do
47
+ it 'is an entity' do
48
+ expect(role.class).to eq(BillForward::Role)
49
+ end
50
+ it 'has expected properties' do
51
+ expect(role.role).to eq('user')
52
+ end
53
+ it 'has mutable properties' do
54
+ expect(role.role).to eq('user')
55
+ new_role = 'abuser'
56
+ role.role = new_role
57
+ expect(role.role).to eq(new_role)
58
+ end
59
+ end
60
+ end
61
+ end
62
+ describe 'nested entity' do
63
+ context 'once unserialized' do
64
+ subject :profile do
65
+ profile = entity.profile
66
+ end
67
+ it 'is an entity' do
68
+ expect(profile.class).to eq(BillForward::Profile)
69
+ end
70
+ it 'has expected properties' do
71
+ expect(profile.firstName).to eq('Test')
72
+ end
73
+ it 'has mutable properties' do
74
+ expect(profile.firstName).to eq('Test')
75
+ new_name = 'Best'
76
+ profile.firstName = new_name
77
+ expect(profile.firstName).to eq(new_name)
78
+ end
79
+ end
80
+ end
81
+ end
82
+ context 'using array access syntax' do
83
+ it "can get property" do
84
+ expect(entity['@type']).to eq('account')
85
+ end
86
+ it "can change property" do
87
+ newid = 'notever'
88
+ entity['id'] = newid
89
+ expect(entity['id']).to eq(newid)
90
+ end
91
+ end
92
+ end
93
+ end
94
+
95
+ def canned_entity
96
+ '{
97
+ "executionTime": 1070093,
98
+ "results": [
99
+ {
100
+ "successfulSubscriptions": 0,
101
+ "@type": "account",
102
+ "roles": [
103
+ {
104
+ "id": "B4E623C2-2CE0-11E3-894A-FA163E717A7F",
105
+ "accountID": "74DA7D63-EAEB-431B-9745-76F9109FD842",
106
+ "role": "user",
107
+ "created": "2014-09-04T17:43:44Z",
108
+ "changedBy": "7872F2F4-ED96-4038-BC82-39F7DDFECE60"
109
+ }
110
+ ],
111
+ "profile": {
112
+ "firstName": "Test",
113
+ "addresses": [
114
+ {
115
+ "landline": "02000000000",
116
+ "addressLine3": "address line 3",
117
+ "addressLine2": "address line 2",
118
+ "addressLine1": "address line 1",
119
+ "country": "United Kingdom",
120
+ "deleted": false,
121
+ "city": "London",
122
+ "profileID": "1B07A310-8B0F-4CFA-B2CF-48D206DC79C3",
123
+ "id": "34B5A980-A133-4B5F-9045-F1A41F20F2D6",
124
+ "primaryAddress": true,
125
+ "province": "London",
126
+ "created": "2014-09-04T17:43:44Z",
127
+ "postcode": "SW1 1AS",
128
+ "changedBy": "7872F2F4-ED96-4038-BC82-39F7DDFECE60",
129
+ "organizationID": "F60667D7-583A-4A01-B4DC-F74CC45ACAE3"
130
+ }
131
+ ],
132
+ "id": "1B07A310-8B0F-4CFA-B2CF-48D206DC79C3",
133
+ "updated": "2014-09-04T17:43:44Z",
134
+ "email": "always@testing.is.moe",
135
+ "created": "2014-09-04T17:43:44Z",
136
+ "changedBy": "7872F2F4-ED96-4038-BC82-39F7DDFECE60",
137
+ "organizationID": "F60667D7-583A-4A01-B4DC-F74CC45ACAE3",
138
+ "accountID": "74DA7D63-EAEB-431B-9745-76F9109FD842"
139
+ },
140
+ "deleted": false,
141
+ "crmID": null,
142
+ "id": "74DA7D63-EAEB-431B-9745-76F9109FD842",
143
+ "updated": "2014-09-04T17:43:43Z",
144
+ "created": "2014-09-04T17:43:43Z",
145
+ "paymentMethods": [
146
+
147
+ ],
148
+ "changedBy": "7872F2F4-ED96-4038-BC82-39F7DDFECE60",
149
+ "organizationID": "F60667D7-583A-4A01-B4DC-F74CC45ACAE3"
150
+ }
151
+ ]
152
+ }'
153
153
  end
@@ -1,25 +1,25 @@
1
- require File.join(File.expand_path(File.dirname(__FILE__)), "..", "spec_helper")
2
-
3
- describe BillForward::Account do
4
- before :all do
5
- @client = BillForwardTest::TEST_CLIENT
6
- BillForward::Client.default_client = @client
7
- end
8
- describe '::get_by_id' do
9
- context 'upon looking up non-existent ID' do
10
- it "should find empty results" do
11
- account_id = "nonexist"
12
-
13
- expect{BillForward::Account.get_by_id account_id}.to raise_error(IndexError)
14
- end
15
- end
16
- end
17
- describe '::get_all' do
18
- it "should find accounts" do
19
- accounts = BillForward::Account.get_all
20
- accounts_first = accounts.first
21
-
22
- expect(accounts_first['@type']).to eq(BillForward::Account.resource_path.entity_name)
23
- end
24
- end
1
+ require File.join(File.expand_path(File.dirname(__FILE__)), "..", "spec_helper")
2
+
3
+ describe BillForward::Account do
4
+ before :all do
5
+ @client = BillForwardTest::TEST_CLIENT
6
+ BillForward::Client.default_client = @client
7
+ end
8
+ describe '::get_by_id' do
9
+ context 'upon looking up non-existent ID' do
10
+ it "should find empty results" do
11
+ account_id = "nonexist"
12
+
13
+ expect{BillForward::Account.get_by_id account_id}.to raise_error(IndexError)
14
+ end
15
+ end
16
+ end
17
+ describe '::get_all' do
18
+ it "should find accounts" do
19
+ accounts = BillForward::Account.get_all
20
+ accounts_first = accounts.first
21
+
22
+ expect(accounts_first['@type']).to eq(BillForward::Account.resource_path.entity_name)
23
+ end
24
+ end
25
25
  end
@@ -1,103 +1,103 @@
1
- require File.join(File.expand_path(File.dirname(__FILE__)), "..", "..", "spec_helper")
2
- # we want unique numbers to test updates with
3
- require 'SecureRandom'
4
-
5
- describe BillForward::Account do
6
- before :all do
7
- @client = BillForwardTest::TEST_CLIENT
8
- BillForward::Client.default_client = @client
9
- end
10
- describe '::create' do
11
- context 'upon creating minimal account' do
12
- before :all do
13
- @created_account = BillForward::Account.create
14
- end
15
- subject (:account) { @created_account }
16
- it "can get property" do
17
- expect(account['@type']).to eq(BillForward::Account.resource_path.entity_name)
18
- end
19
- # it "can be retired" do
20
- # expect(account.deleted).to eq(false)
21
-
22
- # retired_account = account.delete
23
- # expect(retired_account.deleted).to eq(true)
24
- # end
25
- end
26
- context 'upon creating account with profile' do
27
- describe 'the created account' do
28
- before :all do
29
- @email = 'always@testing.is.moe'
30
- addresses = Array.new
31
- addresses.push(
32
- BillForward::Address.new({
33
- 'addressLine1' => 'address line 1',
34
- 'addressLine2' => 'address line 2',
35
- 'addressLine3' => 'address line 3',
36
- 'city' => 'London',
37
- 'province' => 'London',
38
- 'country' => 'United Kingdom',
39
- 'postcode' => 'SW1 1AS',
40
- 'landline' => '02000000000',
41
- 'primaryAddress' => true
42
- }))
43
- profile = BillForward::Profile.new({
44
- 'email' => @email,
45
- 'firstName' => 'Test',
46
- 'addresses' => addresses
47
- })
48
- account = BillForward::Account.new({
49
- 'profile' => profile
50
- })
51
- @created_account = BillForward::Account.create account
52
- end
53
- subject (:account) { @created_account }
54
- it "can get property" do
55
- expect(account['@type']).to eq(BillForward::Account.resource_path.entity_name)
56
- end
57
- it "has profile" do
58
- profile = account.profile
59
- expect(profile.email).to eq(@email)
60
- end
61
- context 'after creation' do
62
- before :all do
63
- @gotten_account = BillForward::Account.get_by_id @created_account.id
64
- end
65
- subject (:account) { @gotten_account }
66
- it "can be gotten" do
67
- expect(account['@type']).to eq(BillForward::Account.resource_path.entity_name)
68
- expect(account.id).to eq(@created_account.id)
69
- end
70
- it "can be updated" do
71
- expect(account.deleted).to eq(false)
72
- account.deleted = true
73
- expect(account.deleted).to eq(true)
74
- updated_account = account.save
75
-
76
- expect(updated_account.deleted).to eq(true)
77
- end
78
- describe "profile" do
79
- subject (:profile) { account.profile }
80
- it 'has expected properties' do
81
- expect(profile.email).to eq(@email)
82
- end
83
- it 'has updatable properties' do
84
- unique_value = SecureRandom.hex(10)
85
- profile.firstName = unique_value
86
- updated_profile = profile.save
87
-
88
- expect(updated_profile.firstName).to eq(unique_value)
89
- end
90
- it 'can update properties via cascade' do
91
- unique_value = SecureRandom.hex(10)
92
- profile.firstName = unique_value
93
- updated_account = account.save
94
- updated_profile = updated_account.profile
95
-
96
- expect(updated_profile.firstName).to eq(unique_value)
97
- end
98
- end
99
- end
100
- end
101
- end
102
- end
1
+ require File.join(File.expand_path(File.dirname(__FILE__)), "..", "..", "spec_helper")
2
+ # we want unique numbers to test updates with
3
+ require 'SecureRandom'
4
+
5
+ describe BillForward::Account do
6
+ before :all do
7
+ @client = BillForwardTest::TEST_CLIENT
8
+ BillForward::Client.default_client = @client
9
+ end
10
+ describe '::create' do
11
+ context 'upon creating minimal account' do
12
+ before :all do
13
+ @created_account = BillForward::Account.create
14
+ end
15
+ subject (:account) { @created_account }
16
+ it "can get property" do
17
+ expect(account['@type']).to eq(BillForward::Account.resource_path.entity_name)
18
+ end
19
+ # it "can be retired" do
20
+ # expect(account.deleted).to eq(false)
21
+
22
+ # retired_account = account.delete
23
+ # expect(retired_account.deleted).to eq(true)
24
+ # end
25
+ end
26
+ context 'upon creating account with profile' do
27
+ describe 'the created account' do
28
+ before :all do
29
+ @email = 'always@testing.is.moe'
30
+ addresses = Array.new
31
+ addresses.push(
32
+ BillForward::Address.new({
33
+ 'addressLine1' => 'address line 1',
34
+ 'addressLine2' => 'address line 2',
35
+ 'addressLine3' => 'address line 3',
36
+ 'city' => 'London',
37
+ 'province' => 'London',
38
+ 'country' => 'United Kingdom',
39
+ 'postcode' => 'SW1 1AS',
40
+ 'landline' => '02000000000',
41
+ 'primaryAddress' => true
42
+ }))
43
+ profile = BillForward::Profile.new({
44
+ 'email' => @email,
45
+ 'firstName' => 'Test',
46
+ 'addresses' => addresses
47
+ })
48
+ account = BillForward::Account.new({
49
+ 'profile' => profile
50
+ })
51
+ @created_account = BillForward::Account.create account
52
+ end
53
+ subject (:account) { @created_account }
54
+ it "can get property" do
55
+ expect(account['@type']).to eq(BillForward::Account.resource_path.entity_name)
56
+ end
57
+ it "has profile" do
58
+ profile = account.profile
59
+ expect(profile.email).to eq(@email)
60
+ end
61
+ context 'after creation' do
62
+ before :all do
63
+ @gotten_account = BillForward::Account.get_by_id @created_account.id
64
+ end
65
+ subject (:account) { @gotten_account }
66
+ it "can be gotten" do
67
+ expect(account['@type']).to eq(BillForward::Account.resource_path.entity_name)
68
+ expect(account.id).to eq(@created_account.id)
69
+ end
70
+ it "can be updated" do
71
+ expect(account.deleted).to eq(false)
72
+ account.deleted = true
73
+ expect(account.deleted).to eq(true)
74
+ updated_account = account.save
75
+
76
+ expect(updated_account.deleted).to eq(true)
77
+ end
78
+ describe "profile" do
79
+ subject (:profile) { account.profile }
80
+ it 'has expected properties' do
81
+ expect(profile.email).to eq(@email)
82
+ end
83
+ it 'has updatable properties' do
84
+ unique_value = SecureRandom.hex(10)
85
+ profile.firstName = unique_value
86
+ updated_profile = profile.save
87
+
88
+ expect(updated_profile.firstName).to eq(unique_value)
89
+ end
90
+ it 'can update properties via cascade' do
91
+ unique_value = SecureRandom.hex(10)
92
+ profile.firstName = unique_value
93
+ updated_account = account.save
94
+ updated_profile = updated_account.profile
95
+
96
+ expect(updated_profile.firstName).to eq(unique_value)
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
103
103
  end
@@ -11,24 +11,25 @@ describe BillForward::CreditNote do
11
11
  before :all do
12
12
  @created_account = BillForward::Account.create
13
13
 
14
- payment_method = BillForward::PaymentMethod.new({
15
- 'accountID' => @created_account.id,
16
- 'name' => 'Credit Notes',
17
- 'description' => 'Pay using credit',
18
- # engines will link this to an invoice once paid, for the sake of refunds
19
- 'linkID' => '',
20
- 'gateway' => 'credit_note',
21
- 'userEditable' => 0,
22
- 'priority' => 100,
23
- 'reusable' => 1
24
- })
25
- created_payment_method = BillForward::PaymentMethod::create(payment_method)
14
+ # account implicitly has these nowadays
15
+ # payment_method = BillForward::PaymentMethod.new({
16
+ # 'accountID' => @created_account.id,
17
+ # 'name' => 'Credit Notes',
18
+ # 'description' => 'Pay using credit',
19
+ # # engines will link this to an invoice once paid, for the sake of refunds
20
+ # 'linkID' => '',
21
+ # 'gateway' => 'credit_note',
22
+ # 'userEditable' => 0,
23
+ # 'priority' => 100,
24
+ # 'reusable' => 1
25
+ # })
26
+ # created_payment_method = BillForward::PaymentMethod::create(payment_method)
26
27
  end
27
28
  subject (:account) { @created_account }
28
29
  it 'issues credit' do
29
30
  credit_note = BillForward::CreditNote.new({
30
31
  "accountID" => account.id,
31
- "nominalValue" => 15,
32
+ "value" => 15,
32
33
  "currency" => "USD"
33
34
  })
34
35
  created_credit_note = BillForward::CreditNote.create(credit_note)
@@ -5,7 +5,7 @@ describe BillForward::PaymentMethod do
5
5
  @client = BillForwardTest::TEST_CLIENT
6
6
  BillForward::Client.default_client = @client
7
7
  end
8
- describe '::create' do
8
+ skip '::create' do
9
9
  context 'account exists' do
10
10
  context 'using credit' do
11
11
  before :all do