@@ -11,12 +11,42 @@ def initialize(attributes = {})
11
11
@permissions = Models ::BillingPermissions . new ( attributes . fetch ( 'permissions' ) )
12
12
@status = 'subscribed'
13
13
@source = attributes . fetch ( 'source' )
14
- @billing_info = attributes [ 'billing_info' ] && Models ::BillingInfo . new ( @id , attributes [ 'billing_info' ] )
15
- @credit_card_info = attributes [ 'credit_card_info' ] && Models ::CreditCardInfo . new ( @id , attributes [ 'credit_card_info' ] )
14
+ @billing_info = attributes [ 'billing_info' ] && Models ::V2BillingInfo . new ( @id , attributes [ 'billing_info' ] )
15
+ @credit_card_info = attributes [ 'credit_card_info' ] && Models ::V2CreditCardInfo . new ( @id , attributes [ 'credit_card_info' ] )
16
16
@payment_intent = attributes [ 'payment_intent' ] && Models ::PaymentIntent . new ( attributes [ 'payment_intent' ] )
17
17
@owner = fetch_owner ( attributes . fetch ( 'owner' ) )
18
18
@addons = attributes . fetch ( 'addons' )
19
19
@created_at = attributes . fetch ( 'created_at' )
20
20
end
21
21
end
22
+
23
+ class Models ::V2BillingInfo
24
+ attr_reader :id , :address , :address2 , :billing_email , :city , :company , :country , :first_name , :last_name , :state , :vat_id , :zip_code
25
+
26
+ def initialize ( id , attrs )
27
+ @id = id
28
+ @address = attrs . fetch ( 'address' )
29
+ @address2 = attrs . fetch ( 'address2' )
30
+ @billing_email = attrs . fetch ( 'billing_email' )
31
+ @city = attrs . fetch ( 'city' )
32
+ @company = attrs . fetch ( 'company' )
33
+ @country = attrs . fetch ( 'country' )
34
+ @first_name = attrs . fetch ( 'first_name' )
35
+ @last_name = attrs . fetch ( 'last_name' )
36
+ @state = attrs . fetch ( 'state' )
37
+ @vat_id = attrs . fetch ( 'vat_id' )
38
+ @zip_code = attrs . fetch ( 'zip_code' )
39
+ end
40
+ end
41
+
42
+ class Models ::V2CreditCardInfo
43
+ attr_reader :id , :card_owner , :expiration_date , :last_digits
44
+
45
+ def initialize ( id , attrs )
46
+ @id = id
47
+ @card_owner = attrs . fetch ( 'card_owner' )
48
+ @expiration_date = attrs . fetch ( 'expiration_date' )
49
+ @last_digits = attrs . fetch ( 'last_digits' )
50
+ end
51
+ end
22
52
end
0 commit comments