Skip to content

Commit

Permalink
Add Trial item to the alpha client library [sc-58848] (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
macharmi authored May 13, 2024
1 parent bd89d34 commit d3f89e2
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 48 deletions.
14 changes: 14 additions & 0 deletions lib/chartmogul/csv/line_items/trial.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

module ChartMogul
module CSV
module LineItems
# from https://chartmogul-samples.s3-eu-west-1.amazonaws.com/public/04_Invoice_line_items.csv
SUBSCRIPTION_HEADERS = ['Invoice external ID', 'External ID', 'Subscription external ID',
'Subscription set external ID', 'Type', 'Amount in cents', 'Plan', 'Service period start', 'Service period end', 'Quantity', 'Proration', 'Discount code', 'Discount amount', 'Tax amount', 'Description', 'Transaction fee', 'Account Code', 'Transaction fees currency', 'Discount description', 'Proration type', 'Event Order'].freeze

class Trial < Subscription
end
end
end
end
3 changes: 2 additions & 1 deletion spec/chartmogul/csv/customer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
end

it 'returns the correct headers' do
expect(described_class.headers).to eq(['Name', 'Email', 'Company', 'Country', 'State', 'City', 'Zip', 'External ID', 'Lead created at', 'Free trial started at'])
expect(described_class.headers).to eq(['Name', 'Email', 'Company', 'Country', 'State', 'City', 'Zip',
'External ID', 'Lead created at', 'Free trial started at'])
end
end
end
3 changes: 2 additions & 1 deletion spec/chartmogul/csv/invoice_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
end

it 'returns the correct headers' do
expect(described_class.headers).to eq(['Customer external ID', 'Invoice external ID', 'Invoiced date', 'Due date', 'Currency', 'Status'])
expect(described_class.headers).to eq(['Customer external ID', 'Invoice external ID', 'Invoiced date',
'Due date', 'Currency', 'Status'])
end
end
end
42 changes: 21 additions & 21 deletions spec/chartmogul/csv/line_items/one_item_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,27 @@

it 'returns the correct headers' do
expect(described_class.headers).to eq(
%w[
Invoice\ external\ ID
External\ ID
Subscription\ external\ ID
Subscription\ set\ external\ ID
Type
Amount\ in\ cents
Plan
Service\ period\ start
Service\ period\ end
Quantity
Proration
Discount\ code
Discount\ amount
Tax\ amount
Description
Transaction\ fee
Account\ Code
Transaction\ fees\ currency
Discount\ description
Balance\ transfer
[
'Invoice external ID',
'External ID',
'Subscription external ID',
'Subscription set external ID',
'Type',
'Amount in cents',
'Plan',
'Service period start',
'Service period end',
'Quantity',
'Proration',
'Discount code',
'Discount amount',
'Tax amount',
'Description',
'Transaction fee',
'Account Code',
'Transaction fees currency',
'Discount description',
'Balance transfer'
]
)
end
Expand Down
44 changes: 22 additions & 22 deletions spec/chartmogul/csv/line_items/subscription_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,28 @@

it 'returns the correct headers' do
expect(described_class.headers).to eq(
%w[
Invoice\ external\ ID
External\ ID
Subscription\ external\ ID
Subscription\ set\ external\ ID
Type
Amount\ in\ cents
Plan
Service\ period\ start
Service\ period\ end
Quantity
Proration
Discount\ code
Discount\ amount
Tax\ amount
Description
Transaction\ fee
Account\ Code
Transaction\ fees\ currency
Discount\ description
Proration\ type
Event\ Order
[
'Invoice external ID',
'External ID',
'Subscription external ID',
'Subscription set external ID',
'Type',
'Amount in cents',
'Plan',
'Service period start',
'Service period end',
'Quantity',
'Proration',
'Discount code',
'Discount amount',
'Tax amount',
'Description',
'Transaction fee',
'Account Code',
'Transaction fees currency',
'Discount description',
'Proration type',
'Event Order'
]
)
end
Expand Down
7 changes: 4 additions & 3 deletions spec/chartmogul/csv/subscription_event_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
subscription_set_external_id: 'subscription_set_external_id',
effective_date: Time.new(2020, 8, 24, 8, 22, 15),
event_order: 1000,
invoice_external_id: 12345
invoice_external_id: 12_345
)
end

Expand All @@ -31,12 +31,13 @@
end

it 'sets invoice_external_id correctly' do
expect(csv_subscription_event.invoice_external_id).to eq(12345)
expect(csv_subscription_event.invoice_external_id).to eq(12_345)
end

it 'returns the correct headers' do
expect(described_class.headers)
.to eq(%w[External\ ID Subscription\ set\ external\ ID Subscription\ external\ ID Customer\ external\ ID Plan\ external\ ID Date Effective\ Date Event\ Type Currency Amount\ in\ Cents Quantity Retracted\ event\ ID Event\ Order Invoice\ external\ ID].freeze)
.to eq(['External ID', 'Subscription set external ID', 'Subscription external ID', 'Customer external ID',
'Plan external ID', 'Date', 'Effective Date', 'Event Type', 'Currency', 'Amount in Cents', 'Quantity', 'Retracted event ID', 'Event Order', 'Invoice external ID'].freeze)
end
end
end

0 comments on commit d3f89e2

Please sign in to comment.