mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Fix merge conflicts
This commit is contained in:
commit
e591dff46d
24 changed files with 861 additions and 691 deletions
|
@ -127,7 +127,6 @@ return array(
|
|||
return new PartnerReferrals(
|
||||
$container->get( 'api.host' ),
|
||||
$container->get( 'api.bearer' ),
|
||||
$container->get( 'api.repository.partner-referrals-data' ),
|
||||
$container->get( 'woocommerce.logger.woocommerce' )
|
||||
);
|
||||
},
|
||||
|
@ -209,9 +208,8 @@ return array(
|
|||
},
|
||||
'api.repository.partner-referrals-data' => static function ( ContainerInterface $container ) : PartnerReferralsData {
|
||||
|
||||
$merchant_email = $container->get( 'api.merchant_email' );
|
||||
$dcc_applies = $container->get( 'api.helpers.dccapplies' );
|
||||
return new PartnerReferralsData( $merchant_email, $dcc_applies );
|
||||
return new PartnerReferralsData( $dcc_applies );
|
||||
},
|
||||
'api.repository.cart' => static function ( ContainerInterface $container ): CartRepository {
|
||||
$factory = $container->get( 'api.factory.purchase-unit' );
|
||||
|
|
|
@ -12,7 +12,6 @@ namespace WooCommerce\PayPalCommerce\ApiClient\Endpoint;
|
|||
use WooCommerce\PayPalCommerce\ApiClient\Authentication\Bearer;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Repository\PartnerReferralsData;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
|
@ -36,13 +35,6 @@ class PartnerReferrals {
|
|||
*/
|
||||
private $bearer;
|
||||
|
||||
/**
|
||||
* The PartnerReferralsData.
|
||||
*
|
||||
* @var PartnerReferralsData
|
||||
*/
|
||||
private $data;
|
||||
|
||||
/**
|
||||
* The logger.
|
||||
*
|
||||
|
@ -53,32 +45,29 @@ class PartnerReferrals {
|
|||
/**
|
||||
* PartnerReferrals constructor.
|
||||
*
|
||||
* @param string $host The host.
|
||||
* @param Bearer $bearer The bearer.
|
||||
* @param PartnerReferralsData $data The partner referrals data.
|
||||
* @param LoggerInterface $logger The logger.
|
||||
* @param string $host The host.
|
||||
* @param Bearer $bearer The bearer.
|
||||
* @param LoggerInterface $logger The logger.
|
||||
*/
|
||||
public function __construct(
|
||||
string $host,
|
||||
Bearer $bearer,
|
||||
PartnerReferralsData $data,
|
||||
LoggerInterface $logger
|
||||
) {
|
||||
|
||||
$this->host = $host;
|
||||
$this->bearer = $bearer;
|
||||
$this->data = $data;
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the signup link.
|
||||
*
|
||||
* @param array $data The partner referrals data.
|
||||
* @return string
|
||||
* @throws RuntimeException If the request fails.
|
||||
*/
|
||||
public function signup_link(): string {
|
||||
$data = $this->data->data();
|
||||
public function signup_link( array $data ): string {
|
||||
$bearer = $this->bearer->bearer();
|
||||
$args = array(
|
||||
'method' => 'POST',
|
||||
|
|
|
@ -15,14 +15,6 @@ use WooCommerce\PayPalCommerce\ApiClient\Helper\DccApplies;
|
|||
* Class PartnerReferralsData
|
||||
*/
|
||||
class PartnerReferralsData {
|
||||
|
||||
/**
|
||||
* The merchant email.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $merchant_email;
|
||||
|
||||
/**
|
||||
* The DCC Applies Helper object.
|
||||
*
|
||||
|
@ -30,19 +22,39 @@ class PartnerReferralsData {
|
|||
*/
|
||||
private $dcc_applies;
|
||||
|
||||
/**
|
||||
* The list of products ('PPCP', 'EXPRESS_CHECKOUT').
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private $products;
|
||||
|
||||
/**
|
||||
* PartnerReferralsData constructor.
|
||||
*
|
||||
* @param string $merchant_email The email of the merchant.
|
||||
* @param DccApplies $dcc_applies The DCC Applies helper.
|
||||
*/
|
||||
public function __construct(
|
||||
string $merchant_email,
|
||||
DccApplies $dcc_applies
|
||||
) {
|
||||
$this->dcc_applies = $dcc_applies;
|
||||
$this->products = array(
|
||||
$this->dcc_applies->for_country_currency() ? 'PPCP' : 'EXPRESS_CHECKOUT',
|
||||
);
|
||||
}
|
||||
|
||||
$this->merchant_email = $merchant_email;
|
||||
$this->dcc_applies = $dcc_applies;
|
||||
/**
|
||||
* Returns a new copy of this object with the given value set.
|
||||
*
|
||||
* @param string[] $products The list of products ('PPCP', 'EXPRESS_CHECKOUT').
|
||||
* @return static
|
||||
*/
|
||||
public function with_products( array $products ): self {
|
||||
$obj = clone $this;
|
||||
|
||||
$obj->products = $products;
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,17 +72,6 @@ class PartnerReferralsData {
|
|||
* @return array
|
||||
*/
|
||||
public function data(): array {
|
||||
$data = $this->default_data();
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default data.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function default_data(): array {
|
||||
|
||||
return array(
|
||||
'partner_config_override' => array(
|
||||
'partner_logo_url' => 'https://connect.woocommerce.com/images/woocommerce_logo.png',
|
||||
|
@ -84,9 +85,7 @@ class PartnerReferralsData {
|
|||
),
|
||||
'show_add_credit_card' => true,
|
||||
),
|
||||
'products' => array(
|
||||
$this->dcc_applies->for_country_currency() ? 'PPCP' : 'EXPRESS_CHECKOUT',
|
||||
),
|
||||
'products' => $this->products,
|
||||
'legal_consents' => array(
|
||||
array(
|
||||
'type' => 'SHARE_DATA_CONSENT',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue