-
Notifications
You must be signed in to change notification settings - Fork 69
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/5669 add further payment metadata #7091
Conversation
Test the buildOption 1. Jetpack Beta
Option 2. Jurassic Ninja - available for logged-in A12s🚀 Launch a JN site with this branch 🚀 ℹ️ Install this Tampermonkey script to get more options. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
Size Change: 0 B Total Size: 1.4 MB ℹ️ View Unchanged
|
$gateway_type = 'classic'; | ||
} | ||
|
||
switch ( $order->get_created_via() ) { |
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.
Is this switch
statement really needed? Sending checkout
and store-api
to the server doesn't seem bad by itself. Also, even if something else happens, we'd never see unknown
.
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.
Good point. Fixed here: 8f1b3dd
@@ -1500,12 +1526,12 @@ protected function get_metadata_from_order( $order, $payment_type ) { | |||
|
|||
foreach ( $subscriptions as $subscription ) { | |||
if ( WC_Payments_Subscription_Service::is_wcpay_subscription( $subscription ) ) { | |||
$metadata['payment_context'] = 'wcpay_subscription'; | |||
$metadata['payment_context'] = 'wcpay_subscription'; |
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.
Notice how is_wcpay_subscription
is called here, and the whole section is only entered if ! $this->is_subscriptions_plugin_active()
. We need a separate block for standard subscriptions, one where 'recurring' === (string) $payment_type && $this->is_subscriptions_plugin_active()
.
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.
Addressed here: d1996ca
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.
Looks good, thank you for tacking this! I left a few comments.
Co-authored-by: Radoslav Georgiev <[email protected]>
Co-authored-by: Radoslav Georgiev <[email protected]>
Thank you for the comments. All comments have been addressed. |
$metadata['payment_context'] = 'regular_subscription'; | ||
|
||
// If the order belongs to a WCPay Subscription, set the payment context to 'wcpay_subscription' (this helps with associating which fees belong to orders). | ||
if ( $this->is_subscriptions_plugin_active() ) { |
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.
It's important to understand that WCPay/WooPayments subscriptions only work when the Subscriptions plugin is not active. When it is active, it's just regular subscriptions.
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.
Good point. Addressed here: d7d5636
Co-authored-by: Radoslav Georgiev <[email protected]>
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.
if ( $this instanceof UPE_Split_Payment_Gateway ) { | ||
$gateway_type = 'split_upe'; | ||
} elseif ( $this instanceof UPE_Payment_Gateway ) { | ||
$gateway_type = 'upe'; | ||
} else { | ||
$gateway_type = 'classic'; | ||
} |
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.
Late here, but I think we would consider another type of gateway called the Split-UPE-with-Deferred-Intent.
Context: paJDYF-9xf-p2
Fixes #5669
Changes proposed in this Pull Request
This PR adds more payment metadata for easier tracking, debugging, ... More info about what needs to be added can be found here: p1684514680519539-slack-C0208C3BXHP
Testing instructions
Test the following flow with on UPE, Split UPE and classic checkout
checkout_type
field is set toshortcode
,subscription_payment
is set to 'no',client_version
matches the current plugin version, andgateway_type
matched with the current payment gateway.checkout_type
field is set toshortcode
,subscription_payment
is set to 'initial' or 'renewal' (depends is subscription on renewal or brand new one),client_version
matches the current plugin version, andgateway_type
matched with the current payment gateway.checkout_type
field is set toblock
,subscription_payment
is set to 'no',client_version
matches the current plugin version, andgateway_type
matched with the current payment gateway.checkout_type
field is set toblock
,subscription_payment
is set to 'initial' or 'renewal' (depends is subscription on renewal or brand new one),client_version
matches the current plugin version, andgateway_type
matched with the current payment gateway.npm run changelog
to add a changelog file, choosepatch
to leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge