mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
♻️ Move code from old onboarding to api module
To make services reusable in the new settings module, without creating a dependency on the old module
This commit is contained in:
parent
bd83cc201c
commit
263806904b
3 changed files with 85 additions and 59 deletions
|
@ -29,9 +29,33 @@ if ( ! defined( 'MINUTE_IN_SECONDS' ) ) {
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
define( 'ABSPATH', '' );
|
define( 'ABSPATH', '' );
|
||||||
}
|
}
|
||||||
|
if ( ! defined( 'PAYPAL_API_URL' ) ) {
|
||||||
|
define( 'PAYPAL_API_URL', 'https://api-m.paypal.com' );
|
||||||
|
}
|
||||||
|
if ( ! defined( 'PAYPAL_SANDBOX_API_URL' ) ) {
|
||||||
|
define( 'PAYPAL_SANDBOX_API_URL', 'https://api-m.sandbox.paypal.com' );
|
||||||
|
}
|
||||||
if ( ! defined( 'PPCP_PAYPAL_BN_CODE' ) ) {
|
if ( ! defined( 'PPCP_PAYPAL_BN_CODE' ) ) {
|
||||||
define( 'PPCP_PAYPAL_BN_CODE', 'Woo_PPCP' );
|
define( 'PPCP_PAYPAL_BN_CODE', 'Woo_PPCP' );
|
||||||
}
|
}
|
||||||
|
if ( ! defined( 'CONNECT_WOO_CLIENT_ID' ) ) {
|
||||||
|
define( 'CONNECT_WOO_CLIENT_ID', 'AcCAsWta_JTL__OfpjspNyH7c1GGHH332fLwonA5CwX4Y10mhybRZmHLA0GdRbwKwjQIhpDQy0pluX_P' );
|
||||||
|
}
|
||||||
|
if ( ! defined( 'CONNECT_WOO_SANDBOX_CLIENT_ID' ) ) {
|
||||||
|
define( 'CONNECT_WOO_SANDBOX_CLIENT_ID', 'AYmOHbt1VHg-OZ_oihPdzKEVbU3qg0qXonBcAztuzniQRaKE0w1Hr762cSFwd4n8wxOl-TCWohEa0XM_' );
|
||||||
|
}
|
||||||
|
if ( ! defined( 'CONNECT_WOO_MERCHANT_ID' ) ) {
|
||||||
|
define( 'CONNECT_WOO_MERCHANT_ID', 'K8SKZ36LQBWXJ' );
|
||||||
|
}
|
||||||
|
if ( ! defined( 'CONNECT_WOO_SANDBOX_MERCHANT_ID' ) ) {
|
||||||
|
define( 'CONNECT_WOO_SANDBOX_MERCHANT_ID', 'MPMFHQTVMBZ6G' );
|
||||||
|
}
|
||||||
|
if ( ! defined( 'CONNECT_WOO_URL' ) ) {
|
||||||
|
define( 'CONNECT_WOO_URL', 'https://api.woocommerce.com/integrations/ppc' );
|
||||||
|
}
|
||||||
|
if ( ! defined( 'CONNECT_WOO_SANDBOX_URL' ) ) {
|
||||||
|
define( 'CONNECT_WOO_SANDBOX_URL', 'https://api.woocommerce.com/integrations/ppcsandbox' );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel the next occurrence of a scheduled action.
|
* Cancel the next occurrence of a scheduled action.
|
||||||
|
@ -78,12 +102,15 @@ class WP_HTML_Tag_Processor {
|
||||||
public function __construct( $html ) {
|
public function __construct( $html ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function next_tag( $query = null ) {
|
public function next_tag( $query = null ) : bool {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function set_attribute( $name, $value ) {
|
public function set_attribute( $name, $value ) : bool {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_updated_html() {
|
public function get_updated_html() : string {
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ use WooCommerce\PayPalCommerce\ApiClient\Authentication\UserIdToken;
|
||||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\Orders;
|
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\Orders;
|
||||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PaymentMethodTokensEndpoint;
|
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PaymentMethodTokensEndpoint;
|
||||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PaymentTokensEndpoint;
|
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PaymentTokensEndpoint;
|
||||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\CardAuthenticationResult;
|
|
||||||
use WooCommerce\PayPalCommerce\ApiClient\Factory\CardAuthenticationResultFactory;
|
use WooCommerce\PayPalCommerce\ApiClient\Factory\CardAuthenticationResultFactory;
|
||||||
use WooCommerce\PayPalCommerce\ApiClient\Helper\CurrencyGetter;
|
use WooCommerce\PayPalCommerce\ApiClient\Helper\CurrencyGetter;
|
||||||
use WooCommerce\PayPalCommerce\ApiClient\Helper\FailureRegistry;
|
use WooCommerce\PayPalCommerce\ApiClient\Helper\FailureRegistry;
|
||||||
|
@ -79,6 +78,7 @@ use WooCommerce\PayPalCommerce\ApiClient\Repository\OrderRepository;
|
||||||
use WooCommerce\PayPalCommerce\ApiClient\Repository\PartnerReferralsData;
|
use WooCommerce\PayPalCommerce\ApiClient\Repository\PartnerReferralsData;
|
||||||
use WooCommerce\PayPalCommerce\ApiClient\Repository\PayeeRepository;
|
use WooCommerce\PayPalCommerce\ApiClient\Repository\PayeeRepository;
|
||||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||||
|
use WooCommerce\PayPalCommerce\ApiClient\Authentication\ConnectBearer;
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'api.host' => function( ContainerInterface $container ) : string {
|
'api.host' => function( ContainerInterface $container ) : string {
|
||||||
|
@ -179,6 +179,22 @@ return array(
|
||||||
$container->get( 'woocommerce.logger.woocommerce' )
|
$container->get( 'woocommerce.logger.woocommerce' )
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
'api.endpoint.partner-referrals-sandbox' => static function ( ContainerInterface $container ) : PartnerReferrals {
|
||||||
|
|
||||||
|
return new PartnerReferrals(
|
||||||
|
CONNECT_WOO_SANDBOX_URL,
|
||||||
|
new ConnectBearer(),
|
||||||
|
$container->get( 'woocommerce.logger.woocommerce' )
|
||||||
|
);
|
||||||
|
},
|
||||||
|
'api.endpoint.partner-referrals-production' => static function ( ContainerInterface $container ) : PartnerReferrals {
|
||||||
|
|
||||||
|
return new PartnerReferrals(
|
||||||
|
CONNECT_WOO_URL,
|
||||||
|
new ConnectBearer(),
|
||||||
|
$container->get( 'woocommerce.logger.woocommerce' )
|
||||||
|
);
|
||||||
|
},
|
||||||
'api.endpoint.identity-token' => static function ( ContainerInterface $container ) : IdentityToken {
|
'api.endpoint.identity-token' => static function ( ContainerInterface $container ) : IdentityToken {
|
||||||
$logger = $container->get( 'woocommerce.logger.woocommerce' );
|
$logger = $container->get( 'woocommerce.logger.woocommerce' );
|
||||||
$settings = $container->get( 'wcgateway.settings' );
|
$settings = $container->get( 'wcgateway.settings' );
|
||||||
|
@ -853,4 +869,22 @@ return array(
|
||||||
$container->get( 'api.client-credentials-cache' )
|
$container->get( 'api.client-credentials-cache' )
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
'api.paypal-host-production' => static function( ContainerInterface $container ) : string {
|
||||||
|
return PAYPAL_API_URL;
|
||||||
|
},
|
||||||
|
'api.paypal-host-sandbox' => static function( ContainerInterface $container ) : string {
|
||||||
|
return PAYPAL_SANDBOX_API_URL;
|
||||||
|
},
|
||||||
|
'api.paypal-website-url-production' => static function( ContainerInterface $container ) : string {
|
||||||
|
return PAYPAL_URL;
|
||||||
|
},
|
||||||
|
'api.paypal-website-url-sandbox' => static function( ContainerInterface $container ) : string {
|
||||||
|
return PAYPAL_SANDBOX_URL;
|
||||||
|
},
|
||||||
|
'api.partner_merchant_id-production' => static function( ContainerInterface $container ) : string {
|
||||||
|
return CONNECT_WOO_MERCHANT_ID;
|
||||||
|
},
|
||||||
|
'api.partner_merchant_id-sandbox' => static function( ContainerInterface $container ) : string {
|
||||||
|
return CONNECT_WOO_SANDBOX_MERCHANT_ID;
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
|
@ -15,7 +15,6 @@ use WooCommerce\PayPalCommerce\ApiClient\Authentication\Bearer;
|
||||||
use WooCommerce\PayPalCommerce\ApiClient\Authentication\ConnectBearer;
|
use WooCommerce\PayPalCommerce\ApiClient\Authentication\ConnectBearer;
|
||||||
use WooCommerce\PayPalCommerce\ApiClient\Authentication\PayPalBearer;
|
use WooCommerce\PayPalCommerce\ApiClient\Authentication\PayPalBearer;
|
||||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\LoginSeller;
|
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\LoginSeller;
|
||||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PartnerReferrals;
|
|
||||||
use WooCommerce\PayPalCommerce\ApiClient\Helper\Cache;
|
use WooCommerce\PayPalCommerce\ApiClient\Helper\Cache;
|
||||||
use WooCommerce\PayPalCommerce\Onboarding\Assets\OnboardingAssets;
|
use WooCommerce\PayPalCommerce\Onboarding\Assets\OnboardingAssets;
|
||||||
use WooCommerce\PayPalCommerce\Onboarding\Endpoint\LoginSellerEndpoint;
|
use WooCommerce\PayPalCommerce\Onboarding\Endpoint\LoginSellerEndpoint;
|
||||||
|
@ -66,24 +65,6 @@ return array(
|
||||||
? (string) $container->get( 'api.sandbox-host' ) : (string) $container->get( 'api.production-host' );
|
? (string) $container->get( 'api.sandbox-host' ) : (string) $container->get( 'api.production-host' );
|
||||||
|
|
||||||
},
|
},
|
||||||
'api.paypal-host-production' => static function( ContainerInterface $container ) : string {
|
|
||||||
return PAYPAL_API_URL;
|
|
||||||
},
|
|
||||||
'api.paypal-host-sandbox' => static function( ContainerInterface $container ) : string {
|
|
||||||
return PAYPAL_SANDBOX_API_URL;
|
|
||||||
},
|
|
||||||
'api.paypal-website-url-production' => static function( ContainerInterface $container ) : string {
|
|
||||||
return PAYPAL_URL;
|
|
||||||
},
|
|
||||||
'api.paypal-website-url-sandbox' => static function( ContainerInterface $container ) : string {
|
|
||||||
return PAYPAL_SANDBOX_URL;
|
|
||||||
},
|
|
||||||
'api.partner_merchant_id-production' => static function( ContainerInterface $container ) : string {
|
|
||||||
return CONNECT_WOO_MERCHANT_ID;
|
|
||||||
},
|
|
||||||
'api.partner_merchant_id-sandbox' => static function( ContainerInterface $container ) : string {
|
|
||||||
return CONNECT_WOO_SANDBOX_MERCHANT_ID;
|
|
||||||
},
|
|
||||||
'api.paypal-host' => function( ContainerInterface $container ) : string {
|
'api.paypal-host' => function( ContainerInterface $container ) : string {
|
||||||
$environment = $container->get( 'onboarding.environment' );
|
$environment = $container->get( 'onboarding.environment' );
|
||||||
/**
|
/**
|
||||||
|
@ -213,22 +194,6 @@ return array(
|
||||||
$container->get( 'woocommerce.logger.woocommerce' )
|
$container->get( 'woocommerce.logger.woocommerce' )
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
'api.endpoint.partner-referrals-sandbox' => static function ( ContainerInterface $container ) : PartnerReferrals {
|
|
||||||
|
|
||||||
return new PartnerReferrals(
|
|
||||||
CONNECT_WOO_SANDBOX_URL,
|
|
||||||
new ConnectBearer(),
|
|
||||||
$container->get( 'woocommerce.logger.woocommerce' )
|
|
||||||
);
|
|
||||||
},
|
|
||||||
'api.endpoint.partner-referrals-production' => static function ( ContainerInterface $container ) : PartnerReferrals {
|
|
||||||
|
|
||||||
return new PartnerReferrals(
|
|
||||||
CONNECT_WOO_URL,
|
|
||||||
new ConnectBearer(),
|
|
||||||
$container->get( 'woocommerce.logger.woocommerce' )
|
|
||||||
);
|
|
||||||
},
|
|
||||||
'onboarding.signup-link-cache' => static function( ContainerInterface $container ): Cache {
|
'onboarding.signup-link-cache' => static function( ContainerInterface $container ): Cache {
|
||||||
return new Cache( 'ppcp-paypal-signup-link' );
|
return new Cache( 'ppcp-paypal-signup-link' );
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue