chargebee 2.6.2 → 2.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1483 -1473
- data/LICENSE +24 -24
- data/README.rdoc +41 -41
- data/Rakefile +150 -150
- data/chargebee.gemspec +2 -2
- data/lib/.DS_Store +0 -0
- data/lib/chargebee.rb +85 -85
- data/lib/chargebee/environment.rb +28 -28
- data/lib/chargebee/errors.rb +43 -43
- data/lib/chargebee/list_result.rb +28 -28
- data/lib/chargebee/models/addon.rb +45 -45
- data/lib/chargebee/models/address.rb +18 -18
- data/lib/chargebee/models/card.rb +32 -32
- data/lib/chargebee/models/comment.rb +25 -25
- data/lib/chargebee/models/contact.rb +10 -10
- data/lib/chargebee/models/coupon.rb +40 -40
- data/lib/chargebee/models/coupon_code.rb +25 -25
- data/lib/chargebee/models/coupon_set.rb +37 -37
- data/lib/chargebee/models/credit_note.rb +77 -77
- data/lib/chargebee/models/credit_note_estimate.rb +35 -35
- data/lib/chargebee/models/customer.rb +120 -120
- data/lib/chargebee/models/download.rb +9 -9
- data/lib/chargebee/models/estimate.rb +46 -46
- data/lib/chargebee/models/event.rb +45 -45
- data/lib/chargebee/models/export.rb +86 -82
- data/lib/chargebee/models/gift.rb +42 -42
- data/lib/chargebee/models/hosted_page.rb +77 -73
- data/lib/chargebee/models/invoice.rb +172 -172
- data/lib/chargebee/models/invoice_estimate.rb +35 -35
- data/lib/chargebee/models/model.rb +101 -101
- data/lib/chargebee/models/order.rb +76 -76
- data/lib/chargebee/models/payment_source.rb +71 -70
- data/lib/chargebee/models/plan.rb +59 -59
- data/lib/chargebee/models/portal_session.rb +30 -30
- data/lib/chargebee/models/promotional_credit.rb +30 -30
- data/lib/chargebee/models/quote.rb +72 -72
- data/lib/chargebee/models/resource_migration.rb +13 -13
- data/lib/chargebee/models/site_migration_detail.rb +14 -14
- data/lib/chargebee/models/subscription.rb +137 -137
- data/lib/chargebee/models/subscription_estimate.rb +13 -13
- data/lib/chargebee/models/third_party_payment_method.rb +9 -9
- data/lib/chargebee/models/time_machine.rb +46 -46
- data/lib/chargebee/models/transaction.rb +62 -58
- data/lib/chargebee/models/unbilled_charge.rb +31 -31
- data/lib/chargebee/models/virtual_bank_account.rb +26 -26
- data/lib/chargebee/request.rb +27 -27
- data/lib/chargebee/rest.rb +92 -90
- data/lib/chargebee/result.rb +240 -240
- data/lib/chargebee/util.rb +56 -56
- data/lib/ssl/ca-certs.crt +3385 -3385
- data/spec/chargebee/list_result_spec.rb +53 -53
- data/spec/chargebee_spec.rb +99 -99
- data/spec/errors_spec.rb +23 -23
- data/spec/sample_response.rb +73 -73
- data/spec/spec_helper.rb +24 -24
- metadata +2 -2
@@ -1,53 +1,53 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe ChargeBee::ListResult do
|
4
|
-
let(:response) do
|
5
|
-
{:list=>
|
6
|
-
[{:customer=>
|
7
|
-
{:id=>"d0cus3orh6gnjgha1i",
|
8
|
-
:first_name=>"Test Name1",
|
9
|
-
:last_name=>"Test last name 1",
|
10
|
-
:email=>"name1@gmail.com",
|
11
|
-
:auto_collection=>"on",
|
12
|
-
:created_at=>1346258514,
|
13
|
-
:object=>"customer",
|
14
|
-
:card_status=>"valid"},
|
15
|
-
:card=>
|
16
|
-
{:customer_id=>"d0cus3orh6gnjgha1i",
|
17
|
-
:status=>"valid",
|
18
|
-
:gateway=>"chargebee",
|
19
|
-
:first_name=>"Test Name1",
|
20
|
-
:last_name=>"Test last name 1",
|
21
|
-
:iin=>"32122",
|
22
|
-
:last4=>"1333",
|
23
|
-
:card_type=>"visa",
|
24
|
-
:expiry_month=>8,
|
25
|
-
:expiry_year=>2013,
|
26
|
-
:billing_addr1=>"Flat 11",
|
27
|
-
:billing_addr2=>"51 Strit",
|
28
|
-
:billing_city=>"Bristol",
|
29
|
-
:billing_state=>"Somerset",
|
30
|
-
:billing_zip=>"BS1 4HQ",
|
31
|
-
:object=>"card",
|
32
|
-
:masked_number=>"21323****4323"}},
|
33
|
-
{:customer=>
|
34
|
-
{:id=>"cwtid6smh67tq3z51l",
|
35
|
-
:first_name=>"Test Name 2",
|
36
|
-
:last_name=>"Test last name 2",
|
37
|
-
:email=>"name2@gmail.com",
|
38
|
-
:auto_collection=>"on",
|
39
|
-
:created_at=>1345724673,
|
40
|
-
:object=>"customer",
|
41
|
-
:card_status=>"no_card"}}],
|
42
|
-
:next_offset=>"[\"1345724673000\",\"1510\"]"}
|
43
|
-
end
|
44
|
-
|
45
|
-
before do
|
46
|
-
ChargeBee::Rest.stubs(:request).returns(response)
|
47
|
-
end
|
48
|
-
|
49
|
-
it "returns list object, with next offset attribute" do
|
50
|
-
list = ChargeBee::Request.send(:customer, "http://url.com", {:limit => 2})
|
51
|
-
list.next_offset.should =~ ["1345724673000", "1510"]
|
52
|
-
end
|
53
|
-
end
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe ChargeBee::ListResult do
|
4
|
+
let(:response) do
|
5
|
+
{:list=>
|
6
|
+
[{:customer=>
|
7
|
+
{:id=>"d0cus3orh6gnjgha1i",
|
8
|
+
:first_name=>"Test Name1",
|
9
|
+
:last_name=>"Test last name 1",
|
10
|
+
:email=>"name1@gmail.com",
|
11
|
+
:auto_collection=>"on",
|
12
|
+
:created_at=>1346258514,
|
13
|
+
:object=>"customer",
|
14
|
+
:card_status=>"valid"},
|
15
|
+
:card=>
|
16
|
+
{:customer_id=>"d0cus3orh6gnjgha1i",
|
17
|
+
:status=>"valid",
|
18
|
+
:gateway=>"chargebee",
|
19
|
+
:first_name=>"Test Name1",
|
20
|
+
:last_name=>"Test last name 1",
|
21
|
+
:iin=>"32122",
|
22
|
+
:last4=>"1333",
|
23
|
+
:card_type=>"visa",
|
24
|
+
:expiry_month=>8,
|
25
|
+
:expiry_year=>2013,
|
26
|
+
:billing_addr1=>"Flat 11",
|
27
|
+
:billing_addr2=>"51 Strit",
|
28
|
+
:billing_city=>"Bristol",
|
29
|
+
:billing_state=>"Somerset",
|
30
|
+
:billing_zip=>"BS1 4HQ",
|
31
|
+
:object=>"card",
|
32
|
+
:masked_number=>"21323****4323"}},
|
33
|
+
{:customer=>
|
34
|
+
{:id=>"cwtid6smh67tq3z51l",
|
35
|
+
:first_name=>"Test Name 2",
|
36
|
+
:last_name=>"Test last name 2",
|
37
|
+
:email=>"name2@gmail.com",
|
38
|
+
:auto_collection=>"on",
|
39
|
+
:created_at=>1345724673,
|
40
|
+
:object=>"customer",
|
41
|
+
:card_status=>"no_card"}}],
|
42
|
+
:next_offset=>"[\"1345724673000\",\"1510\"]"}
|
43
|
+
end
|
44
|
+
|
45
|
+
before do
|
46
|
+
ChargeBee::Rest.stubs(:request).returns(response)
|
47
|
+
end
|
48
|
+
|
49
|
+
it "returns list object, with next offset attribute" do
|
50
|
+
list = ChargeBee::Request.send(:customer, "http://url.com", {:limit => 2})
|
51
|
+
list.next_offset.should =~ ["1345724673000", "1510"]
|
52
|
+
end
|
53
|
+
end
|
data/spec/chargebee_spec.rb
CHANGED
@@ -1,99 +1,99 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'rest_client'
|
3
|
-
require 'sample_response'
|
4
|
-
|
5
|
-
describe "chargebee" do
|
6
|
-
|
7
|
-
before(:all) do
|
8
|
-
@request = RestClient::Request
|
9
|
-
end
|
10
|
-
|
11
|
-
it "serialize should convert the hash to acceptable format" do
|
12
|
-
before = {
|
13
|
-
:id => "sub_KyVq7DNSNM7CSD",
|
14
|
-
:plan_id => "free",
|
15
|
-
:addons => [{:id => "monitor", :quantity => 2}, {:id => "ssl"}],
|
16
|
-
:addon_ids => ["addon_one", "addon_two"],
|
17
|
-
:card => {
|
18
|
-
:first_name => "Rajaraman",
|
19
|
-
:last_name => "Santhanam",
|
20
|
-
:number => "4111111111111111",
|
21
|
-
:expiry_month => "1",
|
22
|
-
:expiry_year => "2024",
|
23
|
-
:cvv => "007"
|
24
|
-
}
|
25
|
-
}
|
26
|
-
after = {
|
27
|
-
"id"=>"sub_KyVq7DNSNM7CSD",
|
28
|
-
"plan_id"=>"free",
|
29
|
-
"addons[id][0]"=>"monitor",
|
30
|
-
"addons[quantity][0]"=>"2",
|
31
|
-
"addons[id][1]"=>"ssl",
|
32
|
-
"addon_ids[0]"=>"addon_one",
|
33
|
-
"addon_ids[1]"=>"addon_two",
|
34
|
-
"card[first_name]"=>"Rajaraman",
|
35
|
-
"card[last_name]"=>"Santhanam",
|
36
|
-
"card[number]"=>"4111111111111111",
|
37
|
-
"card[expiry_month]"=>"1",
|
38
|
-
"card[expiry_year]"=>"2024",
|
39
|
-
"card[cvv]"=>"007"}
|
40
|
-
ChargeBee::Util.serialize(before).should eq(after)
|
41
|
-
end
|
42
|
-
|
43
|
-
it "symbolize_keys should convert keys to symbols" do
|
44
|
-
before = {
|
45
|
-
'id' => 'sub_KyVq4P__dev__NTWxbJx1',
|
46
|
-
'plan_id' => 'basic',
|
47
|
-
'addons' => [{ 'id' => 'ssl' }, {'id' => 'sms', 'quantity' => '10'}]
|
48
|
-
}
|
49
|
-
after = {
|
50
|
-
:id => 'sub_KyVq4P__dev__NTWxbJx1',
|
51
|
-
:plan_id => 'basic',
|
52
|
-
:addons => [{ :id => 'ssl' }, {:id => 'sms', :quantity => '10'}],
|
53
|
-
}
|
54
|
-
ChargeBee::Util.symbolize_keys(before).should eq(after)
|
55
|
-
end
|
56
|
-
|
57
|
-
it "should properly convert the response json into proper object" do
|
58
|
-
@request.expects(:execute).once.returns(mock_response(simple_subscription))
|
59
|
-
result = ChargeBee::Subscription.retrieve("simple_subscription")
|
60
|
-
s = result.subscription
|
61
|
-
s.id.should eq("simple_subscription")
|
62
|
-
s.plan_id.should eq('basic')
|
63
|
-
c = result.customer
|
64
|
-
c.first_name.should eq('simple')
|
65
|
-
c.last_name.should eq('subscription')
|
66
|
-
end
|
67
|
-
|
68
|
-
it "should properly convert the nested response json into proper object with sub types" do
|
69
|
-
@request.expects(:execute).once.returns(mock_response(nested_subscription))
|
70
|
-
result = ChargeBee::Subscription.retrieve("nested_subscription")
|
71
|
-
s = result.subscription
|
72
|
-
s.id.should eq("nested_subscription")
|
73
|
-
a = s.addons
|
74
|
-
a.length.should eq(2)
|
75
|
-
a[0].id.should eq("monitor")
|
76
|
-
a[0].quantity.should eq("10")
|
77
|
-
a[1].id.should eq("ssl")
|
78
|
-
end
|
79
|
-
|
80
|
-
it "should properly convert the list response json into proper result object" do
|
81
|
-
@request.expects(:execute).once.returns(mock_response(list_subscriptions))
|
82
|
-
result = ChargeBee::Subscription.list({:limit => 2})
|
83
|
-
result.length.should eq(2)
|
84
|
-
result.each do |i|
|
85
|
-
i.subscription.id.should eq('sample_subscription')
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
it "should parse event api response and provide the content properly" do
|
90
|
-
@request.expects(:execute).once.returns(mock_response(sample_event))
|
91
|
-
result = ChargeBee::Event.retrieve("sample_event")
|
92
|
-
event = result.event
|
93
|
-
s = event.content.subscription
|
94
|
-
event.id.should eq('ev_KyVqDX__dev__NTgtUgx1')
|
95
|
-
s.id.should eq('sample_subscription')
|
96
|
-
end
|
97
|
-
|
98
|
-
end
|
99
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'rest_client'
|
3
|
+
require 'sample_response'
|
4
|
+
|
5
|
+
describe "chargebee" do
|
6
|
+
|
7
|
+
before(:all) do
|
8
|
+
@request = RestClient::Request
|
9
|
+
end
|
10
|
+
|
11
|
+
it "serialize should convert the hash to acceptable format" do
|
12
|
+
before = {
|
13
|
+
:id => "sub_KyVq7DNSNM7CSD",
|
14
|
+
:plan_id => "free",
|
15
|
+
:addons => [{:id => "monitor", :quantity => 2}, {:id => "ssl"}],
|
16
|
+
:addon_ids => ["addon_one", "addon_two"],
|
17
|
+
:card => {
|
18
|
+
:first_name => "Rajaraman",
|
19
|
+
:last_name => "Santhanam",
|
20
|
+
:number => "4111111111111111",
|
21
|
+
:expiry_month => "1",
|
22
|
+
:expiry_year => "2024",
|
23
|
+
:cvv => "007"
|
24
|
+
}
|
25
|
+
}
|
26
|
+
after = {
|
27
|
+
"id"=>"sub_KyVq7DNSNM7CSD",
|
28
|
+
"plan_id"=>"free",
|
29
|
+
"addons[id][0]"=>"monitor",
|
30
|
+
"addons[quantity][0]"=>"2",
|
31
|
+
"addons[id][1]"=>"ssl",
|
32
|
+
"addon_ids[0]"=>"addon_one",
|
33
|
+
"addon_ids[1]"=>"addon_two",
|
34
|
+
"card[first_name]"=>"Rajaraman",
|
35
|
+
"card[last_name]"=>"Santhanam",
|
36
|
+
"card[number]"=>"4111111111111111",
|
37
|
+
"card[expiry_month]"=>"1",
|
38
|
+
"card[expiry_year]"=>"2024",
|
39
|
+
"card[cvv]"=>"007"}
|
40
|
+
ChargeBee::Util.serialize(before).should eq(after)
|
41
|
+
end
|
42
|
+
|
43
|
+
it "symbolize_keys should convert keys to symbols" do
|
44
|
+
before = {
|
45
|
+
'id' => 'sub_KyVq4P__dev__NTWxbJx1',
|
46
|
+
'plan_id' => 'basic',
|
47
|
+
'addons' => [{ 'id' => 'ssl' }, {'id' => 'sms', 'quantity' => '10'}]
|
48
|
+
}
|
49
|
+
after = {
|
50
|
+
:id => 'sub_KyVq4P__dev__NTWxbJx1',
|
51
|
+
:plan_id => 'basic',
|
52
|
+
:addons => [{ :id => 'ssl' }, {:id => 'sms', :quantity => '10'}],
|
53
|
+
}
|
54
|
+
ChargeBee::Util.symbolize_keys(before).should eq(after)
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should properly convert the response json into proper object" do
|
58
|
+
@request.expects(:execute).once.returns(mock_response(simple_subscription))
|
59
|
+
result = ChargeBee::Subscription.retrieve("simple_subscription")
|
60
|
+
s = result.subscription
|
61
|
+
s.id.should eq("simple_subscription")
|
62
|
+
s.plan_id.should eq('basic')
|
63
|
+
c = result.customer
|
64
|
+
c.first_name.should eq('simple')
|
65
|
+
c.last_name.should eq('subscription')
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should properly convert the nested response json into proper object with sub types" do
|
69
|
+
@request.expects(:execute).once.returns(mock_response(nested_subscription))
|
70
|
+
result = ChargeBee::Subscription.retrieve("nested_subscription")
|
71
|
+
s = result.subscription
|
72
|
+
s.id.should eq("nested_subscription")
|
73
|
+
a = s.addons
|
74
|
+
a.length.should eq(2)
|
75
|
+
a[0].id.should eq("monitor")
|
76
|
+
a[0].quantity.should eq("10")
|
77
|
+
a[1].id.should eq("ssl")
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should properly convert the list response json into proper result object" do
|
81
|
+
@request.expects(:execute).once.returns(mock_response(list_subscriptions))
|
82
|
+
result = ChargeBee::Subscription.list({:limit => 2})
|
83
|
+
result.length.should eq(2)
|
84
|
+
result.each do |i|
|
85
|
+
i.subscription.id.should eq('sample_subscription')
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should parse event api response and provide the content properly" do
|
90
|
+
@request.expects(:execute).once.returns(mock_response(sample_event))
|
91
|
+
result = ChargeBee::Event.retrieve("sample_event")
|
92
|
+
event = result.event
|
93
|
+
s = event.content.subscription
|
94
|
+
event.id.should eq('ev_KyVqDX__dev__NTgtUgx1')
|
95
|
+
s.id.should eq('sample_subscription')
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
|
data/spec/errors_spec.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'ChargeBee::InvalidRequestError' do
|
4
|
-
let(:invalid_request_json) do
|
5
|
-
{
|
6
|
-
message: 'id: The value chargebee_account is already present.',
|
7
|
-
type: 'invalid_request',
|
8
|
-
api_error_code: 'duplicate_entry',
|
9
|
-
param: 'id',
|
10
|
-
error_code: 'param_not_unique',
|
11
|
-
error_msg: 'The value chargebee_account is already present.',
|
12
|
-
error_param: 'id',
|
13
|
-
http_status_code: 400
|
14
|
-
}
|
15
|
-
end
|
16
|
-
|
17
|
-
it "provide message from error api response" do
|
18
|
-
error = ChargeBee::InvalidRequestError.new(400, invalid_request_json)
|
19
|
-
error.message.should eq 'id: The value chargebee_account is already present.'
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'ChargeBee::InvalidRequestError' do
|
4
|
+
let(:invalid_request_json) do
|
5
|
+
{
|
6
|
+
message: 'id: The value chargebee_account is already present.',
|
7
|
+
type: 'invalid_request',
|
8
|
+
api_error_code: 'duplicate_entry',
|
9
|
+
param: 'id',
|
10
|
+
error_code: 'param_not_unique',
|
11
|
+
error_msg: 'The value chargebee_account is already present.',
|
12
|
+
error_param: 'id',
|
13
|
+
http_status_code: 400
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
it "provide message from error api response" do
|
18
|
+
error = ChargeBee::InvalidRequestError.new(400, invalid_request_json)
|
19
|
+
error.message.should eq 'id: The value chargebee_account is already present.'
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
data/spec/sample_response.rb
CHANGED
@@ -1,73 +1,73 @@
|
|
1
|
-
|
2
|
-
def api_index_urls()
|
3
|
-
{
|
4
|
-
:urls => ["http://mannar-test.localcb.com:8080/api/v1/subscriptions",
|
5
|
-
"http://mannar-test.localcb.com:8080/api/v1/customers",
|
6
|
-
"http://mannar-test.localcb.com:8080/api/v1/cards",
|
7
|
-
"http://mannar-test.localcb.com:8080/api/v1/invoices",
|
8
|
-
"http://mannar-test.localcb.com:8080/api/v1/transactions",
|
9
|
-
"http://mannar-test.localcb.com:8080/api/v1/hosted_pages",
|
10
|
-
"http://mannar-test.localcb.com:8080/api/v1/events"],
|
11
|
-
:version => "v2"
|
12
|
-
}
|
13
|
-
end
|
14
|
-
|
15
|
-
def simple_subscription
|
16
|
-
{
|
17
|
-
:subscription => {
|
18
|
-
:id => 'simple_subscription',
|
19
|
-
:plan_id => 'basic'
|
20
|
-
},
|
21
|
-
:customer => {
|
22
|
-
:first_name => 'simple',
|
23
|
-
:last_name => 'subscription'
|
24
|
-
}
|
25
|
-
}
|
26
|
-
end
|
27
|
-
|
28
|
-
def nested_subscription
|
29
|
-
{
|
30
|
-
:subscription => {
|
31
|
-
:id => 'nested_subscription',
|
32
|
-
:plan_id => 'basic',
|
33
|
-
:addons => [
|
34
|
-
{:id => 'monitor', :quantity => '10'},
|
35
|
-
{:id => 'ssl'}
|
36
|
-
]
|
37
|
-
}
|
38
|
-
}
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_subscription
|
42
|
-
{
|
43
|
-
:subscription => {
|
44
|
-
:id => "sample_subscription",
|
45
|
-
:plan_id => "basic"
|
46
|
-
}
|
47
|
-
}
|
48
|
-
end
|
49
|
-
|
50
|
-
def list_subscriptions()
|
51
|
-
{:list => [test_subscription, test_subscription]}
|
52
|
-
end
|
53
|
-
|
54
|
-
def sample_event()
|
55
|
-
{:event => {
|
56
|
-
:id => 'ev_KyVqDX__dev__NTgtUgx1',
|
57
|
-
:occurred_at => 1325356232,
|
58
|
-
:event_type => "payment_collected",
|
59
|
-
:webhook_status => "succeeded",
|
60
|
-
:content => {
|
61
|
-
:subscription => {
|
62
|
-
:id => 'sample_subscription',
|
63
|
-
:plan_id => 'basic',
|
64
|
-
:plan_quantity=> 1,
|
65
|
-
},
|
66
|
-
:customer => {
|
67
|
-
:first_name => "Sample",
|
68
|
-
:last_name => "Subscription",
|
69
|
-
},
|
70
|
-
}
|
71
|
-
}
|
72
|
-
}
|
73
|
-
end
|
1
|
+
|
2
|
+
def api_index_urls()
|
3
|
+
{
|
4
|
+
:urls => ["http://mannar-test.localcb.com:8080/api/v1/subscriptions",
|
5
|
+
"http://mannar-test.localcb.com:8080/api/v1/customers",
|
6
|
+
"http://mannar-test.localcb.com:8080/api/v1/cards",
|
7
|
+
"http://mannar-test.localcb.com:8080/api/v1/invoices",
|
8
|
+
"http://mannar-test.localcb.com:8080/api/v1/transactions",
|
9
|
+
"http://mannar-test.localcb.com:8080/api/v1/hosted_pages",
|
10
|
+
"http://mannar-test.localcb.com:8080/api/v1/events"],
|
11
|
+
:version => "v2"
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
def simple_subscription
|
16
|
+
{
|
17
|
+
:subscription => {
|
18
|
+
:id => 'simple_subscription',
|
19
|
+
:plan_id => 'basic'
|
20
|
+
},
|
21
|
+
:customer => {
|
22
|
+
:first_name => 'simple',
|
23
|
+
:last_name => 'subscription'
|
24
|
+
}
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
def nested_subscription
|
29
|
+
{
|
30
|
+
:subscription => {
|
31
|
+
:id => 'nested_subscription',
|
32
|
+
:plan_id => 'basic',
|
33
|
+
:addons => [
|
34
|
+
{:id => 'monitor', :quantity => '10'},
|
35
|
+
{:id => 'ssl'}
|
36
|
+
]
|
37
|
+
}
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_subscription
|
42
|
+
{
|
43
|
+
:subscription => {
|
44
|
+
:id => "sample_subscription",
|
45
|
+
:plan_id => "basic"
|
46
|
+
}
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
def list_subscriptions()
|
51
|
+
{:list => [test_subscription, test_subscription]}
|
52
|
+
end
|
53
|
+
|
54
|
+
def sample_event()
|
55
|
+
{:event => {
|
56
|
+
:id => 'ev_KyVqDX__dev__NTgtUgx1',
|
57
|
+
:occurred_at => 1325356232,
|
58
|
+
:event_type => "payment_collected",
|
59
|
+
:webhook_status => "succeeded",
|
60
|
+
:content => {
|
61
|
+
:subscription => {
|
62
|
+
:id => 'sample_subscription',
|
63
|
+
:plan_id => 'basic',
|
64
|
+
:plan_quantity=> 1,
|
65
|
+
},
|
66
|
+
:customer => {
|
67
|
+
:first_name => "Sample",
|
68
|
+
:last_name => "Subscription",
|
69
|
+
},
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
end
|