downgrade plugin to php 7.0

This commit is contained in:
David Remer 2020-09-11 13:38:02 +03:00
parent 5e011b4f95
commit c5899d915c
61 changed files with 419 additions and 368 deletions

View file

@ -26,7 +26,7 @@ use Inpsyde\PayPalCommerce\Onboarding\Environment;
use Inpsyde\PayPalCommerce\Onboarding\State;
return array(
'button.client_id' => static function ( ContainerInterface $container ): string {
'button.client_id' => static function ( $container ): string {
$settings = $container->get( 'wcgateway.settings' );
$client_id = $settings->has( 'client_id' ) ? $settings->get( 'client_id' ) : '';
@ -47,7 +47,7 @@ return array(
return $env->current_environment_is( Environment::SANDBOX ) ?
'AQB97CzMsd58-It1vxbcDAGvMuXNCXRD9le_XUaMlHB_U7XsU9IiItBwGQOtZv9sEeD6xs2vlIrL4NiD' : '';
},
'button.smart-button' => static function ( ContainerInterface $container ): SmartButtonInterface {
'button.smart-button' => static function ( $container ): SmartButtonInterface {
$state = $container->get( 'onboarding.state' );
/**
@ -86,16 +86,16 @@ return array(
$messages_apply
);
},
'button.url' => static function ( ContainerInterface $container ): string {
'button.url' => static function ( $container ): string {
return plugins_url(
'/modules/ppcp-button/',
dirname( __FILE__, 3 ) . '/woocommerce-paypal-commerce-gateway.php'
);
},
'button.request-data' => static function ( ContainerInterface $container ): RequestData {
'button.request-data' => static function ( $container ): RequestData {
return new RequestData();
},
'button.endpoint.change-cart' => static function ( ContainerInterface $container ): ChangeCartEndpoint {
'button.endpoint.change-cart' => static function ( $container ): ChangeCartEndpoint {
if ( ! \WC()->cart ) {
throw new RuntimeException( 'cant initialize endpoint at this moment' );
}
@ -106,7 +106,7 @@ return array(
$data_store = \WC_Data_Store::load( 'product' );
return new ChangeCartEndpoint( $cart, $shipping, $request_data, $repository, $data_store );
},
'button.endpoint.create-order' => static function ( ContainerInterface $container ): CreateOrderEndpoint {
'button.endpoint.create-order' => static function ( $container ): CreateOrderEndpoint {
$request_data = $container->get( 'button.request-data' );
$repository = $container->get( 'api.repository.cart' );
$order_endpoint = $container->get( 'api.endpoint.order' );
@ -124,7 +124,7 @@ return array(
$early_order_handler
);
},
'button.helper.early-order-handler' => static function ( ContainerInterface $container ) : EarlyOrderHandler {
'button.helper.early-order-handler' => static function ( $container ) : EarlyOrderHandler {
$state = $container->get( 'onboarding.state' );
$order_processor = $container->get( 'wcgateway.order-processor' );
@ -132,14 +132,14 @@ return array(
$prefix = $container->get( 'api.prefix' );
return new EarlyOrderHandler( $state, $order_processor, $session_handler, $prefix );
},
'button.endpoint.approve-order' => static function ( ContainerInterface $container ): ApproveOrderEndpoint {
'button.endpoint.approve-order' => static function ( $container ): ApproveOrderEndpoint {
$request_data = $container->get( 'button.request-data' );
$order_endpoint = $container->get( 'api.endpoint.order' );
$session_handler = $container->get( 'session.handler' );
$three_d_secure = $container->get( 'button.helper.three-d-secure' );
return new ApproveOrderEndpoint( $request_data, $order_endpoint, $session_handler, $three_d_secure );
},
'button.endpoint.data-client-id' => static function( ContainerInterface $container ) : DataClientIdEndpoint {
'button.endpoint.data-client-id' => static function( $container ) : DataClientIdEndpoint {
$request_data = $container->get( 'button.request-data' );
$identity_token = $container->get( 'api.endpoint.identity-token' );
return new DataClientIdEndpoint(
@ -147,10 +147,10 @@ return array(
$identity_token
);
},
'button.helper.three-d-secure' => static function ( ContainerInterface $container ): ThreeDSecure {
'button.helper.three-d-secure' => static function ( $container ): ThreeDSecure {
return new ThreeDSecure();
},
'button.helper.messages-apply' => static function ( ContainerInterface $container ): MessagesApply {
'button.helper.messages-apply' => static function ( $container ): MessagesApply {
return new MessagesApply();
},
);

View file

@ -651,7 +651,7 @@ class SmartButton implements SmartButtonInterface {
*
* @return array|null
*/
private function payerData(): ?array {
private function payerData() {
$customer = WC()->customer;
if ( ! is_user_logged_in() || ! is_a( $customer, \WC_Customer::class ) ) {

View file

@ -23,7 +23,7 @@ use Inpsyde\PayPalCommerce\Session\SessionHandler;
class ApproveOrderEndpoint implements EndpointInterface {
public const ENDPOINT = 'ppc-approve-order';
const ENDPOINT = 'ppc-approve-order';
/**
* The request data helper.

View file

@ -20,7 +20,7 @@ use Inpsyde\PayPalCommerce\Button\Exception\RuntimeException;
class ChangeCartEndpoint implements EndpointInterface {
public const ENDPOINT = 'ppc-change-cart';
const ENDPOINT = 'ppc-change-cart';
/**
* The current cart object.
@ -198,7 +198,7 @@ class ChangeCartEndpoint implements EndpointInterface {
*
* @return array|null
*/
private function products_from_data( array $data ): ?array {
private function products_from_data( array $data ) {
$products = array();

View file

@ -25,7 +25,7 @@ use Inpsyde\PayPalCommerce\WcGateway\Settings\Settings;
class CreateOrderEndpoint implements EndpointInterface {
public const ENDPOINT = 'ppc-create-order';
const ENDPOINT = 'ppc-create-order';
/**
* The request data helper.

View file

@ -19,7 +19,7 @@ use Inpsyde\PayPalCommerce\ApiClient\Exception\RuntimeException;
class DataClientIdEndpoint implements EndpointInterface {
public const ENDPOINT = 'ppc-data-client-id';
const ENDPOINT = 'ppc-data-client-id';
/**
* The Request Data Helper.

View file

@ -85,7 +85,7 @@ class EarlyOrderHandler {
*
* @return int|null
*/
public function determine_wc_order_id( int $value = null ): ?int {
public function determine_wc_order_id( int $value = null ) {
if ( ! isset( $_REQUEST['ppcp-resume-order'] ) ) {
return $value;

View file

@ -18,10 +18,10 @@ use Inpsyde\PayPalCommerce\ApiClient\Entity\Order;
class ThreeDSecure {
public const NO_DECISION = 0;
public const PROCCEED = 1;
public const REJECT = 2;
public const RETRY = 3;
const NO_DECISION = 0;
const PROCCEED = 1;
const REJECT = 2;
const RETRY = 3;
/**
* Determine, how we proceed with a given order.