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

Fix/phone validation #230

Merged
merged 4 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/php-unit-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
steps:
# Checkout the repository
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

# PHP setup
- name: Setup PHP ${{ matrix.php }}
Expand All @@ -37,22 +37,22 @@ jobs:

# Use node version from .nvmrc
- name: Setup NodeJS
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'

# Cache composer dependencies
- name: Cache composer dependencies
id: composer-cache
uses: actions/cache@v3
uses: actions/cache@v1
with:
path: ./vendor
key: ${{ runner.os }}-vendor-${{ hashFiles('composer.lock') }}

# Cache node dependencies
- name: Cache node dependencies
id: node-cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ./node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }}
Expand All @@ -76,7 +76,7 @@ jobs:
# Prepare test environment
- name: Prepare test environment
run: |
bash tests/bin/install-phpunit-tests-dependencies.sh wc_apa_test root root 127.0.0.1 latest
bash tests/bin/install-phpunit-tests-dependencies.sh wc_apa_test root root 127.0.0.1 latest ${{ matrix.php }}

# Run tests
- name: Run tests
Expand Down
3 changes: 2 additions & 1 deletion src/js/payments-methods/classic/_payment-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ const AmazonPayBtn = ( props ) => {
return true;
}
const shippingPhone = document.getElementById( 'shipping-phone' );
const billingPhone = document.getElementById( 'phone' );
const billingPhone = document.getElementById( 'billing-phone' );

if ( ! shippingPhone?.value && ! billingPhone?.value ) {
return {
type: 'error',
Expand Down
10 changes: 8 additions & 2 deletions tests/bin/install-phpunit-tests-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ DB_USER=$2
DB_PASS=$3
DB_HOST=${4-localhost}
WP_VERSION=${5-latest}
PHP_VERSION=$6

TMPDIR=${TMPDIR-/tmp}
TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//")
Expand Down Expand Up @@ -62,9 +63,14 @@ install_wp() {
}

install_woocommerce() {
WC_VERSION=$(curl https://api.wordpress.org/plugins/info/1.0/woocommerce.json | jq -r '.version')
if [ $PHP_VERSION = "7.3" ]; then
WC_VERSION="8.4.0"
echo "Warning: WooCommerce $WC_VERSION is the latest version compatible with PHP7.3"
else
WC_VERSION=$(curl https://api.wordpress.org/plugins/info/1.0/woocommerce.json | jq -r '.version')
fi

echo "Installing WooCommerce $WC_VERSION"
echo "Installing WooCommerce $WC_VERSION on PHP $PHP_VERSION"
cd -
download https://downloads.wordpress.org/plugin/woocommerce.$WC_VERSION.zip ../woocommerce.zip
unzip -o -qq ../woocommerce.zip -d ../
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
function _manually_load_plugin() {
$_plugin_dir = dirname( __FILE__ ) . '/../../';

require_once $_plugins_dir . '../woocommerce/woocommerce.php';
require_once $_plugin_dir . '../woocommerce/woocommerce.php';

require_once $_plugin_dir . 'woocommerce-gateway-amazon-payments-advanced.php';
require_once $_plugin_dir . 'includes/class-wc-gateway-amazon-payments-advanced-abstract.php';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class WC_Mocker_Gateway_Amazon_Payments_Advanced extends WC_Gateway_Amazon_Payme
*
* @param int|string $order_total The order total to be set.
*/
public function __construct( int|string $order_total = 50 ) {
public function __construct( $order_total = 50 ) {
$this->settings = WC_Amazon_Payments_Advanced_API::get_settings();

self::$order_total = $order_total;
Expand Down
Loading