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

Implement GrabPay at Checkout #10336

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open

Conversation

danielmx-dev
Copy link
Contributor

@danielmx-dev danielmx-dev commented Feb 7, 2025

Fixes #10101

Changes proposed in this Pull Request

In #10100, by adding GrabPay to some of the existing files related to Payment Methods, it became automatically integrated into checkout.

This PR will focus on making sure the whole Checkout flow is satisfactory, as well as other aspects like the Edit Order and Transactions pages for admins.

Regarding Automated Testing: Most additions to support checkout are just including GrabPay in a new list/map of items since the functionality to support redirect payment methods was already implemented, most functionality is covered by existing tests.

Testing instructions

Pre-requisite: follow the instructions defined in the following server PR to enable GrabPay payments locally 7231-gh-Automattic/transact-platform-server

  • Enable GrabPay in the WooPayments settings page.
  • Set the store currency to SGD.
  • Perform the following steps for both Shortcode and Blocks checkout.
  • Add any non-subscription product to the cart and go to checkout.
  • Use Singapore as the country for the billing and shipping address.
  • Validate that GrabPay is present in the Payment Method options:
Shortcode Blocks
Screenshot 2025-02-07 at 11 58 19 a m Screenshot 2025-02-07 at 11 59 01 a m
  • Place the order, you'll be redirect to the hosted Test Payment Page.

  • Authorize the Payment, you'll now be redirected to the Order Received page.

  • Validate that the correct payment method logo is shown, as well as the title and alt attributes in the image:
    image

  • Go to My Account > Orders and open the details of the last order.

  • Validate that the correct payment method name is listed:
    Screenshot 2025-02-07 at 12 57 39 p m

  • Go to WP Admin and open the last order.

  • Validate that the correct Payment Method is listed in the subheader:
    Screenshot 2025-02-07 at 12 05 19 p m

  • Open the transaction details and validate that the correct payment method icon is displayed.
    Screenshot 2025-02-07 at 12 15 33 p m

  • Open the transactions list and verify that the last transaction shows the correct payment method:
    Screenshot 2025-02-07 at 12 15 25 p m

Other Scenarios

  • Change the store currency to any currency other than SGD. GrabPay should no longer be available even if the customer country is set to Singapore at checkout.
  • Change the currency back to SGD but now change the Billing country to any country other than Singapore. GrabPay should no longer be available at checkout.
  • Disable GrabPay in the settings page, it should no longer be available at checkout.
  • After placing an order with GrabPay, when you are at the Test Payment Page, click on Fail payment, validate that you are back to the checkout page. Go to WP Admin and validate that the Order Status is set to Failed.

  • Run npm run changelog to add a changelog file, choose patch 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.
  • Covered with tests (or have a good reason not to test in description ☝️)
  • Tested on mobile (or does not apply)

Post merge

@danielmx-dev
Copy link
Contributor Author

@pierorocca Can you please validate the screenshots provided in the PR description and confirm that everything looks as expected? Thank you.

@botwoo
Copy link
Collaborator

botwoo commented Feb 7, 2025

Test the build

Option 1. Jetpack Beta

  • Install and activate Jetpack Beta.
  • Use this build by searching for PR number 10336 or branch name add/grabpay-checkout in your-test.site/wp-admin/admin.php?page=jetpack-beta&plugin=woocommerce-payments

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:

  • Latest commit: c9e9082
  • Build time: 2025-02-13 14:50:54 UTC

Note: the build is updated when a new commit is pushed to this PR.

Copy link
Contributor

github-actions bot commented Feb 7, 2025

Size Change: +30 B (0%)

Total Size: 1.29 MB

Filename Size Change
release/woocommerce-payments/assets/css/admin.css 1.39 kB +9 B (+1%)
release/woocommerce-payments/assets/css/admin.rtl.css 1.39 kB +9 B (+1%)
release/woocommerce-payments/dist/index.js 233 kB +12 B (0%)
ℹ️ View Unchanged
Filename Size
release/woocommerce-payments/assets/css/success.css 189 B
release/woocommerce-payments/assets/css/success.rtl.css 190 B
release/woocommerce-payments/dist/blocks-checkout-rtl.css 2.67 kB
release/woocommerce-payments/dist/blocks-checkout.css 2.67 kB
release/woocommerce-payments/dist/blocks-checkout.js 55.3 kB
release/woocommerce-payments/dist/cart-block.js 17.2 kB
release/woocommerce-payments/dist/cart.js 5.73 kB
release/woocommerce-payments/dist/checkout-rtl.css 1.28 kB
release/woocommerce-payments/dist/checkout.css 1.28 kB
release/woocommerce-payments/dist/checkout.js 34.6 kB
release/woocommerce-payments/dist/express-checkout-rtl.css 236 B
release/woocommerce-payments/dist/express-checkout.css 236 B
release/woocommerce-payments/dist/express-checkout.js 15.7 kB
release/woocommerce-payments/dist/frontend-tracks.js 854 B
release/woocommerce-payments/dist/index-rtl.css 35.5 kB
release/woocommerce-payments/dist/index.css 35.5 kB
release/woocommerce-payments/dist/multi-currency-analytics.js 1.08 kB
release/woocommerce-payments/dist/multi-currency-rtl.css 4.29 kB
release/woocommerce-payments/dist/multi-currency-switcher-block.js 61.1 kB
release/woocommerce-payments/dist/multi-currency.css 4.29 kB
release/woocommerce-payments/dist/multi-currency.js 59.1 kB
release/woocommerce-payments/dist/order-rtl.css 740 B
release/woocommerce-payments/dist/order.css 740 B
release/woocommerce-payments/dist/order.js 42.5 kB
release/woocommerce-payments/dist/payment-gateways-rtl.css 1.34 kB
release/woocommerce-payments/dist/payment-gateways.css 1.34 kB
release/woocommerce-payments/dist/payment-gateways.js 40.1 kB
release/woocommerce-payments/dist/plugins-page-rtl.css 386 B
release/woocommerce-payments/dist/plugins-page.css 386 B
release/woocommerce-payments/dist/plugins-page.js 20.1 kB
release/woocommerce-payments/dist/product-details-rtl.css 433 B
release/woocommerce-payments/dist/product-details.css 436 B
release/woocommerce-payments/dist/product-details.js 12.5 kB
release/woocommerce-payments/dist/settings-rtl.css 12 kB
release/woocommerce-payments/dist/settings.css 11.9 kB
release/woocommerce-payments/dist/settings.js 229 kB
release/woocommerce-payments/dist/subscription-edit-page.js 703 B
release/woocommerce-payments/dist/subscription-product-onboarding-modal-rtl.css 524 B
release/woocommerce-payments/dist/subscription-product-onboarding-modal.css 524 B
release/woocommerce-payments/dist/subscription-product-onboarding-modal.js 20.2 kB
release/woocommerce-payments/dist/subscription-product-onboarding-toast.js 730 B
release/woocommerce-payments/dist/subscriptions-empty-state-rtl.css 120 B
release/woocommerce-payments/dist/subscriptions-empty-state.css 120 B
release/woocommerce-payments/dist/subscriptions-empty-state.js 19.3 kB
release/woocommerce-payments/dist/tokenized-express-checkout-rtl.css 236 B
release/woocommerce-payments/dist/tokenized-express-checkout.css 236 B
release/woocommerce-payments/dist/tokenized-express-checkout.js 16.6 kB
release/woocommerce-payments/dist/tos-rtl.css 235 B
release/woocommerce-payments/dist/tos.css 235 B
release/woocommerce-payments/dist/tos.js 21.8 kB
release/woocommerce-payments/dist/woopay-direct-checkout.js 6.13 kB
release/woocommerce-payments/dist/woopay-express-button.js 23.3 kB
release/woocommerce-payments/dist/woopay-rtl.css 4.31 kB
release/woocommerce-payments/dist/woopay.css 4.28 kB
release/woocommerce-payments/dist/woopay.js 71 kB
release/woocommerce-payments/includes/subscriptions/assets/css/plugin-page.css 625 B
release/woocommerce-payments/includes/subscriptions/assets/js/plugin-page.js 814 B
release/woocommerce-payments/vendor/automattic/jetpack-assets/build/i18n-loader.js 2.46 kB
release/woocommerce-payments/vendor/automattic/jetpack-assets/build/jetpack-script-data.js 772 B
release/woocommerce-payments/vendor/automattic/jetpack-assets/src/js/i18n-loader.js 1.02 kB
release/woocommerce-payments/vendor/automattic/jetpack-assets/src/js/script-data.js 69 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/babel.config.js 163 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/identity-crisis.css 2.47 kB
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/identity-crisis.js 14.2 kB
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/identity-crisis.rtl.css 2.47 kB
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-connection.css 10 kB
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-connection.js 28.4 kB
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-connection.rtl.css 10 kB
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-sso-admin-create-user.css 198 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-sso-admin-create-user.js 280 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-sso-admin-create-user.rtl.css 198 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-sso-login.css 625 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-sso-login.js 333 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-sso-login.rtl.css 626 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-sso-users.js 424 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/tracks-ajax.js 521 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/tracks-callables.js 585 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/src/sso/jetpack-sso-admin-create-user.css 215 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/src/sso/jetpack-sso-admin-create-user.js 521 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/src/sso/jetpack-sso-login.css 721 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/src/sso/jetpack-sso-login.js 412 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/src/sso/jetpack-sso-users.js 632 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/about.css 1.04 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/admin-empty-state.css 294 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/admin-order-statuses.css 408 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/admin.css 3.59 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/checkout.css 301 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/modal.css 746 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/view-subscription.css 574 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/wcs-upgrade.css 414 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/admin-pointers.js 543 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/admin.js 9.4 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/jstz.js 6.78 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/jstz.min.js 3.84 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/meta-boxes-coupon.js 545 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/meta-boxes-subscription.js 2.52 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/moment.js 22.2 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/moment.min.js 11.7 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/payment-method-restrictions.js 1.29 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/wcs-meta-boxes-order.js 507 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/frontend/payment-methods.js 358 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/frontend/single-product.js 428 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/frontend/view-subscription.js 1.38 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/frontend/wcs-cart.js 782 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/modal.js 1.09 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/wcs-upgrade.js 1.26 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/build/index.css 391 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/build/index.js 3.04 kB

compressed-size-action

@pierorocca
Copy link
Contributor

pierorocca commented Feb 7, 2025

  1. I believe we've been including brand logos in the order confirmation page and don't see that here?
    image

image

  1. The logo here in the expanded section is from Stripe correct?

image

@danielmx-dev
Copy link
Contributor Author

danielmx-dev commented Feb 10, 2025

Thanks for the feedback @pierorocca !

I believe we've been including brand logos in the order confirmation page and don't see that here?

Should we display only the logo or both the logo and text? e.g.
image

The logo here in the expanded section is from Stripe correct?

This is correct, the contents of that section are inside Stripe's iframe.

@pierorocca
Copy link
Contributor

Should we display only the logo or both the logo and text? e.g.

@danielmx-dev thanks for confirming the Stripe content. For the logo on order confirmation, I believe we've been using just logos but there are some issues:

The Logo is a bit small here and I can see there's extra white space in the logo causing the Visa portion to be too small.

image

Visa's SVG asset:
image

IIRC we didn't put the text because on this layout the text would wrap but on a vertical orientation it worked fine. I think with text is better if it doesn't create formatting issues.

image

@danielmx-dev
Copy link
Contributor Author

The Logo is a bit small here and I can see there's extra white space in the logo causing the Visa portion to be too small.

I'll take a look but this probably would need to be captured in a new issue.

IIRC we didn't put the text because on this layout the text would wrap but on a vertical orientation it worked fine. I think with text is better if it doesn't create formatting issues.

image

Can you please share which theme is this ?

I think with text is better if it doesn't create formatting issues.

Got it.

@pierorocca
Copy link
Contributor

Tsubaki theme is the one with the horizontal layout in desktop mode @danielmx-dev. proccaatomic.wpcomstaging.com

@danielmx-dev
Copy link
Contributor Author

Thanks @pierorocca

At least for that theme I tried several resolutions and didn't have any overflow issues:

image

image

image

However, there's no guarantee it'll look like that in 100% of the scenarios. If for some reason the size of that component were limited by the theme, it would look like this:

image

If it's a genuine concern, we could stick to just showing the name as you previously suggested.

@pierorocca
Copy link
Contributor

If it's a genuine concern, we could stick to just showing the name as you previously suggested.

It is as the Payment section has so little space to work with. The block template doesn't provide sufficient room. There'd be a lot more space if the cells weren't equally sized or if the payment info was moved to a different area in closer proximity to the billing information. As you mentioned, we'll take this up in a different issue (actually project for order confirmation).

Let's go ahead with the logo and ensure that we have alt-text applied.

@pierorocca
Copy link
Contributor

@yjailin FYI a data point for a future Order Confirmation block template redesign.

@danielmx-dev danielmx-dev marked this pull request as ready for review February 11, 2025 17:35
@danielmx-dev danielmx-dev requested review from a team and frosso and removed request for a team February 11, 2025 18:37
Copy link
Contributor

@frosso frosso left a comment

Choose a reason for hiding this comment

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

Changes look good and test well. A couple of questions:

  • The duplication of the show_lpm_payment_method_name()/show_payment_method_logo() methods
  • Should a mapping be created also in the client/payment-details/payment-method/index.js file to show any additional payment method details?

Comment on lines 87 to 90
if ( $payment_method->get_id() === Payment_Method::GRABPAY ) {
$output = $this->show_payment_method_logo( $gateway, $payment_method );
return false !== $output ? $output : $payment_method_title;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I see that the show_payment_method_logo() method was added, with an optional $show_payment_method_name argument - false by default.

But since show_payment_method_logo() is only used here, and since $show_payment_method_name will be false - what is the difference with the show_lpm_payment_method_name() method? Can we just use show_lpm_payment_method_name()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, we can re-use the existing function, I have updated the tests as well and included the title attribute so it displays the payment method name on hover.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, thank you! I like that this addition will also improve existing LPMs!

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.

Implement GrabPay at Checkout
4 participants