-
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
Merge develop into poc/upe instances multiplied #5082
Merge develop into poc/upe instances multiplied #5082
Conversation
This reverts commit 380fd62.
This reverts commit ce1067c.
* add authorizations endpoint controller * add new controller to path * add new functions to pull data from server * add tests for authorizations * fix small typo in transactions test description * add type to function params * add changelog * Strict check in test using assertSame * add strict types to functions * Inline error code in test
* Add KYC additional info modal and notice banner * Fix for the button link styling * Fixes to the modal styling and open/close logic * Remove webpack files added in patch * revert change made for HMR accidentally added to this branch * Revert changes made to package files * Revert changes made to package files * Revert changes made to package files * Add changelog * Adding test for info modal * Remove unused variables * Styling updates to better match designs
* Prepare dependencies for HMR Update `@wordpress/dependency-extraction-webpack-plugin` to support react refresh extraction and install missing dependencies. * Split webpack config into shared, production, and development Adding HMR requires a bunch of settings that will clutter our settings, having them separated will make updates easier. * Add HMR webpack configuration Conditionally based on WEBPACK_SERVE from env * Load runtime script for both frontend and admin area To make HMR work while using multiple entries in the same page we need a single runtime. * Add `npm run hmr` command and instructions * Load runtime only on admin for now * Add changelog entry * Update package lock to v2 * Add more details to the `md` file Co-authored-by: Dat Hoang <htdat@users.noreply.github.com>
Co-authored-by: Dan Paun <dan.paun@automattic.com>
* Added code to declare WCPay incompatible with COT Co-authored-by: Jessy P <jessy.pappachan@automattic.com>
…4929) * Pass the 'woocommerce_tax_display_cart' option from the merchant's store to WooPay * Add changelog entry
* Add StripeLink set up note to WooCommerce inbox
This reverts commit 6dba845.
* Adding manual option to deposit schedule selection * Polish deposits settings radio UI. * Lower case 'deposits'. * Changelog for manual deposits setting. * Unit test for automatic and manual deposit radios. * Add manual deposits confirmation modal. * Update modal styles. * Add dynamic minimum deposit amount. * Rework the deposit schedule settings as per the recent design changes. * Fix tests. * Additional design changes * Update changelog entry. Co-authored-by: Shendy Kurnia <shendy.kurnia@a8c.com> Co-authored-by: James Allan <james.allan@automattic.com> Co-authored-by: Chris Aprea <chris.aprea@automattic.com> Co-authored-by: Chris Aprea <aprea@users.noreply.github.com> Co-authored-by: Shendy <73803630+shendy-a8c@users.noreply.github.com>
* Add event when skipped the platform checkout * Add changelog entry
* Switch to @woocommerce/dependency-extraction-webpack-plugin From @wordpress/dependency-extraction-webpack-plugin and remove any `@woocommerce/*` entry from the configuration. * Update renovate documentation * Add changelog entry
* Drop IE11 support Updating @wordpress/browserslist-config to the latest version * Add changelog entry
* Drop IE11 support Updating @wordpress/browserslist-config to the latest version * Add changelog entry * Remove unnecessary babel plugins After dropping IE11 as a target we don't need them anymore. * Remove `.babelrc` as we're using `babel.config.js` * Add changelog entry
* Create a custom ESLint rule to prevent the import of whole Gridicons * Update gridicons TS declaration And move it to a new file in the root of client, as it is not tied to `deposits-information` * Replace every full gridicons import with individual ones * Update affected test snapshots Mocking icons components to make it clear * Add changelog entry
* Update lodash to version 4.17.21 * Add changelog
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.
There were about ten trillion files changed here, so I tried my best to focus on the most important ones. 😅 This was truly a rhinocerous-sized refactor, so nice one resolving all these changes as best as you could!
In general, I think everything is fine here. I've left a few comments, but almost all of them are pretty inconsequential. I did encounter a few new errors, but I'll describe them below and I think almost all can be moved to new issues.
Let me just get into it, by stepping through your testing instructions one-by-one.
1. Ensure that the classic UPE checkout works as expected with both the legacy card and UPE elements.
Using the shortcode checkout, I tested the following with both the non-UPE card gateway and other UPE gateways.
- Standard checkout
- Failed checkout
- Checkout while saving payment method
- Checkout with saved payment method
- Checkout with card requiring 3DS authentication
...And all of the above, appeared to be working normally for me! Huzzah.
2. Ensure that the non-UPE checkout works as expected (turn off UPE in the admin panel).
Since the non-UPE card gateway was working properly in the previous tests, I wasn't expecting there to be much difference with the UPE disabled. Nonetheless, without testing as many flows as in the previous step, I did test the basic regular shortcode and blocks flows and discovered that the shortcode checkout appeared to be working as expected (🎉), while the blocks checkout was not working at all, which leads neatly into the next section.
3. Ensure that blocks checkout works for split UPE elements. (please see the note right above the testing instructions).
The legacy non-UPE gateway appeared broken for me. I was able to checkout with a saved payment method, but could not complete a blocks checkout using a new credit card. I don't think this is related to the issues I raised here, as you might have opined.
Digging a little further I found that the following error was returned to the checkout.
Error: You passed an empty string for 'payment_method_types[0]'. We assume empty values are an attempt to unset a parameter; however 'payment_method_types[0]' cannot be unset. You should remove 'payment_method_types[0]' from your request or supply a non-empty value.
I believe this error refers to this parameter, which @mdmoore also grappled with while resolving the saved payment method functionality. I'm not entirely sure how this occurred, but checking my error logs, this payment_method_types
parameter was filled with a single empty string in our request to Stripe.
2022-11-15T01:30:42+00:00 INFO REQUEST POST https://public-api.wordpress.com/wpcom/v2/sites/%s/wcpay/intentions
2022-11-15T01:30:42+00:00 INFO HEADERS: array (
'Content-Type' => 'application/json; charset=utf-8',
'User-Agent' => 'WooCommerce Payments/5.0.1',
'Idempotency-Key' => '3afc322e-7bad-4b22-89b8-1c1c8e33866c',
)
2022-11-15T01:30:42+00:00 INFO BODY: array (
'test_mode' => true,
'amount' => 2779,
'currency' => 'eur',
'payment_method' => 'pm_1M4Dz12H1rYvbvjIUQiWe4Us',
'customer' => 'cus_LXS3WAVT5O8VZT',
// ...
'description' => 'Online Payment for Order #244 for fangedparakeet.jurassic.tube blog_id 191029001',
'payment_method_types' =>
array (
0 => '',
),
'is_platform_payment_method' => false,
)
I'm pretty sure this is a new issue, but I'm happy to resolve this in a separate issue, because it does seem that something uniquely unusual is afoot here.
For the rest, I believe things were working similarly to my experiences noted here. I was able to complete a checkout with a new UPE payment method and a saved non-UPE payment method, but not a saved UPE payment method. There is already an issue to resolve this limitation, so I'm happy to ignore that here.
4. Ensure that SEPA tokens are managed as expected
Everything here seemed to be in proper working order! I wasn't really expecting anything here to go up in flames, but from the shortcode checkout and the My Account pages, managing SEPA tokens seemed to be doing it was supposed to.
Those are my thoughts, let me know if you have any immediate comments! I am still approving this PR, because I think the main refactor is fine! The only real issue is using cards in the blocks checkout, but, as stated before, more than happy to resolve that elsewhere.
I think it could be beneficial to also add some more comprehensive confidence checking to checkouts from the Order Pay page, Subscriptions--especially free-trial subscriptions, that rely on setup intents rather than payment intents--and combinations of these two checkout flows, since there are a few uncertainties surrounding these areas that I've raised in separate comments. That being said, I think these examinations can be done another day and I'm eager to catch up with the elusive develop
branch in the meantime.
Great work, @timur27! For the most part, LGTM. 👍
…ts in an unsynced subscription (#5133) * Bump subscriptions core version to 2.5.2 * add changelog entry
Thanks for the review, @FangedParakeet!
To be more specific, I was referring to this paragraph. Before making this PR ready for the review, I was able to make the use case with a new credit card work by rolling back the change for this line of code. So, when I provide
instead of
To the |
You would first have to change the return value of Also, I just noticed one more thing! (Sorry.) In this merge branch, for some reason, the WCPay gateway seems to have disappeared from the main WC Payments Settings screen (WooCommerce > Settings > Payments > All payment methods). It's still there on both the If you think there's a quick fix for this, let me know: otherwise I'll create a new issue to resolve this missing method, once you've completed this merge. Also, we had some discussion above about the gateway description field: I just noticed that these description values are actually incorrect in our PoC branch (see above screenshot). I'll create a new issue to fix this as well shortly... |
Thanks for another round of review, @FangedParakeet ! I fixed the failing test (a4222e7) and the hidden card gateway in the admin panel (1bebfee). |
…ayments into merge-develop-into-poc/upe-instances-multiplied
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.
LGTM! I think pretty much everything pending from here has an open issue already ready to capture further remaining work--if not, please feel free to pop any open, if I missed anything!
Otherwise let's get this merged and finally get our branch up to date.
Description in progress
Fixes #5109
Changes proposed in this Pull Request
Merge the latest changes from
develop
and ensure, thatpoc/upe-instances-multiplied
with all the changes on it are stable.#4850 is the PR that affects our split UPE implementation. With this refactor, we now have two new classes, which represent the checkout -
WC_Payments_Checkout
andWC_Payments_UPE_Checkout
. These classes are encapsulating the UI field rendering.Following commits are introduced besides the regular merging and conflict resolving:
Minor fixes without any logic change
Minor | fixes | to avoid regression
Fixing | tests | suite
Resolving conflicts and ensuring tests pass after both token behavior was corrected and the logic for LINK tokens was updated.⚠️ There is an additional logic introduced, basically a copy-paste from the SEPA tokes behavior. We need to make sure, that tokens for LINK are still working as expected. I think we can do it after #4720.
Initializing payment checkouts in
class-wc-payments
to reflect the latest changes fromdevelop
which introduceWC_Payments_Checkout
andWC_Payments_UPE_Checkout
classes.15f08c7 to let the
WC_Payments_UPE_Checkout
store the list of payment gateways to reflect the split UPE work and be able to render the UI for each split payment method.WC_Payments_Checkout
andWC_Payments_UPE_Checkout
are now responsible for rendering the UI for a gateway. Since the refactor was done before the UPE split, it takes a single method into the account even forWC_Payments_UPE_Checkout
.The current logic of rendering gateways on
develop
(after the refactor, but before this PR) keeps the gateway in the checkout object. So, when UPE is turned on,WC_Payments_UPE_Checkout
with the$card_gateway
is being initialized and when the time comes, the$card_gateway
is being successfully rendered byWC_Payments_UPE_Checkout
as a single payment element with all the bits and pieces inside of it.Our mission was to use this brand new checkout class in order to render all the registered payment methods, which are now represented by a group of split payments, instead of only
$card_gateway
.There were multiple options to achieve this. First of all, we could create a
WC_Payments_UPE_Checkout
object for each gateway. In practice, with ten methods available, doing this seems not optimal. I think that the reason for the refactor was to abstract the payment fields UI rendering part to a separate class, and with the approach I describe, we would multiply the class with the same purpose ten times and use the memory without any meaningful reason.Another option was to ensure, that only one instance of the
WC_Payments_UPE_Checkout
is created, and each $gateway provides itself as a callback parameter of the action hook in this place. Then, we could set the$gateway
in the checkout class and use it while rendering. However, this approach most probably leads to the violation of Liskov substitution principle, sincepayment_fields()
method's definition will be updated by adding a new parameter ($gateway
). We then would need toset_gateway
in thepayment_fields()
method and thus change the state of the class. All this seemed a bit "unusual" to me.Finally, I went with the approach, which allows us to store all the payment gateways in the
WC_Payments_UPE_Checkout
class. When rendering the payment fields, we invoke the callback from a newwc_payments_set_gateway
hook I added and then proceed with the regular flow. This allowed us to keep the purpose of theWC_Payments_UPE_Checkout
class by creating only one instance of it, and at the same time, made the operation of setting the gateway loosely coupled with the object itself (if$gateway
won't be set, then$card_gateway
Stripe element will be used).Another thing worth mentioning is, that the non-UPE checkout should be initialized even when we are dealing with the UPE setup, since it defines the hook which is crucial for the legacy card to be rendered properly. This is why it's initialized regardless of wether users have UPE turned on or not.
Testing instructions
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. (was not needed, since the PR will be merged to the feature branch).Post merge