Skip to content

Commit

Permalink
bugfix/updatedAt in Marketing is not pointer type
Browse files Browse the repository at this point in the history
  • Loading branch information
daisukefunase committed Jan 31, 2024
1 parent aab0f61 commit fccafb8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
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

0 comments on commit fccafb8

Please sign in to comment.