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

LIMS-1396: Use shipping service callback URL to only send emails once shipment is booked #814

Conversation

ndg63276
Copy link
Collaborator

@ndg63276 ndg63276 commented Aug 14, 2024

JIRA ticket: LIMS-1396

Summary:

Currently, when a user is redirected to the shipping service, Synchweb sends the email and marks the dewar as 'dispatch-requested' instantly, as it doesn't know if/when they have completed the form.
The shipping service now accepts a callback URL, so we can send that in and it will POST to the address with some data about the completed shipment.

Changes:

  • Create new non-authenticated endpoint at /api/shipment/dewars/confirmdispatch/did/{dewarid}/token/{token}
  • Create pseudo-random token and store in Dewar.extra column as JSON
  • Pass callback URL including token to shipping service
  • Don't update dewar status and history when first redirecting to shipping service
  • Add function at new endpoint to check token, then update dewar status and history, and send email to stores and return lab contact
  • Hide email address in dispatch form before redirection to shipping service as it will not be used

To test:

  • Make sure $use_shipping_service = True;, $use_shipping_service_redirect = True; and $shipping_service_api_url = "https://sample-shipping-staging.diamond.ac.uk/api";
  • Use a dev instance that can send emails (or dump to file as at https://confluence.diamond.ac.uk/x/i_CVCQ)
  • Go to a UK shipment, request dispatch without clicking "Use Facility Account", so it doesnt use the shipping service. Fill in the form and submit, check the dewar & shipping status are both dispatch-requested, the history has a line added, but the tracking number has not been filled in (as it doesn't exist). Check an email has been sent immediately.
  • Repeat for a non-UK shipment, also without the shipping service
  • Now try with a UK shipment and click "Use Facility Account". Click "Proceed" to the shipping service, but before filling in the form, check the shipment in another tab, it should not say dispatch-requested, and no email should have been sent. Now fill in the shipping service form and submit, click "Exit" back to Synchweb and the dewar & shipping status should both be dispatch-requested, an email should have been sent, and the tracking number should be in Synchweb too.
  • Check the email carefully, it should have a link to the AWB in the shipping service, check this works.

@ndg63276 ndg63276 requested a review from MattPrit August 14, 2024 14:32
@NKatti2011 NKatti2011 self-requested a review August 29, 2024 13:04
Copy link
Collaborator

@NKatti2011 NKatti2011 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ndg63276 ndg63276 changed the base branch from master to pre-release/2024-R4.2 September 3, 2024 08:17
@ndg63276 ndg63276 merged commit 97d22af into pre-release/2024-R4.2 Sep 3, 2024
2 checks passed
@ndg63276 ndg63276 deleted the improvement/LIMS-1396/use-shipping-service-callback-url branch September 3, 2024 08:21
@ndg63276 ndg63276 restored the improvement/LIMS-1396/use-shipping-service-callback-url branch September 3, 2024 10:56
@ndg63276 ndg63276 deleted the improvement/LIMS-1396/use-shipping-service-callback-url branch September 10, 2024 10:50
ndg63276 added a commit that referenced this pull request Sep 17, 2024
* LIMS-1432: Add shelxt downstream view (#818)

* LIMS-1436: Use auth provider provided logout URL when SSO is enabled (#822)

* LIMS-1108: Improve message re international shipping (#721)

* LIMS-1396: Use shipping service callback URL to only send emails once shipment is booked (#814)

* LIMS-1435: Put CCP4 location into config variable (#821)

* LIMS-656: Show auto subsamples if they have data (#817)

---------

Co-authored-by: Dean Keeble <[email protected]>
Co-authored-by: Guilherme Francisco <[email protected]>
Co-authored-by: Mark Williams <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants