diff --git a/assets/css/admin.css b/assets/css/admin.css
index 970118eca2c..5638c93d022 100644
--- a/assets/css/admin.css
+++ b/assets/css/admin.css
@@ -139,6 +139,10 @@
background-image: url( '../images/payment-methods/klarna.svg' );
}
+.payment-method__brand--grabpay {
+ background-image: url( '../images/payment-methods/grabpay.svg' );
+}
+
.wc_gateways tr[data-gateway_id='woocommerce_payments'] .payment-method__icon {
border: 1px solid #ddd;
border-radius: 2px;
diff --git a/changelog/add-grabpay-checkout b/changelog/add-grabpay-checkout
new file mode 100644
index 00000000000..baba56b2235
--- /dev/null
+++ b/changelog/add-grabpay-checkout
@@ -0,0 +1,4 @@
+Significance: minor
+Type: add
+
+Implement checkout for GrabPay payments.
diff --git a/includes/class-wc-payments-order-success-page.php b/includes/class-wc-payments-order-success-page.php
index 26f3791dda6..a892771e456 100644
--- a/includes/class-wc-payments-order-success-page.php
+++ b/includes/class-wc-payments-order-success-page.php
@@ -181,7 +181,7 @@ public function show_lpm_payment_method_name( $gateway, $payment_method ) {
ob_start();
?>
-
![<?php echo esc_attr( $payment_method->get_title() ); ?>](<?php echo esc_url_raw( $method_logo_url ); ?>)
+
assertSame( $method_name, $result );
}
- public function test_show_woopay_payment_method_name_order_with_woopay_meta() {
- $order = WC_Helper_Order::create_order();
- $order->add_meta_data( 'is_woopay', true );
- $order->add_meta_data( 'last4', '1234' );
- $order->set_payment_method( 'woocommerce_payments' );
- $order->save();
+ public function test_show_lpm_payment_method_name() {
+ $gateway = $this->createMock( WC_Payment_Gateway_WCPay::class );
+ $gateway->method( 'get_account_country' )->willReturn( 'SG' );
+
+ $payment_method = $this->createMock( UPE_Payment_Method::class );
+ $payment_method->method( 'get_title' )->willReturn( 'GrabPay' );
+ $payment_method->method( 'get_id' )->willReturn( 'grabpay' );
+ $payment_method->method( 'get_payment_method_icon_for_location' )->willReturn( '/grabpay.svg' );
+
+ $result = $this->payments_order_success_page->show_lpm_payment_method_name( $gateway, $payment_method );
+
+ $this->assertStringContainsString( 'wc-payment-gateway-method-logo-wrapper', $result );
+ $this->assertStringContainsString( 'alt="GrabPay"', $result );
+ $this->assertStringContainsString( 'title="GrabPay"', $result );
+ $this->assertStringContainsString( 'src="/grabpay.svg"', $result );
+ }
+
+ public function test_show_lpm_payment_method_name_icon_not_found() {
+ $gateway = $this->createMock( WC_Payment_Gateway_WCPay::class );
+ $gateway->method( 'get_account_country' )->willReturn( 'SG' );
+
+ $payment_method = $this->createMock( UPE_Payment_Method::class );
+ $payment_method->method( 'get_title' )->willReturn( 'GrabPay' );
+ $payment_method->method( 'get_id' )->willReturn( 'grabpay' );
+ $payment_method->method( 'get_payment_method_icon_for_location' )->willReturn( '' );
- add_filter( 'woocommerce_is_order_received_page', '__return_true' );
- $result = $this->payments_order_success_page->show_woocommerce_payments_payment_method_name( 'Credit card', $order );
- remove_filter( 'woocommerce_is_order_received_page', '__return_true' );
+ $result = $this->payments_order_success_page->show_lpm_payment_method_name( $gateway, $payment_method, true );
- $this->assertStringContainsString( 'wc-payment-gateway-method-logo-wrapper woopay', $result );
- $this->assertStringContainsString( 'img alt="WooPay"', $result );
- $this->assertStringContainsString( sprintf( 'Card ending in %s', $order->get_meta( 'last4' ) ), $result );
+ $this->assertFalse( $result );
}
}