Skip to content

Commit e0e9161

Browse files
committed
allow non EU customers to provide information on if they are locally registered for VAT
1 parent 4ebb217 commit e0e9161

File tree

7 files changed

+14
-6
lines changed

7 files changed

+14
-6
lines changed

lib/travis/api/v3/models/subscription.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def initialize(subscriptions, permissions)
3333
end
3434

3535
class Models::BillingInfo
36-
attr_reader :id, :address, :address2, :billing_email, :city, :company, :country, :first_name, :last_name, :state, :vat_id, :zip_code
36+
attr_reader :id, :address, :address2, :billing_email, :city, :company, :country, :first_name, :last_name, :state, :vat_id, :zip_code, :has_local_registration
3737

3838
def initialize(id, attrs)
3939
@id = id
@@ -48,6 +48,7 @@ def initialize(id, attrs)
4848
@state = attrs.fetch('state')
4949
@vat_id = attrs.fetch('vat_id')
5050
@zip_code = attrs.fetch('zip_code')
51+
@has_local_registration= attrs.fetch('has_local_registration')
5152
end
5253
end
5354

lib/travis/api/v3/queries/subscriptions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Travis::API::V3
22
class Queries::Subscriptions < Query
33
params :plan, :coupon, :organization_id, :client_secret
4-
params :first_name, :last_name, :company, :address, :address2, :city, :country, :state, :vat_id, :zip_code, :billing_email, prefix: :billing_info
4+
params :first_name, :last_name, :company, :address, :address2, :city, :country, :state, :vat_id, :zip_code, :billing_email, :has_local_registration, prefix: :billing_info
55
params :token, prefix: :credit_card_info
66

77
def all(user_id)

lib/travis/api/v3/renderer/subscription.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def discount
2424
end
2525

2626
class Renderer::BillingInfo < ModelRenderer
27-
representation(:standard, :id, :address, :address2, :billing_email, :city, :company, :country, :first_name, :last_name, :state, :vat_id, :zip_code)
27+
representation(:standard, :id, :address, :address2, :billing_email, :city, :company, :country, :first_name, :last_name, :state, :vat_id, :zip_code, :has_local_registration)
2828
end
2929

3030
class Renderer::CreditCardInfo < ModelRenderer

lib/travis/api/v3/services/subscription/update_address.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Travis::API::V3
22
class Services::Subscription::UpdateAddress < Service
3-
params :first_name, :last_name, :company, :address, :address2, :city, :country, :state, :vat_id, :zip_code, :billing_email
3+
params :first_name, :last_name, :company, :address, :address2, :city, :country, :state, :vat_id, :zip_code, :billing_email, :has_local_registration
44

55
def run!
66
raise LoginRequired unless access_control.full_access_or_logged_in?

spec/v3/services/subscription/update_address_spec.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
'city' => 'Berlin',
2929
'country' => 'Germany',
3030
'zip_code' => '10001',
31-
'billing_email' => '[email protected]'
31+
'billing_email' => '[email protected]',
32+
'has_local_registration' => nil
3233
} }
3334
let(:subscription_id) { rand(999) }
3435

@@ -42,7 +43,8 @@
4243
'city' => 'Berlin',
4344
'country' => 'Germany',
4445
'zip_code' => '10001',
45-
'billing_email' => '[email protected]'
46+
'billing_email' => '[email protected]',
47+
'has_local_registration' => nil
4648
})
4749
.to_return(status: 204)
4850
end

spec/v3/services/subscriptions/all_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
'last_name' => 'rosas',
6666
'company' => '',
6767
'billing_email' => '[email protected]',
68+
'has_local_registration' => nil,
6869
'zip_code' => '28450',
6970
'address' => 'Luis Spota',
7071
'address2' => '',

spec/v3/services/subscriptions/create_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
'billing_info.country' => 'Germany',
3636
'billing_info.zip_code' => '10001',
3737
'billing_info.billing_email' => '[email protected]',
38+
'billing_info.has_local_registration' => nil,
3839
'credit_card_info.token' => 'token_from_stripe'
3940
}
4041
end
@@ -56,6 +57,7 @@
5657
'country' => 'Germany',
5758
'zip_code' => '10001',
5859
'billing_email' => '[email protected]',
60+
'has_local_registration' => nil,
5961
},
6062
'credit_card_info' => {
6163
'token' => 'token_from_stripe'
@@ -85,6 +87,7 @@
8587
'vat_id' => nil,
8688
'zip_code' => '10001',
8789
'billing_email' => '[email protected]',
90+
'has_local_registration' => nil
8891
},
8992
'credit_card_info' => {
9093
'card_owner' => 'Travis Schmidt',
@@ -126,6 +129,7 @@
126129
'last_name' => 'Schmidt',
127130
'company' => 'Travis',
128131
'billing_email' => '[email protected]',
132+
'has_local_registration' => nil,
129133
'zip_code' => '10001',
130134
'address' => 'Rigaer Strasse',
131135
'address2' => nil,

0 commit comments

Comments
 (0)