-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1186 from nyaruka/optin_trigger_fix
Fix optin triggers marshaling with type ticket
- Loading branch information
Showing
4 changed files
with
93 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,7 +151,13 @@ var assetsJSON = `{ | |
"schemes": ["tel"], | ||
"roles": ["send", "receive"] | ||
} | ||
], | ||
], | ||
"optins": [ | ||
{ | ||
"uuid": "248be71d-78e9-4d71-a6c4-9981d369e5cb", | ||
"name": "Joke Of The Day" | ||
} | ||
], | ||
"ticketers": [ | ||
{ | ||
"uuid": "19dc6346-9623-4fe4-be80-538d493ecdf5", | ||
|
@@ -184,6 +190,7 @@ func TestTriggerMarshaling(t *testing.T) { | |
|
||
flow := assets.NewFlowReference("7c37d7e5-6468-4b31-8109-ced2ef8b5ddc", "Registration") | ||
channel := assets.NewChannelReference("3a05eaf5-cb1b-4246-bef1-f277419c83a7", "Nexmo") | ||
jotd := sa.OptIns().Get("248be71d-78e9-4d71-a6c4-9981d369e5cb") | ||
ticketer := sa.Ticketers().Get("19dc6346-9623-4fe4-be80-538d493ecdf5") | ||
weather := sa.Topics().Get("472a7a73-96cb-4736-b567-056d987cc5b4") | ||
user := sa.Users().Get("[email protected]") | ||
|
@@ -277,6 +284,18 @@ func TestTriggerMarshaling(t *testing.T) { | |
Build(), | ||
"msg", | ||
}, | ||
{ | ||
triggers.NewBuilder(env, flow, contact). | ||
OptIn(jotd, triggers.OptInEventTypeStarted). | ||
Build(), | ||
"optin_started", | ||
}, | ||
{ | ||
triggers.NewBuilder(env, flow, contact). | ||
OptIn(jotd, triggers.OptInEventTypeStopped). | ||
Build(), | ||
"optin_stopped", | ||
}, | ||
{ | ||
triggers.NewBuilder(env, flow, contact). | ||
Ticket(ticket, triggers.TicketEventTypeClosed). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
flows/triggers/testdata/TestTriggerMarshaling_optin_started.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"type": "optin", | ||
"environment": { | ||
"date_format": "YYYY-MM-DD", | ||
"time_format": "tt:mm", | ||
"timezone": "UTC", | ||
"number_format": { | ||
"decimal_symbol": ".", | ||
"digit_grouping_symbol": "," | ||
}, | ||
"input_collation": "default", | ||
"redaction_policy": "none" | ||
}, | ||
"flow": { | ||
"uuid": "7c37d7e5-6468-4b31-8109-ced2ef8b5ddc", | ||
"name": "Registration" | ||
}, | ||
"contact": { | ||
"uuid": "c00e5d67-c275-4389-aded-7d8b151cbd5b", | ||
"name": "Bob", | ||
"language": "eng", | ||
"status": "active", | ||
"created_on": "2018-10-20T09:49:31.23456789Z", | ||
"urns": [ | ||
"tel:+12065551212" | ||
] | ||
}, | ||
"triggered_on": "2018-10-20T09:49:31.23456789Z", | ||
"event": { | ||
"type": "started", | ||
"optin": { | ||
"uuid": "248be71d-78e9-4d71-a6c4-9981d369e5cb", | ||
"name": "Joke Of The Day" | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
flows/triggers/testdata/TestTriggerMarshaling_optin_stopped.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"type": "optin", | ||
"environment": { | ||
"date_format": "YYYY-MM-DD", | ||
"time_format": "tt:mm", | ||
"timezone": "UTC", | ||
"number_format": { | ||
"decimal_symbol": ".", | ||
"digit_grouping_symbol": "," | ||
}, | ||
"input_collation": "default", | ||
"redaction_policy": "none" | ||
}, | ||
"flow": { | ||
"uuid": "7c37d7e5-6468-4b31-8109-ced2ef8b5ddc", | ||
"name": "Registration" | ||
}, | ||
"contact": { | ||
"uuid": "c00e5d67-c275-4389-aded-7d8b151cbd5b", | ||
"name": "Bob", | ||
"language": "eng", | ||
"status": "active", | ||
"created_on": "2018-10-20T09:49:31.23456789Z", | ||
"urns": [ | ||
"tel:+12065551212" | ||
] | ||
}, | ||
"triggered_on": "2018-10-20T09:49:31.23456789Z", | ||
"event": { | ||
"type": "stopped", | ||
"optin": { | ||
"uuid": "248be71d-78e9-4d71-a6c4-9981d369e5cb", | ||
"name": "Joke Of The Day" | ||
} | ||
} | ||
} |