Add support for Sift Verification Product#2
Conversation
Add support for the following fields for an update_account event - $session_id - update_status
Add support for the Verification API, following 3 endpoints: - /send - /resend - /check
- Basic automated testing added for the Verification product via doctest - Fixed compiler warnings when running full test suite
| %Account{"$user_email": "bob@example.com", "$user_id": "bob", "$api_key": api_key, "$type": "$create_account"} | ||
| %Account{"$user_email": "bob@example.com", "$user_id": "bob", "$api_key": api_key(), "$type": "$create_account"} | ||
|
|
||
| iex> Account.create_account(%{user_email: "bob@example.com", user_id: "bob", payment_methods: [%{payment_type: :cash}]}) | ||
| %Account{"$user_email": "bob@example.com", "$user_id": "bob", "$api_key": api_key, "$payment_methods": [%PaymentMethod{"$payment_type": "$cash"}], "$type": "$create_account"} | ||
| %Account{"$user_email": "bob@example.com", "$user_id": "bob", "$api_key": api_key(), "$payment_methods": [%PaymentMethod{"$payment_type": "$cash"}], "$type": "$create_account"} | ||
|
|
||
| iex> Account.create_account(%{user_email: "bob@example.com", user_id: "bob", billing_address: %{name: "Bob", zipcode: "87102"}}) | ||
| %Account{"$user_email": "bob@example.com", "$user_id": "bob", "$type": "$create_account", "$api_key": api_key, "$billing_address": %Address{"$name": "Bob", "$zipcode": "87102"}} | ||
| %Account{"$user_email": "bob@example.com", "$user_id": "bob", "$type": "$create_account", "$api_key": api_key(), "$billing_address": %Address{"$name": "Bob", "$zipcode": "87102"}} | ||
|
|
||
| iex> Account.create_account(%{user_email: "bob@example.com", user_id: "bob", promotions: [%{promotion_id: "promo"}]}) | ||
| %Account{"$user_email": "bob@example.com", "$user_id": "bob", "$type": "$create_account", "$api_key": api_key, "$promotions": [%Promotion{"$promotion_id": "promo"}]} | ||
| %Account{"$user_email": "bob@example.com", "$user_id": "bob", "$type": "$create_account", "$api_key": api_key(), "$promotions": [%Promotion{"$promotion_id": "promo"}]} |
There was a problem hiding this comment.
This was producing compiler warnings.
|
|
||
| alias Siftsciex.Event.Payload | ||
| alias Siftsciex.Event.Payload.{Address, Image, Item, Location} | ||
| alias Siftsciex.Event.Payload.{Address, Image, Item} |
There was a problem hiding this comment.
This was producing compiler warnings
| iex> Response.process(%{"status" => 0, "error_message" => "OK", "time" => time, "request" => ""}) | ||
| %Response{status: 0, message: "OK", time: date_time, request: "", score_response: :empty} | ||
| iex> Response.process(%{"status" => 0, "error_message" => "OK", "time" => time(), "request" => ""}) | ||
| %Response{status: 0, message: "OK", time: date_time(), request: "", score_response: :empty} |
There was a problem hiding this comment.
This was producing compiler warnings
| ## Examples | ||
|
|
||
| iex> Error.error(response) | ||
| iex> Error.error(response()) |
There was a problem hiding this comment.
This was producing compiler warnings
| def post(_, %{"$user_id": "transport_error"} = data) do | ||
| def post(_, %{"$user_id": "transport_error"} = _data) do | ||
| {:error, %{reason: "Timeout"}} | ||
| end | ||
| def post(_, %{"$user_id": "server_error"} = data) do | ||
| def post(_, %{"$user_id": "server_error"} = _data) do | ||
| {:ok, %{status_code: 500}} | ||
| end | ||
| def post(_, %{"$user_id": "client_error"} = data) do | ||
| def post(_, %{"$user_id": "client_error"} = _data) do |
There was a problem hiding this comment.
This was producing compiler warnings
|
👋 Hi @dereksweet this is awesome! Unfortunately I'm not with Apartment Therapy any longer, although it looks like @andrewb is maybe he can help out with this? I would love for improvements to make it into the library so everyone can easily use them. |
|
Sure, thanks for the quick response @LeakyBucket. @andrewb any chance you'd want to merge this? We'd like to get off our local fork to ensure we are up to date with any changes in the future. I'm sure we will be adding more features in the future, as well. Let me know! |
|
@dereksweet thanks for your contribution. Unfortunately our team no longer develops our Elixir codebases so I don't expect any updates to this repo in future. |
OK that's fair. How would you feel about passing the torch on to me? I would take it up on my personal account. |
|
@andrewb I can actually get this merged directly into the SiftSciences organization here: https://github.com/SiftScience Would you be willing to assist in getting the hexdocs updated to point there instead of at apartmenttherapy? |
`__MODULE__.t` on line 27 is cause compilation failures. Adding a union type of the two responses.
Add support for $login event
|
@andrewb thought I'd try one more time to ask you about this. Would you be willing to transfer ownership of this project to The RealReal. You can see we've added more support for both login events and now we are adding support for the Decisions API as well. If not we can just keep adding to our fork or make a new package entirely, but if you'd be willing to pass on ownership of this we have a great relationship with the people at Sift and they will add it to their official packages list. Here is some documentation on how to use the hex.owner mix to transfer ownership: https://hexdocs.pm/hex/Mix.Tasks.Hex.Owner.html |
…decisions_api [FUJI-68] Add support for Decisions API
[FUJI-92] Update the URL used for getting a user's score
…ows-178109577 [#178109577] Synchronous workflow response support
…vents [ZION-661] Better error handling for events
[ZION-691] Evaluate config at runtime
What does this PR do & why?
This PR adds support for the Sift verification product, their 2FA offering that will deliver one time passwords to customers for security reasons. Is intended to be used for login but can be applied to any event they support.
How can this be manually tested?
You will need to become quite familiar with the Sift Verification product to manually test it, as well as have Sift turn the feature on for you. The integration guide can be found here: https://docs.google.com/document/d/11RK_oss2Z7TjydnugYHlG5tK41GMpCyfbNbjzZAYSfM/edit
Any questions or concerns about this change?
We have been using this branch at therealreal.com for a few months now so we are quite certain it's performing as expected. There are no changes to any of the existing functionality, just added a bunch of new methods to use for the Verification product.
Deployment Notes
No deployment notes