mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Fix return subscription plan id
This commit is contained in:
parent
62364d1e84
commit
bdc69a6fc6
3 changed files with 16 additions and 1 deletions
|
@ -7,6 +7,9 @@ AUTHORIZATION="Bearer ABC123"
|
||||||
WP_MERCHANT_USER="admin"
|
WP_MERCHANT_USER="admin"
|
||||||
WP_MERCHANT_PASSWORD="admin"
|
WP_MERCHANT_PASSWORD="admin"
|
||||||
|
|
||||||
|
WP_CUSTOMER_USER="customer"
|
||||||
|
WP_CUSTOMER_PASSWORD="password"
|
||||||
|
|
||||||
CUSTOMER_EMAIL="customer@example.com"
|
CUSTOMER_EMAIL="customer@example.com"
|
||||||
CUSTOMER_PASSWORD="password"
|
CUSTOMER_PASSWORD="password"
|
||||||
|
|
||||||
|
|
|
@ -1361,7 +1361,7 @@ class SmartButton implements SmartButtonInterface {
|
||||||
assert( $product instanceof WC_Product );
|
assert( $product instanceof WC_Product );
|
||||||
|
|
||||||
if ( $product->get_type() === 'subscription' && $product->meta_exists( 'ppcp_subscription_plan' ) ) {
|
if ( $product->get_type() === 'subscription' && $product->meta_exists( 'ppcp_subscription_plan' ) ) {
|
||||||
return $product->get_meta( 'ppcp_subscription_plan' );
|
return $product->get_meta( 'ppcp_subscription_plan' )->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@ const {test, expect} = require('@playwright/test');
|
||||||
const {
|
const {
|
||||||
WP_MERCHANT_USER,
|
WP_MERCHANT_USER,
|
||||||
WP_MERCHANT_PASSWORD,
|
WP_MERCHANT_PASSWORD,
|
||||||
|
WP_CUSTOMER_USER,
|
||||||
|
WP_CUSTOMER_PASSWORD,
|
||||||
AUTHORIZATION
|
AUTHORIZATION
|
||||||
} = process.env;
|
} = process.env;
|
||||||
|
|
||||||
|
@ -15,6 +17,16 @@ async function loginAsAdmin(page) {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function loginAsCustomer(page) {
|
||||||
|
await page.goto('/wp-admin');
|
||||||
|
await page.locator('input[name="log"]').fill(WP_CUSTOMER_USER);
|
||||||
|
await page.locator('input[name="pwd"]').fill(WP_CUSTOMER_PASSWORD);
|
||||||
|
await Promise.all([
|
||||||
|
page.waitForNavigation(),
|
||||||
|
page.locator('text=Log In').click()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
test.describe.serial('Merchant', () => {
|
test.describe.serial('Merchant', () => {
|
||||||
const title = (Math.random() + 1).toString(36).substring(7);
|
const title = (Math.random() + 1).toString(36).substring(7);
|
||||||
let product_id = '';
|
let product_id = '';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue