Skip to content

Conversation

allan-almeida-imtbl
Copy link
Contributor

@allan-almeida-imtbl allan-almeida-imtbl commented Sep 5, 2025

Summary

Primary sales widget current behaviour:

  • Perform a wallet based (V1) sanctions check on widget mount
  • Check sanction result and error out if sanctioned
    • when a uses selects credit or debit payment type
    • when a user proceeeds to buy with a token

This PR:

  • upgrades the second case to use the V2 sanctions endpoint as the token details are known
    • calculate the sale amount using the same displayed price calculations as done in the UI for the OrderItems list
  • removes the first case as we can safely rely on the third party provider (transak) checks of their own
  • remove risk assessment from context state as it is no longer used

Screenshots

Requests

Uses the correct total sale price regardless of whether balance is sufficient or not

Screenshot 2025-09-08 at 10 20 47 am Screenshot 2025-09-08 at 10 21 45 am Screenshot 2025-09-08 at 10 22 03 am Screenshot 2025-09-08 at 10 22 20 am Screenshot 2025-09-08 at 10 22 43 am Screenshot 2025-09-08 at 10 22 53 am

@allan-almeida-imtbl allan-almeida-imtbl requested a review from a team as a code owner September 5, 2025 04:52
Copy link

nx-cloud bot commented Sep 5, 2025

View your CI Pipeline Execution ↗ for commit 41579b8

Command Status Duration Result
nx affected -t build,lint,test ✅ Succeeded 2m 5s View ↗
nx run-many -p @imtbl/sdk,@imtbl/checkout-widge... ✅ Succeeded 1m 1s View ↗

☁️ Nx Cloud last updated this comment at 2025-09-08 00:49:09 UTC

@allan-almeida-imtbl allan-almeida-imtbl marked this pull request as draft September 5, 2025 05:08
@allan-almeida-imtbl allan-almeida-imtbl marked this pull request as ready for review September 8, 2025 00:31

// Calculate total amount from all order items for risk assessment
// Based on how item prices are calculated in OrderItems.tsx
const totalAmount = items.reduce((total, item) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

this information and the address below aren't available in any context or state directly to use? just curious

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there is top level order quote and order item information is stored in useSaleContext, however the pricing with conversions is done on a per list item basis in OrderItems/OrderItem, which similarly pulls the quote and item information from useSaleContext. I assume its done this way to dynamcially change based on the selected token

@allan-almeida-imtbl allan-almeida-imtbl added this pull request to the merge queue Sep 8, 2025
Merged via the queue into main with commit 2108b0a Sep 8, 2025
11 checks passed
@allan-almeida-imtbl allan-almeida-imtbl deleted the refactor/GFI-1062/primary-sale-widget-sanctions-upgrade branch September 8, 2025 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants