mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
Merge pull request #60 from woocommerce/issue-3-before-version-1
Before golive
This commit is contained in:
commit
4f9a0a44c3
8 changed files with 37 additions and 21 deletions
|
@ -40,11 +40,8 @@ return array(
|
|||
* @var Environment $env
|
||||
*/
|
||||
|
||||
/**
|
||||
* ToDo: Add production platform client Id.
|
||||
*/
|
||||
return $env->current_environment_is( Environment::SANDBOX ) ?
|
||||
'AQB97CzMsd58-It1vxbcDAGvMuXNCXRD9le_XUaMlHB_U7XsU9IiItBwGQOtZv9sEeD6xs2vlIrL4NiD' : '';
|
||||
CONNECT_WOO_SANDBOX_CLIENT_ID : CONNECT_WOO_CLIENT_ID;
|
||||
},
|
||||
'button.smart-button' => static function ( $container ): SmartButtonInterface {
|
||||
|
||||
|
|
|
@ -155,7 +155,6 @@ const disconnect = (event) => {
|
|||
element.value = '';
|
||||
}
|
||||
);
|
||||
|
||||
document.querySelector('.woocommerce-save-button').click();
|
||||
};
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ return array(
|
|||
if ( $state->current_state() >= State::STATE_ONBOARDED ) {
|
||||
return PAYPAL_SANDBOX_API_URL;
|
||||
}
|
||||
// ToDo: Real connect.woocommerce.com sandbox link.
|
||||
return CONNECT_WOO_SANDBOX_URL;
|
||||
},
|
||||
'api.production-host' => static function ( $container ): string {
|
||||
|
@ -68,6 +67,12 @@ return array(
|
|||
'api.paypal-host-sandbox' => static function( $container ) : string {
|
||||
return PAYPAL_SANDBOX_API_URL;
|
||||
},
|
||||
'api.partner_merchant_id-production' => static function( $container ) : string {
|
||||
return CONNECT_WOO_MERCHANT_ID;
|
||||
},
|
||||
'api.partner_merchant_id-sandbox' => static function( $container ) : string {
|
||||
return CONNECT_WOO_SANDBOX_MERCHANT_ID;
|
||||
},
|
||||
'api.paypal-host' => function( $container ) : string {
|
||||
$environment = $container->get( 'onboarding.environment' );
|
||||
/**
|
||||
|
@ -140,7 +145,7 @@ return array(
|
|||
$logger = $container->get( 'woocommerce.logger.woocommerce' );
|
||||
return new LoginSeller(
|
||||
$container->get( 'api.paypal-host-production' ),
|
||||
$container->get( 'api.partner_merchant_id' ),
|
||||
$container->get( 'api.partner_merchant_id-production' ),
|
||||
$logger
|
||||
);
|
||||
},
|
||||
|
@ -150,7 +155,7 @@ return array(
|
|||
$logger = $container->get( 'woocommerce.logger.woocommerce' );
|
||||
return new LoginSeller(
|
||||
$container->get( 'api.paypal-host-sandbox' ),
|
||||
$container->get( 'api.partner_merchant_id' ),
|
||||
$container->get( 'api.partner_merchant_id-sandbox' ),
|
||||
$logger
|
||||
);
|
||||
},
|
||||
|
@ -185,7 +190,7 @@ return array(
|
|||
'api.endpoint.partner-referrals-production' => static function ( $container ) : PartnerReferrals {
|
||||
|
||||
return new PartnerReferrals(
|
||||
CONNECT_WOO_SANDBOX_URL,
|
||||
CONNECT_WOO_URL,
|
||||
new ConnectBearer(),
|
||||
$container->get( 'api.repository.partner-referrals-data' ),
|
||||
$container->get( 'woocommerce.logger.woocommerce' )
|
||||
|
|
|
@ -114,6 +114,7 @@ class LoginSellerEndpoint implements EndpointInterface {
|
|||
$data = $this->request_data->read_request( $this->nonce() );
|
||||
$is_sandbox = isset( $data['env'] ) && 'sandbox' === $data['env'];
|
||||
$this->settings->set( 'sandbox_on', $is_sandbox );
|
||||
$this->settings->set( 'products_dcc_enabled', null );
|
||||
$this->settings->persist();
|
||||
$endpoint = $is_sandbox ? $this->login_seller_sandbox : $this->login_seller_production;
|
||||
$credentials = $endpoint->credentials_for(
|
||||
|
|
|
@ -10,6 +10,7 @@ declare(strict_types=1);
|
|||
namespace WooCommerce\PayPalCommerce\WcGateway;
|
||||
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\OrderEndpoint;
|
||||
use WooCommerce\PayPalCommerce\Onboarding\Environment;
|
||||
use WooCommerce\PayPalCommerce\Session\SessionHandler;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
use WooCommerce\WooCommerce\Logging\Logger\NullLogger;
|
||||
|
@ -27,9 +28,16 @@ return array(
|
|||
$settings = $container->get( 'wcgateway.settings' );
|
||||
return $settings->has( 'merchant_id' ) ? (string) $settings->get( 'merchant_id' ) : '';
|
||||
},
|
||||
'api.partner_merchant_id' => static function (): string {
|
||||
// @ToDo: Replace with the real merchant id of platform
|
||||
return 'KQ8FCM66JFGDL';
|
||||
'api.partner_merchant_id' => static function ( $container ): string {
|
||||
$environment = $container->get( 'onboarding.environment' );
|
||||
|
||||
/**
|
||||
* The environment.
|
||||
*
|
||||
* @var Environment $environment
|
||||
*/
|
||||
return $environment->current_environment_is( Environment::SANDBOX ) ?
|
||||
(string) $container->get( 'api.partner_merchant_id-sandbox' ) : (string) $container->get( 'api.partner_merchant_id-production' );
|
||||
},
|
||||
'api.key' => static function ( $container ): string {
|
||||
$settings = $container->get( 'wcgateway.settings' );
|
||||
|
|
|
@ -208,6 +208,7 @@ class SettingsListener {
|
|||
private function maybe_register_webhooks( array $settings ) {
|
||||
|
||||
if ( ! $this->settings->has( 'client_id' ) && $settings['client_id'] ) {
|
||||
$this->settings->set( 'products_dcc_enabled', null );
|
||||
$this->webhook_registrar->register();
|
||||
}
|
||||
if ( $this->settings->has( 'client_id' ) && $this->settings->get( 'client_id' ) ) {
|
||||
|
@ -217,6 +218,7 @@ class SettingsListener {
|
|||
$settings['client_id'] !== $this->settings->get( 'client_id' )
|
||||
|| $settings['client_secret'] !== $current_secret
|
||||
) {
|
||||
$this->settings->set( 'products_dcc_enabled', null );
|
||||
$this->webhook_registrar->unregister();
|
||||
$this->webhook_registrar->register();
|
||||
}
|
||||
|
|
|
@ -326,7 +326,6 @@ class SettingsRenderer {
|
|||
</tr>
|
||||
<?php
|
||||
endforeach;
|
||||
|
||||
if ( $is_dcc ) {
|
||||
if ( $this->dcc_applies->for_country_currency() ) {
|
||||
if ( State::STATE_ONBOARDED > $this->state->current_state() ) {
|
||||
|
@ -407,7 +406,10 @@ class SettingsRenderer {
|
|||
%1$sLearn more about 3D Secure.%2$s',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'<a href = "#">',
|
||||
'<a
|
||||
rel="noreferrer noopener"
|
||||
href="https://woocommerce.com/posts/introducing-strong-customer-authentication-sca/"
|
||||
>',
|
||||
'</a>'
|
||||
)
|
||||
);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* Plugin Name: WooCommerce PayPal Payments
|
||||
* Plugin URI: TODO
|
||||
* Plugin URI: https://woocommerce.com/products/woocommerce-paypal-payments/
|
||||
* Description: PayPal's latest complete payments processing solution. Accept PayPal, PayPal Credit, credit/debit cards, alternative digital wallets local payment types and bank accounts. Turn on only PayPal options or process a full suite of payment methods. Enable global transaction with extensive currency and country coverage.
|
||||
* Version: dev-master
|
||||
* Author: WooCommerce
|
||||
* Author URI: https://inpsyde.com/
|
||||
* Author URI: https://woocommerce.com/
|
||||
* License: GPL-2.0
|
||||
* Text Domain: woocommerce-paypal-payments
|
||||
*
|
||||
|
@ -24,12 +24,14 @@ use Dhii\Modular\Module\ModuleInterface;
|
|||
|
||||
define( 'PAYPAL_API_URL', 'https://api.paypal.com' );
|
||||
define( 'PAYPAL_SANDBOX_API_URL', 'https://api.sandbox.paypal.com' );
|
||||
// @ToDo: Update date on releases.
|
||||
define( 'PAYPAL_INTEGRATION_DATE', gmdate( 'Y-m-d' ) );
|
||||
define( 'PAYPAL_INTEGRATION_DATE', '2020-10-13' );
|
||||
|
||||
// @ToDo: Real connect.woocommerce.com production link.
|
||||
define( 'CONNECT_WOO_URL', 'http://connect-woo.wpcust.com/ppc' );
|
||||
define( 'CONNECT_WOO_SANDBOX_URL', 'http://connect-woo.wpcust.com/ppcsandbox' );
|
||||
! defined( 'CONNECT_WOO_CLIENT_ID' ) && define( 'CONNECT_WOO_CLIENT_ID', 'AcCAsWta_JTL__OfpjspNyH7c1GGHH332fLwonA5CwX4Y10mhybRZmHLA0GdRbwKwjQIhpDQy0pluX_P' );
|
||||
! defined( 'CONNECT_WOO_SANDBOX_CLIENT_ID' ) && define( 'CONNECT_WOO_SANDBOX_CLIENT_ID', 'AYmOHbt1VHg-OZ_oihPdzKEVbU3qg0qXonBcAztuzniQRaKE0w1Hr762cSFwd4n8wxOl-TCWohEa0XM_' );
|
||||
! defined( 'CONNECT_WOO_MERCHANT_ID' ) && define( 'CONNECT_WOO_MERCHANT_ID', 'K8SKZ36LQBWXJ' );
|
||||
! defined( 'CONNECT_WOO_SANDBOX_MERCHANT_ID' ) && define( 'CONNECT_WOO_SANDBOX_MERCHANT_ID', 'MPMFHQTVMBZ6G' );
|
||||
! defined( 'CONNECT_WOO_URL' ) && define( 'CONNECT_WOO_URL', 'https://connect.woocommerce.com/ppc' );
|
||||
! defined( 'CONNECT_WOO_SANDBOX_URL' ) && define( 'CONNECT_WOO_SANDBOX_URL', 'https://connect.woocommerce.com/ppcsandbox' );
|
||||
|
||||
( function () {
|
||||
include __DIR__ . '/vendor/autoload.php';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue