gotransverse-tract-api 0.3.4 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gotransverse-tract-api.rb +51 -1
- data/lib/gotransverse-tract-api/api_data.rb +259 -0
- data/lib/gotransverse-tract-api/billing_account/adjustment.rb +205 -5
- data/lib/gotransverse-tract-api/billing_account/billing_account.rb +146 -13
- data/lib/gotransverse-tract-api/billing_account/invoice.rb +2 -1
- data/lib/gotransverse-tract-api/billing_account/payment.rb +90 -9
- data/lib/gotransverse-tract-api/billing_account/refund.rb +15 -1
- data/lib/gotransverse-tract-api/order/order_item.rb +179 -7
- data/lib/gotransverse-tract-api/order/organization.rb +15 -1
- data/lib/gotransverse-tract-api/order/people.rb +14 -16
- data/lib/gotransverse-tract-api/order/sales_order.rb +253 -6
- data/lib/gotransverse-tract-api/service/service.rb +273 -24
- data/lib/gotransverse-tract-api/service/service_resource.rb +65 -7
- data/lib/gotransverse-tract-api/usage/usage_event.rb +58 -3
- data/lib/gotransverse-tract-api/usage/usage_main.rb +19 -0
- data/lib/gotransverse-tract-api/usage/usage_some.rb +24 -0
- data/lib/gotransverse-tract-api/version.rb +1 -1
- data/spec/gotransverse-tract-api/billing_account/adjustment_spec.rb +190 -0
- data/spec/gotransverse-tract-api/billing_account/billing_account_spec.rb +380 -0
- data/spec/gotransverse-tract-api/billing_account/invoice_spec.rb +43 -0
- data/spec/gotransverse-tract-api/billing_account/payment_spec.rb +104 -2
- data/spec/gotransverse-tract-api/billing_account/refund_spec.rb +30 -0
- data/spec/gotransverse-tract-api/order/order_item_spec.rb +169 -0
- data/spec/gotransverse-tract-api/order/organization_spec.rb +32 -0
- data/spec/gotransverse-tract-api/order/people_spec.rb +32 -0
- data/spec/gotransverse-tract-api/order/sales_order_spec.rb +209 -0
- data/spec/gotransverse-tract-api/service/service_resource_spec.rb +83 -0
- data/spec/gotransverse-tract-api/service/service_spec.rb +194 -0
- data/spec/gotransverse-tract-api/usage/usage_event_spec.rb +57 -0
- metadata +27 -2
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module GoTransverseTractApi
|
4
|
+
|
5
|
+
RSpec.describe BillingAccount::Invoice do
|
6
|
+
before(:each) { http_auth }
|
7
|
+
|
8
|
+
let(:response) { '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' }
|
9
|
+
let(:eid) { '48406' }
|
10
|
+
|
11
|
+
context ".apply_payment" do
|
12
|
+
it "applies a payment to the invoice" do
|
13
|
+
data = {
|
14
|
+
:billing_account => {
|
15
|
+
eid: '123'
|
16
|
+
},
|
17
|
+
:invoice => {
|
18
|
+
eid: '456'
|
19
|
+
},
|
20
|
+
:payment => {
|
21
|
+
:amount => '27',
|
22
|
+
:use_recurring_payment => 'false',
|
23
|
+
:credit_card_payment => {
|
24
|
+
:card_type => 'VISA',
|
25
|
+
:card_holder_first_name => 'Mary',
|
26
|
+
:card_holder_last_name => 'Smith',
|
27
|
+
:card_identifier_number => '4111111111111111111',
|
28
|
+
:card_verification_number => '123',
|
29
|
+
:card_expiration => '12/2016'
|
30
|
+
},
|
31
|
+
:billing_account => {
|
32
|
+
eid: '123'
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
allow(subject).to receive(:apply_payment).with(eid, data).and_return(response)
|
38
|
+
expect(subject.apply_payment(eid, data)).to eq(response)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
@@ -5,6 +5,9 @@ module GoTransverseTractApi
|
|
5
5
|
RSpec.describe BillingAccount::Payment do
|
6
6
|
before(:each) { http_auth }
|
7
7
|
|
8
|
+
let(:eid) { '4086' }
|
9
|
+
let(:response) { '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' }
|
10
|
+
|
8
11
|
context ".find_by_eid" do
|
9
12
|
it "returns a payment for the given eid" do
|
10
13
|
#data = described_class.find_by_eid(1)
|
@@ -18,10 +21,109 @@ module GoTransverseTractApi
|
|
18
21
|
cancel_url = "http://smartzip-cancel.com"
|
19
22
|
complete_url = "http://smartzip-complete.com"
|
20
23
|
|
21
|
-
|
22
|
-
|
24
|
+
token = 'afsfsferrhdgd234235sfe4'
|
25
|
+
|
26
|
+
allow(subject).to receive(:referrer_token).with(error_url,cancel_url,complete_url).and_return(token)
|
27
|
+
expect(subject.referrer_token(error_url,cancel_url,complete_url)).to eq(token)
|
23
28
|
end
|
29
|
+
end
|
24
30
|
|
31
|
+
context ".apply_refund" do
|
32
|
+
it "applies a refund to the payment account" do
|
33
|
+
data = {
|
34
|
+
:payment => {
|
35
|
+
eid: '123'
|
36
|
+
},
|
37
|
+
:refund => {
|
38
|
+
:amount => '47.00',
|
39
|
+
:description => 'Refund Create',
|
40
|
+
:original_payment => {
|
41
|
+
eid: '456'
|
42
|
+
},
|
43
|
+
:refund_reason => {
|
44
|
+
eid: '4'
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
allow(subject).to receive(:apply_refund).with(data).and_return(response)
|
50
|
+
expect(subject.apply_refund(data)).to eq(response)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context ".cancel" do
|
55
|
+
it "cancels a payment" do
|
56
|
+
data = {
|
57
|
+
:description => 'Test Cancel',
|
58
|
+
:payment => {
|
59
|
+
eid: '123'
|
60
|
+
},
|
61
|
+
:reason => {
|
62
|
+
eid: '123'
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
allow(subject).to receive(:cancel).with(eid, data).and_return(response)
|
67
|
+
expect(subject.cancel(eid, data)).to eq(response)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
context ".reallocate" do
|
72
|
+
it "reallocates a payment" do
|
73
|
+
data = {
|
74
|
+
:description => 'Test Reallocate',
|
75
|
+
:payment => {
|
76
|
+
eid: '123'
|
77
|
+
},
|
78
|
+
:reason => {
|
79
|
+
eid: '123'
|
80
|
+
},
|
81
|
+
:invoices => [{
|
82
|
+
:invoice => {
|
83
|
+
eid: '123'
|
84
|
+
}},
|
85
|
+
{
|
86
|
+
:invoice => {
|
87
|
+
eid: '456'
|
88
|
+
}}]
|
89
|
+
}
|
90
|
+
|
91
|
+
allow(subject).to receive(:reallocate).with(eid, data).and_return(response)
|
92
|
+
expect(subject.reallocate(eid, data)).to eq(response)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
context ".create_payment" do
|
97
|
+
it "creates a payment" do
|
98
|
+
data = {
|
99
|
+
:amount => '20.00',
|
100
|
+
:description => 'Credit Card Payment',
|
101
|
+
:billing_account => {
|
102
|
+
eid: '123'
|
103
|
+
},
|
104
|
+
:credit_card_payment => {
|
105
|
+
:card_type => 'VISA',
|
106
|
+
:card_holder_first_name => 'Mary',
|
107
|
+
:card_holder_last_name => 'Smith',
|
108
|
+
:card_identifier_number => '4111111111111111111',
|
109
|
+
:card_expiration => '12/2016'
|
110
|
+
},
|
111
|
+
:phone_number => {
|
112
|
+
:country_code => '1',
|
113
|
+
:area_code => '512',
|
114
|
+
:number => '00000',
|
115
|
+
:extension => '123',
|
116
|
+
:purpose => 'PAYMENT'
|
117
|
+
},
|
118
|
+
:email_address => {
|
119
|
+
:email => 'test@test.com',
|
120
|
+
:purpose => 'PAYMENT'
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
allow(subject).to receive(:create_payment).with(data).and_return(response)
|
125
|
+
expect(subject.create_payment(data)).to eq(response)
|
126
|
+
end
|
25
127
|
end
|
26
128
|
|
27
129
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module GoTransverseTractApi
|
4
|
+
|
5
|
+
RSpec.describe BillingAccount::Refund do
|
6
|
+
before(:each) { http_auth }
|
7
|
+
|
8
|
+
let(:response) { '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' }
|
9
|
+
let(:eid) { '48406' }
|
10
|
+
|
11
|
+
context ".create_refund" do
|
12
|
+
it "creates a refund to the account" do
|
13
|
+
data = {
|
14
|
+
:amount => '47.00',
|
15
|
+
:description => 'Refund Create',
|
16
|
+
:original_payment => {
|
17
|
+
eid: '123'
|
18
|
+
},
|
19
|
+
:refund_reason => {
|
20
|
+
eid: '456'
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
allow(subject).to receive(:create_refund).with(data).and_return(response)
|
25
|
+
expect(subject.create_refund(data)).to eq(response)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,169 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module GoTransverseTractApi
|
4
|
+
|
5
|
+
RSpec.describe Order::OrderItem do
|
6
|
+
before(:each) { http_auth }
|
7
|
+
|
8
|
+
context ".approve" do
|
9
|
+
it "approves an order item" do
|
10
|
+
eid = '48406'
|
11
|
+
|
12
|
+
data = {
|
13
|
+
:approval_date => '2015-09-09',
|
14
|
+
:type => 'Order Item',
|
15
|
+
:awaiting_approval => 'true',
|
16
|
+
:requested_effective_date => '2015-07-09',
|
17
|
+
:unit_price => '0.00',
|
18
|
+
:recurring_unit_price => '10.00',
|
19
|
+
:quantity => '1',
|
20
|
+
:sequence => '1',
|
21
|
+
:date_approval => '2015-09-09',
|
22
|
+
:description => 'sjkadfkak',
|
23
|
+
eid: '48406',
|
24
|
+
:order_items => {
|
25
|
+
:page_number => '1',
|
26
|
+
:page_size => '50',
|
27
|
+
:total_elements => '0',
|
28
|
+
:element_count => '0',
|
29
|
+
:total_pages => '0'
|
30
|
+
},
|
31
|
+
:order_item_usage_rules => {
|
32
|
+
:page_number => '1',
|
33
|
+
:page_size => '50',
|
34
|
+
:total_elements => '0',
|
35
|
+
:element_count => '0',
|
36
|
+
:total_pages => '0'
|
37
|
+
},
|
38
|
+
:recurring_product_price => {
|
39
|
+
:from_date => '2013-02-10T01:00:00',
|
40
|
+
:price_override => 'true',
|
41
|
+
:type => 'Recurring',
|
42
|
+
:payment_on_purchase_required => 'false',
|
43
|
+
:recurring_payment_required => 'false',
|
44
|
+
:recurrence_period => 'BILLCYCLE',
|
45
|
+
eid: '12345',
|
46
|
+
:price_ranges => {
|
47
|
+
:page_number => '1',
|
48
|
+
:page_size => '50',
|
49
|
+
:total_elements => '1',
|
50
|
+
:element_count => '1',
|
51
|
+
:total_pages => '1',
|
52
|
+
:price_range => {
|
53
|
+
:quantity_begin_range => '0.00',
|
54
|
+
:price => '10.00',
|
55
|
+
:level => '1',
|
56
|
+
eid: '812'
|
57
|
+
}
|
58
|
+
}
|
59
|
+
},
|
60
|
+
:product => {
|
61
|
+
:name => 'uvaciahcahoqho',
|
62
|
+
:description => 'asccaihq gqidiqbckasciahci-cuaca',
|
63
|
+
:short_description =>'sdvsucihc',
|
64
|
+
:product_type_code => 'SUBSCRIPTION',
|
65
|
+
:product_state => 'aihaa',
|
66
|
+
:requires_agreement => 'true',
|
67
|
+
:serialized => 'false',
|
68
|
+
:taxable => 'false',
|
69
|
+
:trial => 'asda',
|
70
|
+
:default_quantity => '10',
|
71
|
+
:internal_name => 'ddsfs',
|
72
|
+
:min_service_resources => '0',
|
73
|
+
:max_service_resources => '0',
|
74
|
+
:trial_override => 'false',
|
75
|
+
eid: '234',
|
76
|
+
:product_prices => {
|
77
|
+
:page_number => '1',
|
78
|
+
:page_size => '50',
|
79
|
+
:total_elements => '1',
|
80
|
+
:element_count => '1',
|
81
|
+
:total_pages => '1',
|
82
|
+
:product_price => {
|
83
|
+
:from_date => '2013-02-10T01:00:00',
|
84
|
+
:price_override => 'true',
|
85
|
+
:type => 'Recurring',
|
86
|
+
:payment_on_purchase_required => 'false',
|
87
|
+
:recurring_payment_required => 'false',
|
88
|
+
:recurrence_period => 'BILLCYCLE',
|
89
|
+
eid: '12345',
|
90
|
+
:price_ranges => {
|
91
|
+
:page_number => '1',
|
92
|
+
:page_size => '50',
|
93
|
+
:total_elements => '1',
|
94
|
+
:element_count => '1',
|
95
|
+
:total_pages => '1',
|
96
|
+
:price_range => {
|
97
|
+
:quantity_begin_range => '0.00',
|
98
|
+
:price => '10.00',
|
99
|
+
:level => '1',
|
100
|
+
eid: '812'
|
101
|
+
}
|
102
|
+
}
|
103
|
+
}
|
104
|
+
},
|
105
|
+
:product_category => {
|
106
|
+
:name => 'sdfsdfs',
|
107
|
+
:description => 'wrggdgd',
|
108
|
+
:status => 'Active',
|
109
|
+
eid: '234'
|
110
|
+
},
|
111
|
+
:service_resource_category => {
|
112
|
+
:name => 'sdgw',
|
113
|
+
:type => 'A',
|
114
|
+
:status => 'sdfsa',
|
115
|
+
eid: '345'
|
116
|
+
},
|
117
|
+
:actions => {
|
118
|
+
:page_number => '1',
|
119
|
+
:page_size => '50',
|
120
|
+
:total_elements => '1',
|
121
|
+
:element_count => '1',
|
122
|
+
:total_pages => '1',
|
123
|
+
},
|
124
|
+
:product_usage_rules => {
|
125
|
+
:page_number => '1',
|
126
|
+
:page_size => '50',
|
127
|
+
:total_elements => '1',
|
128
|
+
:element_count => '1',
|
129
|
+
:total_pages => '1'
|
130
|
+
}
|
131
|
+
},
|
132
|
+
:price_list => {
|
133
|
+
:name => 'sds',
|
134
|
+
eid: '564'
|
135
|
+
},
|
136
|
+
:service_resources => {
|
137
|
+
:page_number => '1',
|
138
|
+
:page_size => '50',
|
139
|
+
:total_elements => '1',
|
140
|
+
:element_count => '1',
|
141
|
+
:total_pages => '1'
|
142
|
+
},
|
143
|
+
:operation_attributes => {
|
144
|
+
:page_number => '1',
|
145
|
+
:page_size => '50',
|
146
|
+
:total_elements => '1',
|
147
|
+
:element_count => '1',
|
148
|
+
:total_pages => '1'
|
149
|
+
},
|
150
|
+
:scheduled_charges => {
|
151
|
+
:page_number => '1',
|
152
|
+
:page_size => '50',
|
153
|
+
:total_elements => '1',
|
154
|
+
:element_count => '1',
|
155
|
+
:total_pages => '1'
|
156
|
+
}
|
157
|
+
}
|
158
|
+
|
159
|
+
response = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'
|
160
|
+
|
161
|
+
#described_class.approve(eid, data)
|
162
|
+
|
163
|
+
allow(subject).to receive(:approve).with(eid, data).and_return(response)
|
164
|
+
expect(subject.approve(eid, data)).to eq(response)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
end
|
169
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module GoTransverseTractApi
|
4
|
+
|
5
|
+
RSpec.describe Order::Organization do
|
6
|
+
before(:each) { http_auth }
|
7
|
+
|
8
|
+
context ".add_address" do
|
9
|
+
it "adds address for the customer" do
|
10
|
+
eid = '48406'
|
11
|
+
|
12
|
+
data = {
|
13
|
+
:city => 'fsfsfs',
|
14
|
+
:country => 'USA',
|
15
|
+
:line1 => 'wefsvgg ggdgdgd',
|
16
|
+
:postal_code => '232433',
|
17
|
+
:purpose => 'Billing',
|
18
|
+
:region_or_state => 'CA'
|
19
|
+
}
|
20
|
+
|
21
|
+
response = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'
|
22
|
+
|
23
|
+
#described_class.add_address(eid, data)
|
24
|
+
|
25
|
+
allow(subject).to receive(:add_address).with(eid, data).and_return(response)
|
26
|
+
expect(subject.add_address(eid, data)).to eq(response)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module GoTransverseTractApi
|
4
|
+
|
5
|
+
RSpec.describe Order::People do
|
6
|
+
before(:each) { http_auth }
|
7
|
+
|
8
|
+
context ".add_address" do
|
9
|
+
it "adds address for the customer" do
|
10
|
+
eid = '48406'
|
11
|
+
|
12
|
+
data = {
|
13
|
+
:city => 'fsfsfs',
|
14
|
+
:country => 'USA',
|
15
|
+
:line1 => 'wefsvgg ggdgdgd',
|
16
|
+
:postal_code => '232433',
|
17
|
+
:purpose => 'Billing',
|
18
|
+
:region_or_state => 'CA'
|
19
|
+
}
|
20
|
+
|
21
|
+
response = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'
|
22
|
+
|
23
|
+
#described_class.add_address(eid, data)
|
24
|
+
|
25
|
+
allow(subject).to receive(:add_address).with(eid, data).and_return(response)
|
26
|
+
expect(subject.add_address(eid, data)).to eq(response)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
@@ -0,0 +1,209 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module GoTransverseTractApi
|
4
|
+
|
5
|
+
RSpec.describe Order::SalesOrder do
|
6
|
+
before(:each) { http_auth }
|
7
|
+
|
8
|
+
let(:response) { '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' }
|
9
|
+
|
10
|
+
context ".add_custom_field_value" do
|
11
|
+
it "adds custom field value for the sales order" do
|
12
|
+
eid = '48406'
|
13
|
+
data = { :value => 'yes' }
|
14
|
+
|
15
|
+
allow(subject).to receive(:add_custom_field_value).with(eid, data).and_return(response)
|
16
|
+
expect(subject.add_custom_field_value(eid, data)).to eq(response)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context ".confirm" do
|
21
|
+
it "confirms the sales order" do
|
22
|
+
eid = '48406'
|
23
|
+
|
24
|
+
data = {
|
25
|
+
:sales_order => {
|
26
|
+
:referral => 'Order Item',
|
27
|
+
:order_date => '2015-07-09',
|
28
|
+
:order_status => '0.00',
|
29
|
+
eid: '48406',
|
30
|
+
:order_items => {
|
31
|
+
:page_number => '1',
|
32
|
+
:page_size => '50',
|
33
|
+
:total_elements => '0',
|
34
|
+
:element_count => '0',
|
35
|
+
:total_pages => '0',
|
36
|
+
:order_item => {
|
37
|
+
:quantity => '1',
|
38
|
+
:product => [{
|
39
|
+
:name => 'sdfsdfsvs',
|
40
|
+
:description => 'dsfsgegebdbb',
|
41
|
+
:short_description => 'asfgerdbdb',
|
42
|
+
:product_type_code => 'udygciww',
|
43
|
+
:product_state => 'afwfwss',
|
44
|
+
:requires_agreement => 'true',
|
45
|
+
:serialized => 'false',
|
46
|
+
:taxable => 'false',
|
47
|
+
:trial => 'asda',
|
48
|
+
:default_quantity => '10',
|
49
|
+
:min_service_resources => '0',
|
50
|
+
:max_service_resources => '0',
|
51
|
+
:trial_override => 'false',
|
52
|
+
eid: '234',
|
53
|
+
:product_prices => {
|
54
|
+
:page_number => '1',
|
55
|
+
:page_size => '50',
|
56
|
+
:total_elements => '1',
|
57
|
+
:element_count => '1',
|
58
|
+
:total_pages => '1',
|
59
|
+
:product_price => {
|
60
|
+
:from_date => '2013-02-10T01:00:00',
|
61
|
+
:price_override => 'true',
|
62
|
+
:type => 'Recurring',
|
63
|
+
:recurring_payment_required => 'false',
|
64
|
+
eid: '12345',
|
65
|
+
:price_ranges => {
|
66
|
+
:page_number => '1',
|
67
|
+
:page_size => '50',
|
68
|
+
:total_elements => '1',
|
69
|
+
:element_count => '1',
|
70
|
+
:total_pages => '1',
|
71
|
+
:price_range => {
|
72
|
+
:quantity_begin_range => '0.00',
|
73
|
+
:price => '10.00',
|
74
|
+
:level => '1',
|
75
|
+
eid: '812'
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
},
|
80
|
+
:product_category => {
|
81
|
+
:name => 'sdfsdfs',
|
82
|
+
:description => 'wrggdgd',
|
83
|
+
:status => 'Active',
|
84
|
+
eid: '234'
|
85
|
+
},
|
86
|
+
:actions => {
|
87
|
+
:page_number => '1',
|
88
|
+
:page_size => '50',
|
89
|
+
:total_elements => '1',
|
90
|
+
:element_count => '1',
|
91
|
+
:total_pages => '1',
|
92
|
+
},
|
93
|
+
:product_usage_rules => {
|
94
|
+
:page_number => '1',
|
95
|
+
:page_size => '50',
|
96
|
+
:total_elements => '1',
|
97
|
+
:element_count => '1',
|
98
|
+
:total_pages => '1'
|
99
|
+
}
|
100
|
+
}]
|
101
|
+
}
|
102
|
+
},
|
103
|
+
:billing_account => {
|
104
|
+
:automatic_recurring_payment => 'false',
|
105
|
+
eid: '2535'
|
106
|
+
}
|
107
|
+
},
|
108
|
+
:payment => {
|
109
|
+
:amount => '100',
|
110
|
+
:description => 'sdgegegeg',
|
111
|
+
:billing_account => {
|
112
|
+
:automatic_recurring_payment => 'false',
|
113
|
+
eid: '2535'
|
114
|
+
},
|
115
|
+
:credit_card_payment => {
|
116
|
+
:card_type => 'visa',
|
117
|
+
:card_holder_first_name => 'sgdfvdv',
|
118
|
+
:card_holder_middle_name => 'sgdfvdv',
|
119
|
+
:card_holder_last_name => 'sgdfvdv',
|
120
|
+
:card_identifier_number => '2353643423412354754',
|
121
|
+
:card_expiration => "12/20"
|
122
|
+
}
|
123
|
+
}
|
124
|
+
}
|
125
|
+
|
126
|
+
allow(subject).to receive(:confirm).with(eid, data).and_return(response)
|
127
|
+
expect(subject.confirm(eid, data)).to eq(response)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
context ".create_sales_order" do
|
132
|
+
it "creates a sales order" do
|
133
|
+
|
134
|
+
data = {
|
135
|
+
:note => 'Order Item',
|
136
|
+
:purchase_order_number => '2015-07-09',
|
137
|
+
:order_items => {
|
138
|
+
:order_item => {
|
139
|
+
:quantity => '1',
|
140
|
+
:product => [{
|
141
|
+
eid: '232353'
|
142
|
+
}]
|
143
|
+
}
|
144
|
+
},
|
145
|
+
:billing_account => {
|
146
|
+
:bill_type => 'EMAIL',
|
147
|
+
:automatic_recurring_payment => 'true',
|
148
|
+
:daily_bill_cycle => {
|
149
|
+
eid: '34535'
|
150
|
+
},
|
151
|
+
:organization => {
|
152
|
+
:name => 'eregedvdvd',
|
153
|
+
:tax_id_number => '56-4575675',
|
154
|
+
:addresses => {
|
155
|
+
:postal_address => [{
|
156
|
+
:purpose => 'SERVICE',
|
157
|
+
:country => 'USA',
|
158
|
+
:city => 'Fremont',
|
159
|
+
:region_or_state => 'CA',
|
160
|
+
:postal_code => '94538',
|
161
|
+
:line1 => 'sdgwg wfegfdg',
|
162
|
+
:line2 => 'wefergdvdg ergegdf'
|
163
|
+
},
|
164
|
+
{
|
165
|
+
:purpose => 'BILLING',
|
166
|
+
:country => 'USA',
|
167
|
+
:city => 'Fremont',
|
168
|
+
:region_or_state => 'CA',
|
169
|
+
:postal_code => '94538',
|
170
|
+
:line1 => 'sdgwg wfegfdg',
|
171
|
+
:line2 => 'wefergdvdg ergegdf'
|
172
|
+
},
|
173
|
+
{
|
174
|
+
:purpose => 'SHIPPING',
|
175
|
+
:country => 'USA',
|
176
|
+
:city => 'Fremont',
|
177
|
+
:region_or_state => 'CA',
|
178
|
+
:postal_code => '94538',
|
179
|
+
:line1 => 'sdgwg wfegfdg',
|
180
|
+
:line2 => 'wefergdvdg ergegdf'
|
181
|
+
}],
|
182
|
+
:telecom_address => {
|
183
|
+
:dialing_prefix => '9',
|
184
|
+
:country_code => '1',
|
185
|
+
:area_code => '510',
|
186
|
+
:number => '234325',
|
187
|
+
:extension => '24',
|
188
|
+
:purpose => 'OFFICE'
|
189
|
+
},
|
190
|
+
:email_address => {
|
191
|
+
:email => 'sjdhfs@sdfgs.com',
|
192
|
+
:purpose => 'PRIMARY'
|
193
|
+
}
|
194
|
+
}
|
195
|
+
},
|
196
|
+
:billing_account_category => {
|
197
|
+
eid: '749'
|
198
|
+
}
|
199
|
+
}
|
200
|
+
}
|
201
|
+
|
202
|
+
allow(subject).to receive(:create_sales_order).with(data).and_return(response)
|
203
|
+
expect(subject.create_sales_order(data)).to eq(response)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|