Skip to content

Commit 27ec01d

Browse files
committed
Use id instead of cid when sending events to customer io
1 parent a951e35 commit 27ec01d

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

oura/jotform/webhook.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func (w *WebhookProcessor) handleSurveyCompleted(ctx context.Context, identifier
183183
Data: surveyCompletedData,
184184
}
185185

186-
err := w.customerIOClient.SendEvent(ctx, identifiers.CID, surveyCompleted)
186+
err := w.customerIOClient.SendEvent(ctx, identifiers.ID, surveyCompleted)
187187
if err != nil {
188188
return errors.Wrap(err, "unable to send sizing kit delivered event")
189189
}

oura/jotform/webhook_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ var _ = Describe("WebhookProcessor", func() {
100100
It("should successfully process an eligible submission and create consent record", func() {
101101
submissionID := "6410095903544943563"
102102
userID := "1aacb960-430c-4081-8b3b-a32688807dc5"
103-
cid := "cio_0987654321"
104103

105104
submission, err := jotformTest.LoadFixture("./test/fixtures/submission.json")
106105
Expect(err).ToNot(HaveOccurred())
@@ -118,7 +117,7 @@ var _ = Describe("WebhookProcessor", func() {
118117
ouraTest.Response{StatusCode: http.StatusOK, Body: customer},
119118
)
120119
trackAPIResponses.AddResponse(
121-
[]ouraTest.RequestMatcher{ouraTest.NewRequestMethodAndPathMatcher(http.MethodPost, "/api/v1/customers/"+cid+"/events")},
120+
[]ouraTest.RequestMatcher{ouraTest.NewRequestMethodAndPathMatcher(http.MethodPost, "/api/v1/customers/"+userID+"/events")},
122121
ouraTest.Response{StatusCode: http.StatusOK, Body: "{}"},
123122
)
124123

@@ -171,7 +170,6 @@ var _ = Describe("WebhookProcessor", func() {
171170
It("should successfully process an eligible submission and not attempt to create consent record if one already exists", func() {
172171
submissionID := "6410095903544943563"
173172
userID := "1aacb960-430c-4081-8b3b-a32688807dc5"
174-
cid := "cio_0987654321"
175173

176174
submission, err := jotformTest.LoadFixture("./test/fixtures/submission.json")
177175
Expect(err).ToNot(HaveOccurred())
@@ -189,7 +187,7 @@ var _ = Describe("WebhookProcessor", func() {
189187
ouraTest.Response{StatusCode: http.StatusOK, Body: customer},
190188
)
191189
trackAPIResponses.AddResponse(
192-
[]ouraTest.RequestMatcher{ouraTest.NewRequestMethodAndPathMatcher(http.MethodPost, "/api/v1/customers/"+cid+"/events")},
190+
[]ouraTest.RequestMatcher{ouraTest.NewRequestMethodAndPathMatcher(http.MethodPost, "/api/v1/customers/"+userID+"/events")},
193191
ouraTest.Response{StatusCode: http.StatusOK, Body: "{}"},
194192
)
195193

oura/shopify/fulfillment.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func (f *FulfillmentEventProcessor) onSizingKitDelivered(ctx context.Context, id
150150
},
151151
}
152152

153-
return f.customerIOClient.SendEvent(ctx, identifiers.CID, sizingKitDelivered)
153+
return f.customerIOClient.SendEvent(ctx, identifiers.ID, sizingKitDelivered)
154154
}
155155

156156
func (f *FulfillmentEventProcessor) onRingDelivered(ctx context.Context, identifiers customerio.Identifiers, event FulfillmentEvent) error {
@@ -160,5 +160,5 @@ func (f *FulfillmentEventProcessor) onRingDelivered(ctx context.Context, identif
160160
Data: customerio.OuraRingDeliveredData{},
161161
}
162162

163-
return f.customerIOClient.SendEvent(ctx, identifiers.CID, ringDelivered)
163+
return f.customerIOClient.SendEvent(ctx, identifiers.ID, ringDelivered)
164164
}

oura/shopify/fulfillment_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ var _ = Describe("FulfillmentEventProcessor", func() {
7474

7575
Context("ProcessSubmission", func() {
7676
It("should successfully process a sizing kit delivery", func() {
77-
cid := "cio_0987654321"
77+
id := "1aacb960-430c-4081-8b3b-a32688807dc5"
7878
sizingKitDiscountCode := shopify.RandomDiscountCode()
7979

8080
event := shopify.FulfillmentEvent{
@@ -120,7 +120,7 @@ var _ = Describe("FulfillmentEventProcessor", func() {
120120

121121
trackAPIResponses.AddResponse(
122122
[]ouraTest.RequestMatcher{
123-
ouraTest.NewRequestMethodAndPathMatcher(http.MethodPost, "/api/v1/customers/"+cid+"/events"),
123+
ouraTest.NewRequestMethodAndPathMatcher(http.MethodPost, "/api/v1/customers/"+id+"/events"),
124124
ouraTest.NewRequestJSONBodyMatcher(`{
125125
"name": "oura_sizing_kit_delivered",
126126
"id": "` + fmt.Sprintf("%d", event.ID) + `",
@@ -141,7 +141,7 @@ var _ = Describe("FulfillmentEventProcessor", func() {
141141
})
142142

143143
It("should successfully process a ring delivery", func() {
144-
cid := "cio_0987654321"
144+
id := "1aacb960-430c-4081-8b3b-a32688807dc5"
145145
discountCode := shopify.RandomDiscountCode()
146146

147147
event := shopify.FulfillmentEvent{
@@ -180,7 +180,7 @@ var _ = Describe("FulfillmentEventProcessor", func() {
180180

181181
trackAPIResponses.AddResponse(
182182
[]ouraTest.RequestMatcher{
183-
ouraTest.NewRequestMethodAndPathMatcher(http.MethodPost, "/api/v1/customers/"+cid+"/events"),
183+
ouraTest.NewRequestMethodAndPathMatcher(http.MethodPost, "/api/v1/customers/"+id+"/events"),
184184
ouraTest.NewRequestJSONBodyMatcher(`{
185185
"name": "oura_ring_delivered",
186186
"id": "` + fmt.Sprintf("%d", event.ID) + `",

0 commit comments

Comments
 (0)