Skip to content

fix: v1 api payments endpoint fix#16264

Merged
keithwillcode merged 5 commits intomainfrom
fix/v1-api-payments-validation
Aug 19, 2024
Merged

fix: v1 api payments endpoint fix#16264
keithwillcode merged 5 commits intomainfrom
fix/v1-api-payments-validation

Conversation

@alishaz-polymath
Copy link
Copy Markdown
Member

What does this PR do?

Fixes our V1 Payment endpoint which showed a mountain of zod errors. The endpoint works after this fix with relevant data returned from the endpoints

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • N/A
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

Just check the two endpoints and they should return error free valid response

Checklist

@linear
Copy link
Copy Markdown

linear Bot commented Aug 19, 2024

@vercel
Copy link
Copy Markdown

vercel Bot commented Aug 19, 2024

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

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Aug 19, 2024 2:37pm
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Aug 19, 2024 2:37pm

@github-actions github-actions Bot added api area: API, enterprise API, access token, OAuth Medium priority Created by Linear-GitHub Sync 🐛 bug Something isn't working labels Aug 19, 2024
@keithwillcode keithwillcode added core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO labels Aug 19, 2024
@alishaz-polymath alishaz-polymath marked this pull request as ready for review August 19, 2024 10:14
@alishaz-polymath alishaz-polymath removed the enterprise area: enterprise, audit log, organisation, SAML, SSO label Aug 19, 2024
import { _PaymentModel as Payment } from "@calcom/prisma/zod";

// FIXME: Payment seems a delicate endpoint, do we need to remove anything here?
export const schemaPaymentBodyParams = Payment.omit({ id: true });
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

There is no POST here, so we don't need this.

Comment on lines +3 to +12
export const schemaPaymentPublic = Payment.pick({
id: true,
amount: true,
success: true,
refunded: true,
fee: true,
paymentOption: true,
currency: true,
bookingId: true,
});
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Explicit properties pick

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Aug 19, 2024

@keithwillcode keithwillcode merged commit d73b841 into main Aug 19, 2024
@keithwillcode keithwillcode deleted the fix/v1-api-payments-validation branch August 19, 2024 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api area: API, enterprise API, access token, OAuth 🐛 bug Something isn't working core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO Medium priority Created by Linear-GitHub Sync ready-for-e2e

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CAL-2084] Payment API endpoint needs better error handling

3 participants