-
Notifications
You must be signed in to change notification settings - Fork 24
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
feat(commerce/backend): add pre-interaction checkout flow #723
Conversation
f7388b4
to
5b93246
Compare
AUTH_SERVER: z.string().url().default('http://rafiki-auth:3006'), | ||
PAYMENT_POINTER: z.string().default('http://rafiki-backend/shop'), | ||
KEY_ID: z.string().default('8e5e109e-9ea8-44a0-9490-1792bf1e07cb'), | ||
PRIVATE_KEY: z | ||
.string() | ||
.default( | ||
'LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1DNENBUUF3QlFZREsyVndCQ0lFSU9LemxweFR5c0xhbS94VWZ5R2t2T2dpSmcraTEvT25STURWMElqNi9vVnQKLS0tLS1FTkQgUFJJVkFURSBLRVktLS0tLQ==' | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will need to seed our wallet with a default account with two payment pointers. Will do this in a separate PR later on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why 2 payment pointers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One that will be the shop's payment pointer and one that will act as the customer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the customer one is necessary as any payment pointer can be used for customer actions
start: ['redirect'], | ||
finish: { | ||
method: 'redirect', | ||
uri: `${this.env.FRONTEND_URL}/placeholder?orderId=${orderId}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Placeholder URL for the moment.
return null | ||
} | ||
|
||
if (cached.expires !== null && cached.expires < Date.now()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a base cache class and might be used in other places as well directly as an abstraction, do you intend to also cleanup the cache on different instances except for when the specific item is retrieved and found as expired?
How about we also have a loop that periodically checks expired items? (Unless we want to have a notion of observability on cache misses which i don't think is the case)
What do you think about either a loop that checks expired items, or an implementation of an LRU cache?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see how an LRU cache fits our case? Regarding the loop that periodically checks expired items, that's what I'm planning to do (we cache some order related fields so we won't need to save them in the database), but this is going to be in the second phase of the checkout flow (post-interaction).
a51259b
to
5b4a0be
Compare
* chore(deps): update typescript-eslint monorepo to ^6.6.0 (#714) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency @tailwindcss/typography to ^0.5.10 (#715) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update pnpm to v8.7.4 (#716) * chore(deps): update pnpm to v8.7.4 * Update docker files --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Radu-Cristian Popa <radu.popa@breakpointit.eu> * fix(deps): update dependency ky to ^1.0.1 (#717) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat(backend): Slow incoming payments (#706) * reduce expiry time to 15 sec on payment pointer transaction * Handle transfer already exists properly * handle new webhook event - payment_pointer.not_found * feat(middleware): add handling of axios errors (#719) * feat(middleware): add handling of axios errors * fix: avoid double response send * fix(deps): update dependency express-rate-limit to ^6.11.1 (#720) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update dependency @interledger/http-signature-utils to v1.0.4 (#724) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update dependency @tanstack/react-query to ^4.35.0 (#725) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency eslint to ^8.49.0 (#727) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat(commerce/backend): add pre-interaction checkout flow (#723) * Draft * Progress * Make tests work again * Progress * Refactor * Remove calculateTotalAmount * Remove parseKey * Progress * Add cache * Rename fix * Add token cache * Update OP libraries * Downgrade `interledger/open-payments`: breaking changes * Fixes * Typo * Address feedback * fix(quote): change invalid amount error (#729) * fix(quote): change invalid amount error * fix: resolve lint issue * feat(commerce/frontend): add checkout view (#731) * Add checkout view * Backend changes * Fixes * fix(rapyd): add additional beneficiary fields on withdraw money (#730) * fix(rapyd): add additional beneficiary fields on withdraw money * fix: generate required fields * fix: remove console.log * fix: resolve some address issues * chore(deps): update typescript-eslint monorepo to ^6.7.0 (#735) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update pnpm to v8.7.5 (#734) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update dependency express-rate-limit to ^6.11.2 (#736) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update dependency @tanstack/react-query to ^4.35.3 (#743) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency jest to ^29.7.0 (#744) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update dependency react-router-dom to ^6.16.0 (#747) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat(commerce): post-interaction checkout flow (#733) * Initial design for order confirmation page * Progress * More progress .. * Add orders worker * Finish checkout * Prevent multiple submissions * Address feedback * Address feedback * Address feedback * Refactor prepare method * Address feedback * Address feedback * chore(deps): update dependency @types/jest to ^29.5.5 (#752) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update dependency uuid to ^9.0.1 (#751) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update dependency express-rate-limit to v7 (#754) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency @types/react to v18.2.22 (#759) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update typescript-eslint monorepo to ^6.7.2 (#760) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency postcss to ^8.4.30 (#761) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update dependency sharp to ^0.32.6 (#762) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat(commerce): verify interaction hash and add polling mechanism (#763) * Hash verification * Finish polling mechanism * Format * Fix tests --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: xplicit <111863110+beniaminmunteanu@users.noreply.github.com> Co-authored-by: dragosp1011 <109967337+dragosp1011@users.noreply.github.com>
Context
Changes