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

Add functions for capturing, refunding, voiding programmatically #1262

Merged
merged 12 commits into from
Mar 22, 2023

Conversation

AlexP11223
Copy link
Contributor

Resolves #590

Adds ppcp_* global functions for capturing, refunding, voiding, and also for retrieving PayPal order since it may be needed for deciding whether to perform these operations (like we do in RefundProcessor).

Also now there is an easier way to retrieve the app container: PPCP::container(). But as before, using it may not be the best approach for third-party developers because we do not guarantee the backward compatibility.

I am not sure if ppcp is the prefix that we should use, since it has no relation to the plugin name. It probably refers to PayPal Commerce Platform which seems suitable, but not mentioned in the plugin description etc. In our filters/hooks there is no consistent prefix currently.

@AlexP11223 AlexP11223 requested a review from Dinamiko March 17, 2023 10:46
}

/**
* Captures the PayPal order.
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems here Refunds instead of Captures.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@AlexP11223
Copy link
Contributor Author

The refund ID now is not added to meta during ppcp_refund_order, and the function returns it.

This way the refund can be added to WC by webhooks, if the meta does not contain the ID yet.

(for normal refund on both sides there is wc_refund_payment)

@Dinamiko Dinamiko modified the milestone: 2.0.4 Mar 22, 2023
@Dinamiko Dinamiko merged commit 039017e into trunk Mar 22, 2023
@Dinamiko Dinamiko deleted the PCP-506-api branch March 22, 2023 11:38
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.

programmatically capturing/voiding authorized payments (506)
2 participants