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

feat(dashboard,core-flows,js-sdk,types,link-modules,payment): ability to copy payment link #8630

Merged
merged 9 commits into from
Aug 20, 2024

Conversation

riqwan
Copy link
Contributor

@riqwan riqwan commented Aug 16, 2024

what:

  • enables a button to create a payment link when a payment delta is present
  • api to delete order payment collection
  • adds a pending amount to payment collections

Note: Not the happiest with the decision on when to create a payment collection and when not to. The code should programatically create or delete payment collections currently to generate the right collection for the payment delta. Adding a more specific flow to create and manage a payment collection will help reduce this burden from the code path and onto CX/merchant.

Another issue I found is that the payment collection status doesn't get updated when payment is complete as it still gets stuck to "authorized" state

payment.mp4

Copy link

changeset-bot bot commented Aug 16, 2024

⚠️ No Changeset found

Latest commit: 8b55130

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Aug 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
medusa-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 20, 2024 10:17am
6 Skipped Deployments
Name Status Preview Comments Updated (UTC)
api-reference ⬜️ Ignored (Inspect) Aug 20, 2024 10:17am
api-reference-v2 ⬜️ Ignored (Inspect) Visit Preview Aug 20, 2024 10:17am
docs-ui ⬜️ Ignored (Inspect) Visit Preview Aug 20, 2024 10:17am
docs-v2 ⬜️ Ignored (Inspect) Visit Preview Aug 20, 2024 10:17am
medusa-docs ⬜️ Ignored (Inspect) Visit Preview Aug 20, 2024 10:17am
resources-docs ⬜️ Ignored (Inspect) Visit Preview Aug 20, 2024 10:17am

@riqwan riqwan marked this pull request as ready for review August 16, 2024 14:09
@riqwan riqwan requested a review from a team as a code owner August 16, 2024 14:09
@@ -103,12 +103,12 @@ export default class PaymentCollection {
payment_providers = new Collection<Rel<PaymentProvider>>(this)

@OneToMany(() => PaymentSession, (ps) => ps.payment_collection, {
cascade: [Cascade.PERSIST, "soft-remove"] as any,
cascade: [Cascade.PERSIST] as any,
Copy link
Contributor Author

@riqwan riqwan Aug 16, 2024

Choose a reason for hiding this comment

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

unfortunately had to remove this from the cascade as its causing an ambiguity in the SQL generated as both payment session and payment have the same column called "payment_collection_id". The MikroORM util does not specify which columns to generate, thereby dumping both columns in the query causing this issue.

Copy link

gitguardian bot commented Aug 18, 2024

⚠️ GitGuardian has uncovered 3 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
1627328 Triggered Generic Password 52dd2ec integration-tests/http/tests/user/admin/user.spec.ts View secret
1627328 Triggered Generic Password 52dd2ec integration-tests/http/tests/user/admin/user.spec.ts View secret
1627328 Triggered Generic Password 52dd2ec integration-tests/http/tests/user/admin/user.spec.ts View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@olivermrbl
Copy link
Contributor

olivermrbl commented Aug 18, 2024

Upon capturing the payment, the "Copy payment link" button should disappear. However, it currently requires a full page refresh. Even though the amounts correctly change.

To reproduce:

  • Place an order
  • Capture payment
  • Notice the payment collection still rendering
  • Refresh page
  • Notice the payment collection no longer rendering

CleanShot 2024-08-18 at 17 42 50

@@ -96,45 +100,61 @@ export const OrderSummarySection = ({ order }: OrderSummarySectionProps) => {
return false
}, [reservations])

// TODO: We need a way to link payment collections to a change order to
Copy link
Contributor

Choose a reason for hiding this comment

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

thought: Could the link have an additional column type or something like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, we can do that


throwUnlessStatusIsNotPaid({ paymentCollection })

removeRemoteLinkStep({
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Shouldn't we delete the actual payment collection as well? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The link has cascade enabled in this PR that should take care of deleting the payment collection

Screenshot 2024-08-19 at 20 03 39

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I missed that – that's neat!

@kodiakhq kodiakhq bot merged commit fa44e3f into develop Aug 20, 2024
22 of 23 checks passed
@kodiakhq kodiakhq bot deleted the feat/payments branch August 20, 2024 10:30
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