diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e82bb896..2c6bd6e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -167,113 +167,11 @@ jobs: - name: Lint run: pnpm lint - - e2e-tests: - name: End-to-End Testing (via Playwright) - runs-on: ubuntu-latest - strategy: - fail-fast: false - needs: build - env: - ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/wme-sitebuilder/tests/results/allure-report - ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/wme-sitebuilder/tests/results/allure-results - DEFAULT_TIMEOUT_OVERRIDE: 30000 - steps: - - name: Check Out Code - uses: actions/checkout@v3 - - - name: Setup pnpm - uses: pnpm/action-setup@v2.2.4 - with: - version: 7 - run_install: false - - - name: Setup Node.js Environment - uses: actions/setup-node@v3 - with: - node-version-file: '.nvmrc' - cache: 'pnpm' - - - name: Setup PHP, with Composer and Extensions - uses: shivammathur/setup-php@v2 - with: - tools: composer:v2 - php-version: '8.0' - - - name: Setup Problem Matchers for PHP - run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" - - - name: Prepare Node Modules Cache - id: cache-node-modules - uses: actions/cache@v3 - with: - path: '**/node_modules' - key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }} - - - name: Prepare Composer Dependencies Cache - uses: actions/cache@v3 - with: - path: | - ${{needs.build.outputs.composer-files-dir}} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer- - - # Install playwright's binary under custom directory to cache - - name: Set Playwright path (non-windows) - if: runner.os != 'Windows' - run: echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV - - name: Set Playwright path (windows) - if: runner.os == 'Windows' - run: echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV - - - name: Cache Playwright's binary - uses: actions/cache@v3 - with: - # Playwright removes unused browsers automatically - # So does not need to add playwright version to key - key: ${{ runner.os }}-playwright-bin-v1 - path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} - - - name: Install Dependencies - run: pnpm install --frozen-lockfile - - - name: Build - run: pnpm build - - - name: Install Playwright Dependencies - run: | - npx playwright install chromium --with-deps - - - name: Launch wp-env End-to-End Environment - working-directory: plugins/wme-sitebuilder - run: pnpm env:dev - - - name: Run Sitebuilder End-to-End tests - timeout-minutes: 15 - working-directory: plugins/wme-sitebuilder - run: pnpm test - - - name: Generate Playwright E2E Test Report - if: success() || failure() - working-directory: plugins/wme-sitebuilder - run: pnpm exec allure generate --clean ${{ env.ALLURE_RESULTS_DIR }} --output ${{ env.ALLURE_REPORT_DIR }} - - - name: Archive E2E Test Report - if: success() || failure() - uses: actions/upload-artifact@v3 - with: - name: ${{ env.E2E_ARTIFACT }} - path: | - ${{ env.ALLURE_RESULTS_DIR }} - ${{ env.ALLURE_REPORT_DIR }} - if-no-files-found: ignore - retention-days: 5 deploy: if: ${{ github.ref_name == 'main' || github.ref_name == '1.0-branch' || github.ref_name == '2.0-branch' }} name: Deploy to Test Sites - needs: [build, lint, e2e-tests] + needs: [build, lint] uses: ./.github/workflows/deploy.yml secrets: ssh-key: ${{ secrets.SITEBUILDER_SSH_PRIVATE_KEY }} diff --git a/.github/workflows/split.yml b/.github/workflows/split.yml index 11ddb0c0..e13c24fd 100644 --- a/.github/workflows/split.yml +++ b/.github/workflows/split.yml @@ -10,7 +10,7 @@ on: - '*' env: - GITHUB_TOKEN: ${{ secrets.SPLIT_ACCESS_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }} jobs: packages_split: @@ -41,8 +41,8 @@ jobs: repository_name: '${{ matrix.package.split_repository }}' # ↓ the user signed under the split commit - user_name: "bswatson" - user_email: "bwatson@liquidweb.com" + user_name: "Tr1b0t" + user_email: "Tr1b0t@users.noreply.github.com" # with tag - @@ -59,5 +59,5 @@ jobs: repository_name: '${{ matrix.package.split_repository }}' # ↓ the user signed under the split commit - user_name: "bswatson" - user_email: "bwatson@liquidweb.com" + user_name: "Tr1b0t" + user_email: "Tr1b0t@users.noreply.github.com" diff --git a/plugins/wme-sitebuilder/wme-sitebuilder/Plugins/PaymentGateways/PayPal.php b/plugins/wme-sitebuilder/wme-sitebuilder/Plugins/PaymentGateways/PayPal.php index 677d4dfb..dcc55635 100644 --- a/plugins/wme-sitebuilder/wme-sitebuilder/Plugins/PaymentGateways/PayPal.php +++ b/plugins/wme-sitebuilder/wme-sitebuilder/Plugins/PaymentGateways/PayPal.php @@ -2,6 +2,7 @@ namespace Tribe\WME\Sitebuilder\Plugins\PaymentGateways; +use Exception; use Tribe\WME\Sitebuilder\Plugins\Plugin; /** @@ -134,20 +135,31 @@ public function action__woocommerce_paypal_payments_built_container( $container return; } - $onboarding = $container->get( 'onboarding.render' ); - $settings = $container->get( 'wcgateway.settings' ); - - $this->connected = ( $settings->has( 'client_id' ) && ! empty( $settings->get( 'client_id' ) ) ); - - $this->oauth_urls = [ - 'advanced' => $onboarding->get_signup_link( true, [ 'PPCP' ] ), - 'standard' => $onboarding->get_signup_link( true, [ 'EXPRESS_CHECKOUT' ] ), - ]; - - $this->keys = [ - 'email_address' => $settings->has( 'merchant_email_production' ) ? $settings->get( 'merchant_email_production' ) : '', - 'merchant_id' => $settings->has( 'merchant_id_production' ) ? $settings->get( 'merchant_id_production' ) : '', - 'client_id' => $settings->has( 'client_id_production' ) ? $settings->get( 'client_id_production' ) : '', - ]; + try { + /** @var \WooCommerce\PayPalCommerce\Onboarding\Render\OnboardingRenderer $onboarding */ + $onboarding = $container->get( 'onboarding.render' ); + /** @var \WooCommerce\PayPalCommerce\WcGateway\Settings\Settings $settings */ + $settings = $container->get( 'wcgateway.settings' ); + + $this->connected = ( $settings->has( 'client_id' ) && ! empty( $settings->get( 'client_id' ) ) ); + + $this->oauth_urls = [ + 'advanced' => $onboarding->get_signup_link( true, [ 'PPCP' ] ), + 'standard' => $onboarding->get_signup_link( true, [ 'EXPRESS_CHECKOUT' ] ), + ]; + + $this->keys = [ + 'email_address' => $settings->has( 'merchant_email_production' ) ? $settings->get( 'merchant_email_production' ) : '', + 'merchant_id' => $settings->has( 'merchant_id_production' ) ? $settings->get( 'merchant_id_production' ) : '', + 'client_id' => $settings->has( 'client_id_production' ) ? $settings->get( 'client_id_production' ) : '', + ]; + } catch ( Exception $e ) { + // Log to the same place WC PayPal Payments would. + $container->get( 'woocommerce.logger.woocommerce' )->error( $e->getMessage() ); + + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { + error_log( "[WME] WC PayPal Payments Plugin threw an exception: {$e->getMessage()} {$e->getFile()}:{$e->getLine()}" ); + } + } } }