mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-31 06:52:50 +08:00
Add save payment methods module boilerplate
This commit is contained in:
parent
aa6c87b08d
commit
17b43ca182
13 changed files with 2425 additions and 0 deletions
|
@ -52,5 +52,13 @@ return function ( string $root_dir ): iterable {
|
||||||
$modules[] = ( require "$modules_dir/ppcp-saved-payment-checker/module.php" )();
|
$modules[] = ( require "$modules_dir/ppcp-saved-payment-checker/module.php" )();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( apply_filters(
|
||||||
|
//phpcs:disable WordPress.NamingConventions.ValidHookName.UseUnderscores
|
||||||
|
'woocommerce.feature-flags.woocommerce_paypal_payments.save_payment_methods_enabled',
|
||||||
|
getenv( 'PCP_SAVE_PAYMENT_METHODS' ) === '1'
|
||||||
|
) ) {
|
||||||
|
$modules[] = ( require "$modules_dir/ppcp-save-payment-methods/module.php" )();
|
||||||
|
}
|
||||||
|
|
||||||
return $modules;
|
return $modules;
|
||||||
};
|
};
|
||||||
|
|
14
modules/ppcp-save-payment-methods/.babelrc
Normal file
14
modules/ppcp-save-payment-methods/.babelrc
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"presets": [
|
||||||
|
[
|
||||||
|
"@babel/preset-env",
|
||||||
|
{
|
||||||
|
"useBuiltIns": "usage",
|
||||||
|
"corejs": "3.25.0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"@babel/preset-react"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
3
modules/ppcp-save-payment-methods/.gitignore
vendored
Normal file
3
modules/ppcp-save-payment-methods/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
node_modules
|
||||||
|
assets/js
|
||||||
|
assets/css
|
17
modules/ppcp-save-payment-methods/composer.json
Normal file
17
modules/ppcp-save-payment-methods/composer.json
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"name": "woocommerce/ppcp-save-payment-methods",
|
||||||
|
"type": "dhii-mod",
|
||||||
|
"description": "Save payment methods module for PPCP",
|
||||||
|
"license": "GPL-2.0",
|
||||||
|
"require": {
|
||||||
|
"php": "^7.2 | ^8.0",
|
||||||
|
"dhii/module-interface": "^0.3.0-alpha1"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"WooCommerce\\PayPalCommerce\\SavePaymentMethods\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"minimum-stability": "dev",
|
||||||
|
"prefer-stable": true
|
||||||
|
}
|
14
modules/ppcp-save-payment-methods/extensions.php
Normal file
14
modules/ppcp-save-payment-methods/extensions.php
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The save payment methods module extensions.
|
||||||
|
*
|
||||||
|
* @package WooCommerce\PayPalCommerce\SavePaymentMethods
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace WooCommerce\PayPalCommerce\SavePaymentMethods;
|
||||||
|
|
||||||
|
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||||
|
|
||||||
|
return array();
|
16
modules/ppcp-save-payment-methods/module.php
Normal file
16
modules/ppcp-save-payment-methods/module.php
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The save payment methods module.
|
||||||
|
*
|
||||||
|
* @package WooCommerce\PayPalCommerce\SavePaymentMethods
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace WooCommerce\PayPalCommerce\SavePaymentMethods;
|
||||||
|
|
||||||
|
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||||
|
|
||||||
|
return static function (): ModuleInterface {
|
||||||
|
return new SavePaymentMethodsModule();
|
||||||
|
};
|
33
modules/ppcp-save-payment-methods/package.json
Normal file
33
modules/ppcp-save-payment-methods/package.json
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"name": "ppcp-save-payment-methods",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"license": "GPL-3.0-or-later",
|
||||||
|
"browserslist": [
|
||||||
|
"> 0.5%",
|
||||||
|
"Safari >= 8",
|
||||||
|
"Chrome >= 41",
|
||||||
|
"Firefox >= 43",
|
||||||
|
"Edge >= 14"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"core-js": "^3.25.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@babel/core": "^7.19",
|
||||||
|
"@babel/preset-env": "^7.19",
|
||||||
|
"@babel/preset-react": "^7.18.6",
|
||||||
|
"@woocommerce/dependency-extraction-webpack-plugin": "^2.2.0",
|
||||||
|
"babel-loader": "^8.2",
|
||||||
|
"cross-env": "^7.0.3",
|
||||||
|
"file-loader": "^6.2.0",
|
||||||
|
"sass": "^1.42.1",
|
||||||
|
"sass-loader": "^12.1.0",
|
||||||
|
"webpack": "^5.76",
|
||||||
|
"webpack-cli": "^4.10"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "cross-env BABEL_ENV=default NODE_ENV=production webpack",
|
||||||
|
"watch": "cross-env BABEL_ENV=default NODE_ENV=production webpack --watch",
|
||||||
|
"dev": "cross-env BABEL_ENV=default webpack --watch"
|
||||||
|
}
|
||||||
|
}
|
0
modules/ppcp-save-payment-methods/resources/js/boot.js
Normal file
0
modules/ppcp-save-payment-methods/resources/js/boot.js
Normal file
14
modules/ppcp-save-payment-methods/services.php
Normal file
14
modules/ppcp-save-payment-methods/services.php
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The save payment methods module services.
|
||||||
|
*
|
||||||
|
* @package WooCommerce\PayPalCommerce\SavePaymentMethods
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace WooCommerce\PayPalCommerce\SavePaymentMethods;
|
||||||
|
|
||||||
|
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||||
|
|
||||||
|
return array();
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The save payment methods module.
|
||||||
|
*
|
||||||
|
* @package WooCommerce\PayPalCommerce\Applepay
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace WooCommerce\PayPalCommerce\SavePaymentMethods;
|
||||||
|
|
||||||
|
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
||||||
|
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||||
|
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
||||||
|
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||||
|
|
||||||
|
class SavePaymentMethodsModule implements ModuleInterface {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function setup(): ServiceProviderInterface {
|
||||||
|
return new ServiceProvider(
|
||||||
|
require __DIR__ . '/../services.php',
|
||||||
|
require __DIR__ . '/../extensions.php'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run(ContainerInterface $c): void {}
|
||||||
|
}
|
38
modules/ppcp-save-payment-methods/webpack.config.js
Normal file
38
modules/ppcp-save-payment-methods/webpack.config.js
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
const path = require('path');
|
||||||
|
const isProduction = process.env.NODE_ENV === 'production';
|
||||||
|
|
||||||
|
const DependencyExtractionWebpackPlugin = require( '@woocommerce/dependency-extraction-webpack-plugin' );
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
devtool: isProduction ? 'source-map' : 'eval-source-map',
|
||||||
|
mode: isProduction ? 'production' : 'development',
|
||||||
|
target: 'web',
|
||||||
|
plugins: [ new DependencyExtractionWebpackPlugin() ],
|
||||||
|
entry: {
|
||||||
|
'boot': path.resolve('./resources/js/boot.js')
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
path: path.resolve(__dirname, 'assets/'),
|
||||||
|
filename: 'js/[name].js',
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [{
|
||||||
|
test: /\.js?$/,
|
||||||
|
exclude: /node_modules/,
|
||||||
|
loader: 'babel-loader',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.scss$/,
|
||||||
|
exclude: /node_modules/,
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: 'file-loader',
|
||||||
|
options: {
|
||||||
|
name: 'css/[name].css',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{loader:'sass-loader'}
|
||||||
|
]
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
};
|
2235
modules/ppcp-save-payment-methods/yarn.lock
Normal file
2235
modules/ppcp-save-payment-methods/yarn.lock
Normal file
File diff suppressed because it is too large
Load diff
|
@ -15,6 +15,7 @@
|
||||||
"install:modules:ppcp-webhooks": "cd modules/ppcp-webhooks && yarn install",
|
"install:modules:ppcp-webhooks": "cd modules/ppcp-webhooks && yarn install",
|
||||||
"install:modules:ppcp-order-tracking": "cd modules/ppcp-order-tracking && yarn install",
|
"install:modules:ppcp-order-tracking": "cd modules/ppcp-order-tracking && yarn install",
|
||||||
"install:modules:ppcp-subscription": "cd modules/ppcp-subscription && yarn install",
|
"install:modules:ppcp-subscription": "cd modules/ppcp-subscription && yarn install",
|
||||||
|
"install:modules:ppcp-save-payment-methods": "cd modules/ppcp-save-payment-methods && yarn install",
|
||||||
"install:modules:ppcp-onboarding": "cd modules/ppcp-onboarding && yarn install",
|
"install:modules:ppcp-onboarding": "cd modules/ppcp-onboarding && yarn install",
|
||||||
"install:modules:ppcp-compat": "cd modules/ppcp-compat && yarn install",
|
"install:modules:ppcp-compat": "cd modules/ppcp-compat && yarn install",
|
||||||
"install:modules:ppcp-uninstall": "cd modules/ppcp-uninstall && yarn install",
|
"install:modules:ppcp-uninstall": "cd modules/ppcp-uninstall && yarn install",
|
||||||
|
@ -25,6 +26,7 @@
|
||||||
"build:modules:ppcp-wc-gateway": "cd modules/ppcp-wc-gateway && yarn run build",
|
"build:modules:ppcp-wc-gateway": "cd modules/ppcp-wc-gateway && yarn run build",
|
||||||
"build:modules:ppcp-webhooks": "cd modules/ppcp-webhooks && yarn run build",
|
"build:modules:ppcp-webhooks": "cd modules/ppcp-webhooks && yarn run build",
|
||||||
"build:modules:ppcp-order-tracking": "cd modules/ppcp-order-tracking && yarn run build",
|
"build:modules:ppcp-order-tracking": "cd modules/ppcp-order-tracking && yarn run build",
|
||||||
|
"build:modules:ppcp-save-payment-methods": "cd modules/ppcp-save-payment-methods && yarn run build",
|
||||||
"build:modules:ppcp-subscription": "cd modules/ppcp-subscription && yarn run build",
|
"build:modules:ppcp-subscription": "cd modules/ppcp-subscription && yarn run build",
|
||||||
"build:modules:ppcp-onboarding": "cd modules/ppcp-onboarding && yarn run build",
|
"build:modules:ppcp-onboarding": "cd modules/ppcp-onboarding && yarn run build",
|
||||||
"build:modules:ppcp-compat": "cd modules/ppcp-compat && yarn run build",
|
"build:modules:ppcp-compat": "cd modules/ppcp-compat && yarn run build",
|
||||||
|
@ -38,6 +40,7 @@
|
||||||
"watch:modules:ppcp-webhooks": "cd modules/ppcp-webhooks && yarn run watch",
|
"watch:modules:ppcp-webhooks": "cd modules/ppcp-webhooks && yarn run watch",
|
||||||
"watch:modules:ppcp-order-tracking": "cd modules/ppcp-order-tracking && yarn run watch",
|
"watch:modules:ppcp-order-tracking": "cd modules/ppcp-order-tracking && yarn run watch",
|
||||||
"watch:modules:ppcp-subscription": "cd modules/ppcp-subscription && yarn run watch",
|
"watch:modules:ppcp-subscription": "cd modules/ppcp-subscription && yarn run watch",
|
||||||
|
"watch:modules:ppcp-save-payment-methods": "cd modules/ppcp-save-payment-methods && yarn run watch",
|
||||||
"watch:modules:ppcp-onboarding": "cd modules/ppcp-onboarding && yarn run watch",
|
"watch:modules:ppcp-onboarding": "cd modules/ppcp-onboarding && yarn run watch",
|
||||||
"watch:modules:ppcp-compat": "cd modules/ppcp-compat && yarn run watch",
|
"watch:modules:ppcp-compat": "cd modules/ppcp-compat && yarn run watch",
|
||||||
"watch:modules:ppcp-uninstall": "cd modules/ppcp-uninstall && yarn run watch",
|
"watch:modules:ppcp-uninstall": "cd modules/ppcp-uninstall && yarn run watch",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue