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

🔥added webhook support #61

Merged
merged 2 commits into from
Nov 13, 2023
Merged

Conversation

msalbrain
Copy link
Contributor

@msalbrain msalbrain commented Nov 12, 2023

Description

  • I updated model and sql schema to accommodate payment_webhook_url
  • I updated entire codebase to allow for use of new payment_webhook_url
  • added payment_webhook_url field to admin setting form
  • made webhook call in on receiving checkout events

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Checklist:

  • I have performed a self-review of my own code

Comment on lines 132 to 147

if email.Valid {
cart.Email = email.String
}

if name.Valid {
cart.Name = name.String
}

if paymentID.Valid {
cart.PaymentID = paymentID.String
}

if updated.Valid {
cart.Updated = updated.Int64
}
Copy link
Owner

Choose a reason for hiding this comment

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

I think that validating data from the database here is unnecessary.
By logic - when we write data to the database, we validate them, and they should return already valid.

log.Println(err)
}

if res.Status != "200 OK" {
Copy link
Owner

Choose a reason for hiding this comment

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

may be use

Suggested change
if res.Status != "200 OK" {
if res.StatusCode != 200 {

if err != nil {
log.Println(err)
}
if res.Status != "200 OK" {
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
if res.Status != "200 OK" {
if res.StatusCode != 200 {

@shurco
Copy link
Owner

shurco commented Nov 13, 2023

@msalbrain, good job!
You did what I wrote about #51

log.Println(err)
}

if res.Status != "200 OK" {
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
if res.Status != "200 OK" {
if res.StatusCode != 200 {

@msalbrain msalbrain changed the title added webhook support 🔥added webhook support Nov 13, 2023
@shurco shurco merged commit c6f19b2 into shurco:main Nov 13, 2023
2 of 3 checks passed
@msalbrain
Copy link
Contributor Author

Thank you very much

@coderofsalvation
Copy link

coderofsalvation commented Jul 23, 2024

looks cool!
Is this a webhook after a payment provider has been triggered.
Or can the webhook act as payment provider (#84)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants