Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing Bug Marketing UpdatedAt in Customer is not pointer type #261

Merged
merged 4 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions customer.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,16 @@ type CustomerSearchOptions struct {
}

type EmailMarketingConsent struct {
State string `json:"state"`
OptInLevel string `json:"opt_in_level"`
ConsentUpdatedAt time.Time `json:"consent_updated_at"`
State string `json:"state"`
OptInLevel string `json:"opt_in_level"`
ConsentUpdatedAt *time.Time `json:"consent_updated_at"`
}

type SMSMarketingConsent struct {
State string `json:"state"`
OptInLevel string `json:"opt_in_level"`
ConsentUpdatedAt time.Time `json:"consent_updated_at"`
ConsentCollectedFrom string `json:"consent_collected_from"`
State string `json:"state"`
OptInLevel string `json:"opt_in_level"`
ConsentUpdatedAt *time.Time `json:"consent_updated_at"`
ConsentCollectedFrom string `json:"consent_collected_from"`
}

// List customers
Expand Down
8 changes: 4 additions & 4 deletions customer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,13 @@ func TestCustomerGet(t *testing.T) {
emailMarketingConsent1 := EmailMarketingConsent{
State: "not_subscribed",
OptInLevel: "single_opt_in",
ConsentUpdatedAt: updatedAt,
ConsentUpdatedAt: &updatedAt,
}

smsMarketingConsent1 := SMSMarketingConsent{
State: "not_subscribed",
OptInLevel: "single_opt_in",
ConsentUpdatedAt: updatedAt,
ConsentUpdatedAt: &updatedAt,
ConsentCollectedFrom: "OTHER",
}

Expand Down Expand Up @@ -375,7 +375,7 @@ func TestCustomerGet(t *testing.T) {
if customer.EmailMarketingConsent == nil {
t.Errorf("Customer.EmailMarketingConsent is nil, expected not nil")
} else {
if !customer.EmailMarketingConsent.ConsentUpdatedAt.Equal(expectation.EmailMarketingConsent.ConsentUpdatedAt) {
if !customer.EmailMarketingConsent.ConsentUpdatedAt.Equal(*expectation.EmailMarketingConsent.ConsentUpdatedAt) {
t.Errorf("Customer.EmailMarketingConsent.ConsentUpdatedAt returned %+v, expected %+v", customer.EmailMarketingConsent.ConsentUpdatedAt, expectation.EmailMarketingConsent.ConsentUpdatedAt)
}
if customer.EmailMarketingConsent.State != expectation.EmailMarketingConsent.State {
Expand All @@ -388,7 +388,7 @@ func TestCustomerGet(t *testing.T) {
if customer.SMSMarketingConsent == nil {
t.Errorf("Customer.SMSMarketingConsent is nil, expected not nil")
} else {
if !customer.SMSMarketingConsent.ConsentUpdatedAt.Equal(expectation.SMSMarketingConsent.ConsentUpdatedAt) {
if !customer.SMSMarketingConsent.ConsentUpdatedAt.Equal(*expectation.SMSMarketingConsent.ConsentUpdatedAt) {
t.Errorf("Customer.SMSMarketingConsent.ConsentUpdatedAt returned %+v, expected %+v", customer.SMSMarketingConsent.ConsentUpdatedAt, expectation.SMSMarketingConsent.ConsentUpdatedAt)
}
if customer.SMSMarketingConsent.State != expectation.SMSMarketingConsent.State {
Expand Down
Loading