Skip to content

Commit

Permalink
Move all embedded struct resources to pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
remi-stripe committed Jun 6, 2018
1 parent 8e1e874 commit 19d0c24
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 75 deletions.
66 changes: 33 additions & 33 deletions account.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,32 +343,32 @@ func (ea *ExternalAccount) UnmarshalJSON(b []byte) error {

// LegalEntity is the structure for properties related to an account's legal state.
type LegalEntity struct {
AdditionalOwners []AdditionalOwner `json:"additional_owners"`
Address AccountAddress `json:"address"`
AddressKana AccountAddress `json:"address_kana"`
AddressKanji AccountAddress `json:"address_kanji"`
BusinessName string `json:"business_name"`
BusinessNameKana string `json:"business_name_kana"`
BusinessNameKanji string `json:"business_name_kanji"`
BusinessTaxIDProvided bool `json:"business_tax_id_provided"`
BusinessVATIDProvided bool `json:"business_vat_id_provided"`
DOB DOB `json:"dob"`
FirstName string `json:"first_name"`
FirstNameKana string `json:"first_name_kana"`
FirstNameKanji string `json:"first_name_kanji"`
Gender string `json:"gender"`
LastName string `json:"last_name"`
LastNameKana string `json:"last_name_kana"`
LastNameKanji string `json:"last_name_kanji"`
MaidenName string `json:"maiden_name"`
PersonalAddress AccountAddress `json:"personal_address"`
PersonalAddressKana AccountAddress `json:"personal_address_kana"`
PersonalAddressKanji AccountAddress `json:"personal_address_kanji"`
PersonalIDNumberProvided bool `json:"personal_id_number_provided"`
PhoneNumber string `json:"phone_number"`
SSNLast4Provided bool `json:"ssn_last_4_provided"`
Type LegalEntityType `json:"type"`
Verification IdentityVerification `json:"verification"`
AdditionalOwners []*AdditionalOwner `json:"additional_owners"`
Address *AccountAddress `json:"address"`
AddressKana *AccountAddress `json:"address_kana"`
AddressKanji *AccountAddress `json:"address_kanji"`
BusinessName string `json:"business_name"`
BusinessNameKana string `json:"business_name_kana"`
BusinessNameKanji string `json:"business_name_kanji"`
BusinessTaxIDProvided bool `json:"business_tax_id_provided"`
BusinessVATIDProvided bool `json:"business_vat_id_provided"`
DOB *DOB `json:"dob"`
FirstName string `json:"first_name"`
FirstNameKana string `json:"first_name_kana"`
FirstNameKanji string `json:"first_name_kanji"`
Gender string `json:"gender"`
LastName string `json:"last_name"`
LastNameKana string `json:"last_name_kana"`
LastNameKanji string `json:"last_name_kanji"`
MaidenName string `json:"maiden_name"`
PersonalAddress *AccountAddress `json:"personal_address"`
PersonalAddressKana *AccountAddress `json:"personal_address_kana"`
PersonalAddressKanji *AccountAddress `json:"personal_address_kanji"`
PersonalIDNumberProvided bool `json:"personal_id_number_provided"`
PhoneNumber string `json:"phone_number"`
SSNLast4Provided bool `json:"ssn_last_4_provided"`
Type LegalEntityType `json:"type"`
Verification *IdentityVerification `json:"verification"`
}

// Address is the structure for an account address.
Expand All @@ -394,13 +394,13 @@ type DOB struct {

// AdditionalOwner is the structure for an account owner.
type AdditionalOwner struct {
Address AccountAddress `json:"address"`
DOB DOB `json:"dob"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
MaidenName string `json:"maiden_name"`
PersonalIDNumberProvided bool `json:"personal_id_number_provided"`
Verification string `json:"verification"`
Address *AccountAddress `json:"address"`
DOB DOB `json:"dob"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
MaidenName string `json:"maiden_name"`
PersonalIDNumberProvided bool `json:"personal_id_number_provided"`
Verification string `json:"verification"`
}

// IdentityVerification is the structure for an account's verification.
Expand Down
8 changes: 4 additions & 4 deletions balance.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ type BalanceTransactionListParams struct {
// Balance is the resource representing your Stripe balance.
// For more details see https://stripe.com/docs/api/#balance.
type Balance struct {
Available []Amount `json:"available"`
Livemode bool `json:"livemode"`
Pending []Amount `json:"pending"`
Available []*Amount `json:"available"`
Livemode bool `json:"livemode"`
Pending []*Amount `json:"pending"`
}

// BalanceTransaction is the resource representing the balance transaction.
Expand All @@ -107,7 +107,7 @@ type BalanceTransaction struct {
Description string `json:"description"`
ID string `json:"id"`
Fee int64 `json:"fee"`
FeeDetails []BalanceTransactionFee `json:"fee_details"`
FeeDetails []*BalanceTransactionFee `json:"fee_details"`
Net int64 `json:"net"`
Recipient string `json:"recipient"`
Source string `json:"source"`
Expand Down
10 changes: 5 additions & 5 deletions charge.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,11 @@ type ChargeOutcome struct {

// ShippingDetails is the structure containing shipping information.
type ShippingDetails struct {
Address Address `json:"address"`
Carrier string `json:"carrier"`
Name string `json:"name"`
Phone string `json:"phone"`
TrackingNumber string `json:"tracking_number"`
Address *Address `json:"address"`
Carrier string `json:"carrier"`
Name string `json:"name"`
Phone string `json:"phone"`
TrackingNumber string `json:"tracking_number"`
}

var depth int = -1
Expand Down
12 changes: 6 additions & 6 deletions countryspec.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ type VerificationFieldsList struct {
// CountrySpec is the resource representing the rules required for a Stripe account.
// For more details see https://stripe.com/docs/api/#country_specs.
type CountrySpec struct {
DefaultCurrency Currency `json:"default_currency"`
ID string `json:"id"`
SupportedBankAccountCurrencies map[Currency][]Country `json:"supported_bank_account_currencies"`
SupportedPaymentCurrencies []Currency `json:"supported_payment_currencies"`
SupportedPaymentMethods []string `json:"supported_payment_methods"`
VerificationFields map[LegalEntityType]VerificationFieldsList `json:"verification_fields"`
DefaultCurrency Currency `json:"default_currency"`
ID string `json:"id"`
SupportedBankAccountCurrencies map[Currency][]Country `json:"supported_bank_account_currencies"`
SupportedPaymentCurrencies []Currency `json:"supported_payment_currencies"`
SupportedPaymentMethods []string `json:"supported_payment_methods"`
VerificationFields map[LegalEntityType]*VerificationFieldsList `json:"verification_fields"`
}

// CountrySpecList is a list of country specs as retrieved from a list endpoint.
Expand Down
18 changes: 9 additions & 9 deletions order.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ type OrderReturnParams struct {
}

type Shipping struct {
Address Address `json:"address"`
Carrier string `json:"carrier"`
Name string `json:"name"`
Phone string `json:"phone"`
TrackingNumber string `json:"tracking_number"`
Address *Address `json:"address"`
Carrier string `json:"carrier"`
Name string `json:"name"`
Phone string `json:"phone"`
TrackingNumber string `json:"tracking_number"`
}

type ShippingMethod struct {
Expand All @@ -99,19 +99,19 @@ type Order struct {
AmountReturned int64 `json:"amount_returned"`
Application string `json:"application"`
ApplicationFee int64 `json:"application_fee"`
Charge Charge `json:"charge"`
Charge *Charge `json:"charge"`
Created int64 `json:"created"`
Currency Currency `json:"currency"`
Customer Customer `json:"customer"`
Email string `json:"email"`
ID string `json:"id"`
Items []OrderItem `json:"items"`
Items []*OrderItem `json:"items"`
Livemode bool `json:"livemode"`
Metadata map[string]string `json:"metadata"`
Returns *OrderReturnList `json:"returns"`
SelectedShippingMethod *string `json:"selected_shipping_method"`
Shipping Shipping `json:"shipping"`
ShippingMethods []ShippingMethod `json:"shipping_methods"`
Shipping *Shipping `json:"shipping"`
ShippingMethods []*ShippingMethod `json:"shipping_methods"`
Status string `json:"status"`
StatusTransitions StatusTransitions `json:"status_transitions"`
Updated int64 `json:"updated"`
Expand Down
2 changes: 1 addition & 1 deletion order_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestShipping_MarshalJSON(t *testing.T) {
Phone: "phone",
Carrier: "USPS",
TrackingNumber: "tracking.123",
Address: Address{
Address: &Address{
Line1: "123 Market Street",
City: "San Francisco",
State: "CA",
Expand Down
16 changes: 8 additions & 8 deletions orderreturn.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package stripe
import "encoding/json"

type OrderReturn struct {
Amount int64 `json:"amount"`
Created int64 `json:"created"`
Currency Currency `json:"currency"`
ID string `json:"id"`
Items []OrderItem `json:"items"`
Livemode bool `json:"livemode"`
Order Order `json:"order"`
Refund *Refund `json:"refund"`
Amount int64 `json:"amount"`
Created int64 `json:"created"`
Currency Currency `json:"currency"`
ID string `json:"id"`
Items []*OrderItem `json:"items"`
Livemode bool `json:"livemode"`
Order *Order `json:"order"`
Refund *Refund `json:"refund"`
}

// OrderReturnList is a list of returns as retrieved from a list endpoint.
Expand Down
4 changes: 2 additions & 2 deletions sku.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ type SKU struct {
Description string `json:"description"`
ID string `json:"id"`
Image string `json:"image"`
Inventory Inventory `json:"inventory"`
Inventory *Inventory `json:"inventory"`
Livemode bool `json:"livemode"`
Metadata map[string]string `json:"metadata"`
PackageDimensions *PackageDimensions `json:"package_dimensions"`
Price int64 `json:"price"`
Product Product `json:"product"`
Product *Product `json:"product"`
Updated int64 `json:"updated"`
}

Expand Down
12 changes: 6 additions & 6 deletions source.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ type SourceMandateAcceptance struct {
}

type SourceMandate struct {
Acceptance SourceMandateAcceptance `json:"acceptance"`
NotificationMethod string `json:"notification_method"`
Reference string `json:"reference"`
URL string `json:"url"`
Acceptance *SourceMandateAcceptance `json:"acceptance"`
NotificationMethod string `json:"notification_method"`
Reference string `json:"reference"`
URL string `json:"url"`
}

type Source struct {
Expand All @@ -180,9 +180,9 @@ type Source struct {
Flow SourceFlow `json:"flow"`
ID string `json:"id"`
Livemode bool `json:"livemode"`
Mandate SourceMandate `json:"mandate"`
Mandate *SourceMandate `json:"mandate"`
Metadata map[string]string `json:"metadata"`
Owner SourceOwner `json:"owner"`
Owner *SourceOwner `json:"owner"`
Receiver *ReceiverFlow `json:"receiver,omitempty"`
Redirect *RedirectFlow `json:"redirect,omitempty"`
StatementDescriptor string `json:"statement_descriptor"`
Expand Down
2 changes: 1 addition & 1 deletion transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type Transfer struct {
BalanceTransaction *BalanceTransaction `json:"balance_transaction"`
Created int64 `json:"created"`
Currency Currency `json:"currency"`
Destination TransferDestination `json:"destination"`
Destination *TransferDestination `json:"destination"`
DestinationPayment *Charge `json:"destination_payment"`
ID string `json:"id"`
Livemode bool `json:"livemode"`
Expand Down

0 comments on commit 19d0c24

Please sign in to comment.