Changeset 2921678
- Timestamp:
- 06/05/2023 01:25:15 PM (3 years ago)
- Location:
- payoneer-checkout/trunk
- Files:
-
- 8 added
- 25 edited
-
inc/services.php (modified) (4 diffs)
-
languages/en_GB.pot (modified) (9 diffs)
-
modules.local/checkout/assets/img/amex.svg (added)
-
modules.local/checkout/assets/img/mastercard.svg (added)
-
modules.local/checkout/assets/img/visa.svg (added)
-
modules.local/checkout/inc/amex_icon_setting_field.php (added)
-
modules.local/checkout/inc/appearance_settings_fields.php (added)
-
modules.local/checkout/inc/extensions.php (modified) (3 diffs)
-
modules.local/checkout/inc/services.php (modified) (5 diffs)
-
modules.local/checkout/src/CheckoutModule.php (modified) (4 diffs)
-
modules.local/checkout/src/Factory/Customer/WcBasedCustomerFactory.php (modified) (4 diffs)
-
modules.local/checkout/src/Factory/ListSession/OrderBasedListCommandFactory.php (modified) (1 diff)
-
modules.local/checkout/src/MisconfigurationDetector (added)
-
modules.local/checkout/src/MisconfigurationDetector/MisconfigurationDetector.php (added)
-
modules.local/checkout/src/MisconfigurationDetector/MisconfigurationDetectorInterface.php (added)
-
modules.local/checkout/src/PaymentProcessor/AbstractPaymentProcessor.php (modified) (3 diffs)
-
modules.local/embedded-payment/inc/custom_css_fields.php (modified) (1 diff)
-
modules.local/embedded-payment/inc/extensions.php (modified) (1 diff)
-
modules.local/embedded-payment/inc/services.php (modified) (5 diffs)
-
modules.local/embedded-payment/src/EmbeddedPaymentModule.php (modified) (1 diff)
-
modules.local/embedded-payment/src/PaymentProcessor/EmbeddedPaymentProcessor.php (modified) (2 diffs)
-
modules.local/hosted-payment/inc/extensions.php (modified) (2 diffs)
-
modules.local/hosted-payment/src/PaymentProcessor/HostedPaymentProcessor.php (modified) (2 diffs)
-
modules.local/payment-gateway/inc/services.php (modified) (1 diff)
-
modules.local/payment-gateway/src/Gateway/Factory/Customer/WcOrderBasedCustomerFactory.php (modified) (2 diffs)
-
modules.local/payment-gateway/src/Gateway/PaymentGateway.php (modified) (1 diff)
-
modules.local/wp/inc/services.php (modified) (1 diff)
-
payoneer-checkout.php (modified) (2 diffs)
-
vendor/autoload.php (modified) (1 diff)
-
vendor/composer/autoload_classmap.php (modified) (1 diff)
-
vendor/composer/autoload_real.php (modified) (2 diffs)
-
vendor/composer/autoload_static.php (modified) (3 diffs)
-
vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
payoneer-checkout/trunk/inc/services.php
r2915933 r2921678 514 514 new Alias('inpsyde_payment_gateway.settings_option_key'), 515 515 516 'core.misconfiguration_detector' => 517 new Alias('checkout.misconfiguration_detector'), 518 516 519 # Essential factories 517 520 # ================================================================= … … 1534 1537 new Alias('core.wc.countries'), 1535 1538 1539 'checkout.is_frontend_request' => 1540 new Alias('wp.is_frontend_request'), 1541 1536 1542 ## webhooks 1537 1543 # -------------------------- … … 1698 1704 new Alias('core.wc_ajax_url'), 1699 1705 1706 'embedded_payment.misconfiguration_detector' => 1707 new Alias('core.misconfiguration_detector'), 1708 1700 1709 ## websdk 1701 1710 # -------------------------- … … 1729 1738 1730 1739 'admin_banner.configure_url' => new Alias('core.http.settings_url'), 1740 1741 ## hosted_payment 1742 # -------------------------- 1743 1744 'hosted_payment.misconfiguration_detector' => 1745 new Alias('core.misconfiguration_detector'), 1731 1746 ]; 1732 1747 }; -
payoneer-checkout/trunk/languages/en_GB.pot
r2915933 r2921678 43 43 msgstr "" 44 44 45 #: ../inc/services.php:83 545 #: ../inc/services.php:838 46 46 msgid "live" 47 47 msgstr "" 48 48 49 #: ../inc/services.php:8 3849 #: ../inc/services.php:841 50 50 msgid "sandbox" 51 51 msgstr "" … … 71 71 msgstr "" 72 72 73 #: ../modules.local/checkout/inc/amex_icon_setting_field.php:10 74 msgid "American Express logo" 75 msgstr "" 76 77 #: ../modules.local/checkout/inc/amex_icon_setting_field.php:12 78 msgid "Display American Express logo next to the payment method title on the checkout page. Merchants of Record shall not display the logo." 79 msgstr "" 80 81 #: ../modules.local/checkout/inc/appearance_settings_fields.php:11 82 msgid "Payment widget appearance" 83 msgstr "" 84 73 85 #: ../modules.local/checkout/inc/general_settings_fields.php:16 74 86 msgid "Select payment flow" 75 87 msgstr "" 76 88 77 #: ../modules.local/checkout/inc/services.php:5 6089 #: ../modules.local/checkout/inc/services.php:585 78 90 msgid "Select the payment flow for every transaction." 79 91 msgstr "" 80 92 81 #: ../modules.local/checkout/src/CheckoutModule.php:2 5693 #: ../modules.local/checkout/src/CheckoutModule.php:260 82 94 msgid "Payment failed. Please try again" 83 95 msgstr "" 84 96 85 #: ../modules.local/checkout/src/CheckoutModule.php:2 5897 #: ../modules.local/checkout/src/CheckoutModule.php:262 86 98 msgid "Payment canceled. Please try again or choose another payment method." 87 99 msgstr "" 88 100 89 #: ../modules.local/checkout/src/CheckoutModule.php:2 79101 #: ../modules.local/checkout/src/CheckoutModule.php:283 90 102 msgid "Payment has been aborted" 91 103 msgstr "" 92 104 93 105 #. translators: %1$s, %2$s and %3$s are replaced with the opening and closing 'a' tags 94 #: ../modules.local/checkout/src/CheckoutModule.php:42 4106 #: ../modules.local/checkout/src/CheckoutModule.php:428 95 107 msgid "Enter correct test credentials and save settings to get status notification and unblock live mode. You can %1$srefresh%2$s the page to check if status notification is already received." 96 108 msgstr "" 97 109 98 #: ../modules.local/checkout/src/CheckoutModule.php:4 69110 #: ../modules.local/checkout/src/CheckoutModule.php:473 99 111 msgid "Payment was aborted by Payoneer Checkout. Please try again." 100 112 msgstr "" 101 113 102 #: ../modules.local/checkout/src/CheckoutModule.php:47 4114 #: ../modules.local/checkout/src/CheckoutModule.php:478 103 115 msgid "An unknown error occurred when initiating payment through Payoneer Checkout. Please try again." 116 msgstr "" 117 118 #: ../modules.local/embedded-payment/inc/custom_css_fields.php:16 119 msgid "Custom CSS" 120 msgstr "" 121 122 #: ../modules.local/embedded-payment/inc/custom_css_fields.php:18 123 msgid "Customize the look and feel of the payment widget in embedded payment flow" 104 124 msgstr "" 105 125 … … 112 132 msgstr "" 113 133 114 #: ../modules.local/embedded-payment/inc/fields.php:16115 msgid "Payment widget appearance"116 msgstr ""117 118 #: ../modules.local/embedded-payment/inc/fields.php:20119 msgid "Custom CSS"120 msgstr ""121 122 #: ../modules.local/embedded-payment/inc/fields.php:22123 msgid "Customize the look and feel of the payment widget in embedded payment flow"124 msgstr ""125 126 134 #: ../modules.local/embedded-payment/src/EmbeddedPaymentModule.php:214 127 135 msgid "Pay for order" … … 132 140 msgstr "" 133 141 134 #: ../modules.local/embedded-payment/src/EmbeddedPaymentModule.php:3 59135 msgid " Failed to initialize Payoneer session based on current checkout data. Possible reasons include incomplete billing data or an invalid order total"142 #: ../modules.local/embedded-payment/src/EmbeddedPaymentModule.php:362 143 msgid "The selected payment method for your order is not available at the moment. Please select another payment method." 136 144 msgstr "" 137 145 … … 140 148 msgstr "" 141 149 142 #: ../modules.local/hosted-payment/inc/extensions.php: 19150 #: ../modules.local/hosted-payment/inc/extensions.php:20 143 151 msgid "Hosted" 144 152 msgstr "" 145 153 146 #: ../modules.local/hosted-payment/inc/extensions.php:2 6154 #: ../modules.local/hosted-payment/inc/extensions.php:27 147 155 msgid "Hosted: customers get redirected to an external payment page." 148 156 msgstr "" … … 212 220 msgstr "" 213 221 214 #: ../modules.local/payment-gateway/inc/services.php:1 61222 #: ../modules.local/payment-gateway/inc/services.php:156 215 223 msgid "Payoneer Checkout is the next generation of payment processing platforms." 216 224 msgstr "" 217 225 218 226 #. translators: %1$s, %2$s, %3$s and %4$s are replaced with opening and closing 'a' tags. 219 #: ../modules.local/payment-gateway/inc/services.php:16 7227 #: ../modules.local/payment-gateway/inc/services.php:162 220 228 msgid "By using Payoneer Checkout, you agree to the %1$sTerms of Service%2$s and %3$sPrivacy policy%4$s." 221 229 msgstr "" 222 230 223 231 #. translators: %1$s, %2$s, %3$s, %4$s, %5$s and %6$s is replaced with the opening and closing 'a' tags. 224 #: ../modules.local/payment-gateway/inc/services.php:1 91232 #: ../modules.local/payment-gateway/inc/services.php:186 225 233 msgid "Before you begin read How to %1$sConnect WooCommerce%2$s to Payoneer Checkout. Make sure you have a Payoneer Account. If you don't, see %3$sRegister for Checkout%4$s. You can get your %5$sauthentication data%6$s in the Payoneer Account." 226 234 msgstr "" 227 235 228 #: ../modules.local/payment-gateway/inc/services.php:2 13236 #: ../modules.local/payment-gateway/inc/services.php:208 229 237 msgid "Payoneer Checkout" 230 238 msgstr "" 231 239 232 240 #. translators: %1$s is replaced with the refund long ID 233 #: ../modules.local/payment-gateway/inc/services.php:22 9241 #: ../modules.local/payment-gateway/inc/services.php:224 234 242 msgid " Refunded by Payoneer Checkout - long ID: %1$s" 235 243 msgstr "" 236 244 237 #: ../modules.local/payment-gateway/inc/services.php:77 8245 #: ../modules.local/payment-gateway/inc/services.php:773 238 246 msgid "Are you sure you want to reset this field to its default value?" 239 247 msgstr "" … … 260 268 msgstr "" 261 269 270 #: ../modules.local/checkout/src/PaymentProcessor/AbstractPaymentProcessor.php:40 271 msgid "Failed to initialize Payoneer session. Payoneer Checkout is not configured properly." 272 msgstr "" 273 262 274 #: ../modules.local/embedded-payment/src/AjaxOrderPay/AjaxPayAction.php:52 263 275 msgid "Please read and accept the terms and conditions to proceed with your order." … … 268 280 msgstr "" 269 281 270 #: ../modules.local/embedded-payment/src/PaymentProcessor/EmbeddedPaymentProcessor.php:9 0282 #: ../modules.local/embedded-payment/src/PaymentProcessor/EmbeddedPaymentProcessor.php:94 271 283 msgid "API call failed. Please try again or contact the shop admin. Error details can be found in logs." 272 284 msgstr "" 273 285 274 286 #. translators: Transaction ID supplied by WooCommerce plugin 275 #: ../modules.local/embedded-payment/src/PaymentProcessor/EmbeddedPaymentProcessor.php:1 36287 #: ../modules.local/embedded-payment/src/PaymentProcessor/EmbeddedPaymentProcessor.php:140 276 288 msgid "Initiating payment with transaction ID \"%1$s\"" 277 289 msgstr "" 278 290 279 #: ../modules.local/embedded-payment/src/PaymentProcessor/EmbeddedPaymentProcessor.php:17 3291 #: ../modules.local/embedded-payment/src/PaymentProcessor/EmbeddedPaymentProcessor.php:177 280 292 msgid "The payment was not processed. Please try again." 281 293 msgstr "" 282 294 283 #: ../modules.local/hosted-payment/src/PaymentProcessor/HostedPaymentProcessor.php:10 5295 #: ../modules.local/hosted-payment/src/PaymentProcessor/HostedPaymentProcessor.php:109 284 296 msgid "The customer is being redirected to an external payment page." 285 297 msgstr "" 286 298 287 #: ../modules.local/hosted-payment/src/PaymentProcessor/HostedPaymentProcessor.php:1 26299 #: ../modules.local/hosted-payment/src/PaymentProcessor/HostedPaymentProcessor.php:130 288 300 msgid "An error occurred during payment processing" 289 301 msgstr "" … … 308 320 #. translators: Placeholder text if payment fields failed to render 309 321 #: ../modules.local/payment-gateway/src/Gateway/PaymentGateway.php:396 310 msgid "Payment widget failed to initialize due to an error"322 msgid "Payment method not available. Please select another payment method." 311 323 msgstr "" 312 324 -
payoneer-checkout/trunk/modules.local/checkout/inc/extensions.php
r2879805 r2921678 64 64 ) 65 65 ); 66 /** 67 * The WC_Session is not always "booted", for example on order-pay 68 * Our assumption is that if our services depend on WC_Session, 69 * they depend on a *usable* WC_Session. So we initialize it transparently here 70 * @var WC_Session_Handler $session 71 */ 72 if (! $session->has_session()) { 73 $session->init_session_cookie(); 74 $session->set_customer_session_cookie(true); 75 } 66 76 67 if (empty($session->get($tokenField))) { 77 68 $tokenGenerator = $container->get('checkout.security_token_generator'); … … 83 74 }, 84 75 76 'checkout.settings.appearance_settings_fields' => static function ( 77 array $fields, 78 ContainerInterface $container 79 ): array { 80 /** @var array<string, array-key> $amexField */ 81 $amexField = $container->get('checkout.amex_settings_field'); 82 83 return array_merge($fields, $amexField); 84 }, 85 85 86 'inpsyde_payment_gateway.settings_fields' => static function ( 86 87 array $previous, 87 88 ContainerInterface $container 88 89 ): array { 89 /** @var array $generalSettingsFields */90 /** @var array<string, array-key> $generalSettingsFields */ 90 91 $generalSettingsFields = $container->get('checkout.settings.general_settings_fields'); 92 /** @var array<string, array-key> $appearanceSettingsFields */ 93 $appearanceSettingsFields = $container->get('checkout.settings.appearance_settings_fields'); 91 94 92 95 return array_merge( 93 96 $previous, 94 $generalSettingsFields 97 $generalSettingsFields, 98 $appearanceSettingsFields 95 99 ); 96 100 }, … … 196 200 }; 197 201 }, 202 'embedded_payment.settings.fields' => static function ( 203 array $fields, 204 ContainerInterface $container 205 ): array { 206 /** @psalm-var array<string, array-key> $amexField */ 207 $amexField = $container->get('checkout.amex_settings_field'); 208 209 if (! array_key_exists('checkout_css_fieldset_title', $fields)) { 210 return array_merge($fields, $amexField); 211 } 212 213 $combinedFields = []; 214 215 foreach ($fields as $fieldName => $fieldConfig) { 216 $combinedFields[$fieldName] = $fieldConfig; 217 218 if ($fieldName === 'checkout_css_fieldset_title') { 219 $combinedFields = array_merge($combinedFields, $amexField); 220 } 221 } 222 223 return $combinedFields; 224 }, 198 225 ]; 199 226 }; -
payoneer-checkout/trunk/modules.local/checkout/inc/services.php
r2915933 r2921678 38 38 use Inpsyde\PayoneerForWoocommerce\Checkout\ListSession\WcSessionListSessionManager; 39 39 use Inpsyde\PayoneerForWoocommerce\Checkout\ListSession\WcTransientListSessionManager; 40 use Inpsyde\PayoneerForWoocommerce\Checkout\MisconfigurationDetector\MisconfigurationDetector; 40 41 use Inpsyde\PayoneerForWoocommerce\Checkout\PaymentFieldsRenderer\CompoundPaymentFieldsRenderer; 41 42 use Inpsyde\PayoneerForWoocommerce\Checkout\StateProvider\StateProvider; … … 184 185 185 186 'checkout.list_session_manager.cache_key.checkout' => new StringService( 186 'payoneer_list_ {0}_checkout_{1}',187 [' wc.session.customer_id', 'checkout.list_session_manager.cache_key.salt']187 'payoneer_list_checkout_{0}', 188 ['checkout.list_session_manager.cache_key.salt'] 188 189 ), 189 190 'checkout.list_session_manager.cache_key.payment' => new StringService( 190 'payoneer_list_{0}_pay_{1}_{2}', 191 [ 192 'wc.session.customer_id', 191 'payoneer_list_pay_{0}_{1}', 192 [ 193 193 'wc.pay_for_order_id', 194 194 'checkout.list_session_manager.cache_key.salt', … … 503 503 new Constructor(CheckoutHashProvider::class, ['wc']), 504 504 505 'checkout.misconfiguration_detector' => 506 new Constructor(MisconfigurationDetector::class), 507 505 508 'checkout.gateway_icon_elements_filenames' => 506 new Value([ 507 'visa.png', 508 'mastercard.png', 509 ]), 509 new Factory( 510 [ 511 'checkout.amex_icon_enabled', 512 ], 513 static function (bool $amexEnabled): array { 514 $icons = [ 515 'mastercard.svg', 516 'visa.svg', 517 ]; 518 519 if ($amexEnabled) { 520 $icons = array_merge(['amex.svg'], $icons); 521 } 522 523 return $icons; 524 } 525 ), 526 527 'checkout.amex_settings_field' => Service::fromFile( 528 __DIR__ . '/amex_icon_setting_field.php' 529 ), 510 530 511 531 'checkout.gateway_icon_elements' => static function ( … … 537 557 __DIR__ . "/general_settings_fields.php" 538 558 ), 559 560 'checkout.settings.appearance_settings_fields' => Service::fromFile( 561 __DIR__ . "/appearance_settings_fields.php" 562 ), 563 539 564 'checkout.on_error_refresh_fragment_flag' => new Value('payoneer_refresh_fragment_onError'), 540 565 'checkout.is_on_error_refresh_fragment_flag' => new Factory([ … … 630 655 return $optionValue; 631 656 }), 657 'checkout.amex_icon_enabled' => 658 new Factory([ 659 'checkout.payment_gateway_options', 660 ], static function (ContainerInterface $options): bool { 661 if (! $options->has('show_amex_icon')) { 662 return true; //Show icon by default even if options wasn't saved yet. 663 } 664 665 $enabled = $options->get('show_amex_icon') !== 'no'; 666 667 return $enabled; 668 }), 632 669 ]; 633 670 }; -
payoneer-checkout/trunk/modules.local/checkout/src/CheckoutModule.php
r2906967 r2921678 6 6 7 7 use Dhii\Services\Factories\FuncService; 8 use Exception; 8 9 use Inpsyde\Modularity\Module\ExecutableModule; 9 10 use Inpsyde\Modularity\Module\ExtendingModule; … … 11 12 use Inpsyde\Modularity\Module\ServiceModule; 12 13 use Inpsyde\PayoneerForWoocommerce\Checkout\ListSession\ListSessionRemover; 14 use Inpsyde\PayoneerForWoocommerce\Checkout\MisconfigurationDetector\MisconfigurationDetectorInterface; 13 15 use Psr\Container\ContainerInterface; 14 16 use RuntimeException; … … 107 109 $notificationReceivedOptionName = (string) $container->get('checkout.notification_received.option_name'); 108 110 $this->addIncomingWebhookListener($notificationReceivedOptionName); 111 112 $this->addCreateListSessionFailedListener($container); 109 113 110 114 return true; … … 478 482 } 479 483 } 484 485 /** 486 * Add listener hiding payment gateway if failed to create LIST because of authorization issue. 487 * 488 * @param ContainerInterface $container 489 * 490 * @return void 491 */ 492 protected function addCreateListSessionFailedListener(ContainerInterface $container): void 493 { 494 /** 495 * Make our payment gateway unavailable if LIST session wasn't created because of incorrect 496 * merchant configuration. 497 */ 498 add_action('payoneer-checkout.create_list_session_failed', static function ( 499 $arg 500 ) use ($container): void { 501 $isFrontendRequest = $container->get('checkout.is_frontend_request'); 502 if (! $isFrontendRequest) { 503 return; 504 } 505 506 if (! is_array($arg)) { 507 return; 508 } 509 510 $exception = $arg['exception'] ?? null; 511 512 if (! $exception instanceof Exception) { 513 return; 514 } 515 516 $misconfigurationDetector = $container->get('checkout.misconfiguration_detector'); 517 assert($misconfigurationDetector instanceof MisconfigurationDetectorInterface); 518 $exceptionCausedByMisconfiguration = $misconfigurationDetector 519 ->isCausedByMisconfiguration($exception); 520 521 if ($exceptionCausedByMisconfiguration) { 522 $isHostedFlow = $container->get('checkout.selected_payment_flow') === 'hosted'; 523 524 if (! $isHostedFlow) { 525 add_filter( 526 'payoneer-checkout.payment_gateway_is_available', 527 '__return_false' 528 ); 529 } 530 531 do_action('payoneer-checkout.payment_gateway_misconfiguration_detected'); 532 } 533 }); 534 } 480 535 } -
payoneer-checkout/trunk/modules.local/checkout/src/Factory/Customer/WcBasedCustomerFactory.php
r2915933 r2921678 170 170 /** @var mixed $lastName */ 171 171 $lastName = $wcCustomer->get_billing_last_name(); 172 /** @var mixed $ state */173 $ state = $wcCustomer->get_billing_state();172 /** @var mixed $billingStateCode */ 173 $billingStateCode = $wcCustomer->get_billing_state(); 174 174 175 175 $name = $this->nameFactory->createName( … … 181 181 $billingState = $this->stateProvider->provideStateNameByCountryAndStateCode( 182 182 (string) $country, 183 (string) $ state183 (string) $billingStateCode 184 184 ); 185 185 } catch (CheckoutExceptionInterface $exception) { 186 $billingState = null; 186 $billingState = (string) $billingStateCode; 187 $billingState = $billingState === '' ? null : $billingState; 187 188 } 188 189 … … 220 221 /** @var mixed $lastName */ 221 222 $lastName = $wcCustomer->get_shipping_last_name(); 222 /** @var mixed $s tate */223 $s tate = $wcCustomer->get_shipping_state();223 /** @var mixed $shippingStateCode */ 224 $shippingStateCode = $wcCustomer->get_shipping_state(); 224 225 225 226 $name = $this->nameFactory->createName((string) $firstName, (string) $lastName); … … 228 229 $shippingState = $this->stateProvider->provideStateNameByCountryAndStateCode( 229 230 (string) $country, 230 (string) $s tate231 (string) $shippingStateCode 231 232 ); 232 233 } catch (CheckoutExceptionInterface $exception) { 233 $shippingState = null; 234 $shippingState = (string) $shippingStateCode; 235 $shippingState = $shippingState === '' ? null : $shippingState; 234 236 } 235 237 -
payoneer-checkout/trunk/modules.local/checkout/src/Factory/ListSession/OrderBasedListCommandFactory.php
r2879805 r2921678 103 103 $this->wcOrderBasedProductsFactory->createProductsFromWcOrder($order) 104 104 ); 105 if ( $this->division) {105 if (is_string($this->division)) { 106 106 $command = $command->withDivision($this->division); 107 107 } -
payoneer-checkout/trunk/modules.local/checkout/src/PaymentProcessor/AbstractPaymentProcessor.php
r2814392 r2921678 3 3 namespace Inpsyde\PayoneerForWoocommerce\Checkout\PaymentProcessor; 4 4 5 use Inpsyde\PayoneerForWoocommerce\Checkout\MisconfigurationDetector\MisconfigurationDetectorInterface; 5 6 use Inpsyde\PayoneerForWoocommerce\PaymentGateway\PaymentProcessor\PaymentProcessorInterface; 6 7 use Inpsyde\PayoneerSdk\Api\Command\ResponseValidator\InteractionCodeFailureInterface; … … 9 10 abstract class AbstractPaymentProcessor implements PaymentProcessorInterface 10 11 { 12 /** 13 * @var MisconfigurationDetectorInterface 14 */ 15 protected $misconfigurationDetector; 16 17 /** 18 * @param MisconfigurationDetectorInterface $misconfigurationDetector 19 */ 20 public function __construct(MisconfigurationDetectorInterface $misconfigurationDetector) 21 { 22 $this->misconfigurationDetector = $misconfigurationDetector; 23 } 24 11 25 abstract public function processPayment(WC_Order $order): array; 12 26 /** … … 22 36 string $fallback 23 37 ): string { 38 39 if ($this->misconfigurationDetector->isCausedByMisconfiguration($exception)) { 40 return __( 41 'Failed to initialize Payoneer session. Payoneer Checkout is not configured properly.', 42 'payoneer-checkout' 43 ); 44 } 24 45 25 46 $previous = $exception; -
payoneer-checkout/trunk/modules.local/embedded-payment/inc/custom_css_fields.php
r2801406 r2921678 3 3 declare(strict_types=1); 4 4 5 //Setting fields used to render widget CSS in custom mode. 6 return [ 7 'checkout_css_custom_css' => [ 8 'title' => __('Custom CSS', 'payoneer-checkout'), 9 'type' => 'textarea', 10 'description' => __('Enter your custom CSS here', 'payoneer-checkout'), 11 ], 12 ]; 5 use Dhii\Services\Factory; 6 7 return new Factory([ 8 'embedded_payment.is_enabled', 9 'embedded_payment.settings.checkout_css_custom_css.default', 10 ], static function ( 11 bool $embeddedModeEnabled, 12 string $defaultCss 13 ): array { 14 return [ 15 'checkout_css_custom_css' => [ 16 'title' => __('Custom CSS', 'payoneer-checkout'), 17 'type' => 'css', 18 'description' => __( 19 'Customize the look and feel of the payment widget in embedded payment flow', 20 'payoneer-checkout' 21 ), 22 'default' => $defaultCss, 23 'class' => 'code css', 24 'sanitize_callback' => 'strip_tags', 25 'custom_attributes' => $embeddedModeEnabled ? [] : ['readonly' => 'readonly'], 26 ], 27 ]; 28 }); -
payoneer-checkout/trunk/modules.local/embedded-payment/inc/extensions.php
r2879805 r2921678 152 152 return $payload->getOrder()->get_id(); 153 153 }, 154 155 'checkout.settings.appearance_settings_fields' => static function ( 156 array $fields, 157 ContainerInterface $container 158 ): array { 159 /** @var array<string, array-key> $customCssFields */ 160 $customCssFields = $container->get('embedded_payment.settings.fields'); 161 162 return array_merge($fields, $customCssFields); 163 }, 154 164 ]; 155 165 }; -
payoneer-checkout/trunk/modules.local/embedded-payment/inc/services.php
r2906967 r2921678 16 16 use Inpsyde\PayoneerForWoocommerce\Checkout\ListSession\OrderAwareListSessionPersistor; 17 17 use Inpsyde\PayoneerForWoocommerce\Checkout\ListSession\OrderAwareListSessionProvider; 18 use Inpsyde\PayoneerForWoocommerce\Checkout\MisconfigurationDetector\MisconfigurationDetectorInterface; 18 19 use Inpsyde\PayoneerForWoocommerce\EmbeddedPayment\AjaxOrderPay\AjaxPayAction; 19 20 use Inpsyde\PayoneerForWoocommerce\EmbeddedPayment\AjaxOrderPay\OrderPayload; … … 41 42 }), 42 43 'embedded_payment.settings.fields' => static function (ContainerInterface $container) { 43 return (require __DIR__ . "/ fields.php")($container);44 return (require __DIR__ . "/custom_css_fields.php")($container); 44 45 }, 45 46 … … 336 337 'inpsyde_payment_gateway.transaction_id_field_name', 337 338 'checkout.payment_flow_override_flag', 339 'embedded_payment.misconfiguration_detector', 338 340 ], static function ( 339 341 PaymentGateway $paymentGateway, … … 343 345 string $chargeIdFieldName, 344 346 string $transactionIdFieldName, 345 string $hostedModeOverrideFlag 347 string $hostedModeOverrideFlag, 348 MisconfigurationDetectorInterface $misconfigurationDetector 346 349 ): PaymentProcessorInterface { 347 350 return new EmbeddedPaymentProcessor( … … 352 355 $chargeIdFieldName, 353 356 $transactionIdFieldName, 354 $hostedModeOverrideFlag 357 $hostedModeOverrideFlag, 358 $misconfigurationDetector 355 359 ); 356 360 }), -
payoneer-checkout/trunk/modules.local/embedded-payment/src/EmbeddedPaymentModule.php
r2906967 r2921678 356 356 ); 357 357 } catch (CheckoutExceptionInterface $exception) { 358 if ($addNotice) { 358 $misconfigurationDetected = did_action( 359 'payoneer-checkout.payment_gateway_misconfiguration_detected' 360 ); 361 if ($addNotice && ! $misconfigurationDetected) { 359 362 $message = __( 360 ' Failed to initialize Payoneer session based on current checkout data. Possible reasons include incomplete billing data or an invalid order total',363 'The selected payment method for your order is not available at the moment. Please select another payment method.', 361 364 'payoneer-checkout' 362 365 ); -
payoneer-checkout/trunk/modules.local/embedded-payment/src/PaymentProcessor/EmbeddedPaymentProcessor.php
r2906967 r2921678 10 10 use Inpsyde\PayoneerForWoocommerce\Checkout\ListSession\OrderAwareListSessionPersistor; 11 11 use Inpsyde\PayoneerForWoocommerce\Checkout\ListSession\OrderAwareListSessionProvider; 12 use Inpsyde\PayoneerForWoocommerce\Checkout\MisconfigurationDetector\MisconfigurationDetectorInterface; 12 13 use Inpsyde\PayoneerForWoocommerce\Checkout\PaymentProcessor\AbstractPaymentProcessor; 13 14 use Inpsyde\PayoneerForWoocommerce\PaymentGateway\Gateway\CommandFactory\WcOrderBasedUpdateCommandFactoryInterface; … … 61 62 string $chargeIdFieldName, 62 63 string $transactionIdFieldName, 63 string $hostedModeOverrideFlag 64 string $hostedModeOverrideFlag, 65 MisconfigurationDetectorInterface $misconfigurationDetector 64 66 ) { 67 68 parent::__construct($misconfigurationDetector); 65 69 66 70 $this->paymentGateway = $paymentGateway; -
payoneer-checkout/trunk/modules.local/hosted-payment/inc/extensions.php
r2879805 r2921678 7 7 use Inpsyde\PayoneerForWoocommerce\Checkout\Factory\ListSession\OrderBasedListCommandFactoryInterface; 8 8 use Inpsyde\PayoneerForWoocommerce\Checkout\ListSession\WcOrderListSessionPersistor; 9 use Inpsyde\PayoneerForWoocommerce\Checkout\MisconfigurationDetector\MisconfigurationDetectorInterface; 9 10 use Inpsyde\PayoneerForWoocommerce\HostedPayment\PaymentFieldsRenderer\DescriptionFieldRenderer; 10 11 use Inpsyde\PayoneerForWoocommerce\HostedPayment\PaymentProcessor\HostedPaymentProcessor; … … 48 49 'checkout.list_session_persistor.wc_order', 49 50 'inpsyde_payment_gateway.transaction_id_field_name', 51 'hosted_payment.misconfiguration_detector', 50 52 ], 51 53 static function ( 52 54 OrderBasedListCommandFactoryInterface $listCommandFactory, 53 55 WcOrderListSessionPersistor $persistor, 54 string $transactionIdFieldName 56 string $transactionIdFieldName, 57 MisconfigurationDetectorInterface $misconfigurationDetector 55 58 ): PaymentProcessorInterface { 56 59 return new HostedPaymentProcessor( 57 60 $listCommandFactory, 58 61 $persistor, 59 $transactionIdFieldName 62 $transactionIdFieldName, 63 $misconfigurationDetector 60 64 ); 61 65 } -
payoneer-checkout/trunk/modules.local/hosted-payment/src/PaymentProcessor/HostedPaymentProcessor.php
r2837230 r2921678 9 9 use Inpsyde\PayoneerForWoocommerce\Checkout\Factory\ListSession\OrderBasedListCommandFactoryInterface; 10 10 use Inpsyde\PayoneerForWoocommerce\Checkout\ListSession\WcOrderListSessionPersistor; 11 use Inpsyde\PayoneerForWoocommerce\Checkout\MisconfigurationDetector\MisconfigurationDetectorInterface; 11 12 use Inpsyde\PayoneerForWoocommerce\Checkout\PaymentProcessor\AbstractPaymentProcessor; 12 13 use Inpsyde\PayoneerForWoocommerce\Checkout\PaymentProcessor\RedirectUrlCreatorTrait; … … 42 43 OrderBasedListCommandFactoryInterface $listCommandFactory, 43 44 WcOrderListSessionPersistor $listSessionPersistor, 44 string $transactionIdFieldName 45 string $transactionIdFieldName, 46 MisconfigurationDetectorInterface $misconfigurationDetector 45 47 ) { 48 49 parent::__construct($misconfigurationDetector); 46 50 47 51 $this->listCommandFactory = $listCommandFactory; -
payoneer-checkout/trunk/modules.local/payment-gateway/inc/services.php
r2915933 r2921678 111 111 'inpsyde_payment_gateway.is_live_mode', 112 112 'inpsyde_payment_gateway.show_payment_widget_to_customers_in_sandbox_mode', 113 'inpsyde_payment_gateway.is_debug',114 113 ], static function ( 115 114 bool $isLiveMode, 116 bool $renderWidgetInSandboxMode, 117 bool $isDebug 115 bool $renderWidgetInSandboxMode 118 116 ): callable { 119 117 return static function () use ( 120 118 $isLiveMode, 121 $renderWidgetInSandboxMode, 122 $isDebug 119 $renderWidgetInSandboxMode 123 120 ): bool { 124 125 $renderWidgetForCustomers = $renderWidgetInSandboxMode && $isDebug;126 121 127 122 return $isLiveMode || 128 123 current_user_can('manage_woocommerce') || 129 $renderWidget ForCustomers;124 $renderWidgetInSandboxMode; 130 125 }; 131 126 }), -
payoneer-checkout/trunk/modules.local/payment-gateway/src/Gateway/Factory/Customer/WcOrderBasedCustomerFactory.php
r2915933 r2921678 130 130 ); 131 131 132 /** @var mixed $billingStateCode */ 133 $billingStateCode = $order->get_billing_state(); 134 132 135 try { 133 136 $billingState = $this->stateProvider->provideStateNameByCountryAndStateCode( 134 137 $order->get_billing_country(), 135 $order->get_billing_state()138 (string) $billingStateCode 136 139 ); 137 140 } catch (CheckoutExceptionInterface $exception) { 138 $billingState = null; 141 $billingState = (string) $billingStateCode; 142 $billingState = $billingState === '' ? null : $billingState; 139 143 } 140 144 … … 163 167 ); 164 168 169 /** @var mixed $shippingStateCode */ 170 $shippingStateCode = $order->get_shipping_state(); 171 165 172 try { 166 173 $shippingState = $this->stateProvider->provideStateNameByCountryAndStateCode( 167 174 $order->get_shipping_country(), 168 $order->get_shipping_state()175 (string) $shippingStateCode 169 176 ); 170 177 } catch (CheckoutExceptionInterface $exception) { 171 $shippingState = null; 178 $shippingState = (string) $shippingStateCode; 179 $shippingState = $shippingState === '' ? null : $shippingState; 172 180 } 173 181 -
payoneer-checkout/trunk/modules.local/payment-gateway/src/Gateway/PaymentGateway.php
r2895123 r2921678 394 394 // Print a generic error message right in the gateway fields 395 395 /* translators: Placeholder text if payment fields failed to render */ 396 esc_html_e('Payment widget failed to initialize due to an error', 'payoneer-checkout'); 396 esc_html_e( 397 'Payment method not available. Please select another payment method.', 398 'payoneer-checkout' 399 ); 397 400 } 398 401 } -
payoneer-checkout/trunk/modules.local/wp/inc/services.php
r2915933 r2921678 152 152 ], 153 153 static function (WooCommerce $wooCommerce, bool $isAdmin, bool $isAjax): WC_Session { 154 if ( $isAdmin && ! $isAjax) {154 if (($isAdmin && ! $isAjax) || ! $wooCommerce->session instanceof WC_Session) { 155 155 throw new PayoneerException('WooCommerce session is not available.'); 156 156 } 157 $wooCommerce->initialize_session();158 157 159 158 return $wooCommerce->session; 160 }161 ),162 163 'wc.session.customer_id' =>164 new Factory(165 [166 'wc.session',167 ],168 static function (\WC_Session $wcSession): string {169 assert(170 $wcSession instanceof \WC_Session_Handler171 ||172 /**173 * Achieve CoCart compatibility without directly addressing CoCart174 *175 * @see https://github.com/co-cart/co-cart/issues/268#issuecomment-1269806425176 */177 count(178 array_intersect([179 'has_session',180 ], get_class_methods($wcSession))181 )182 );183 184 /**185 * Replicate \WC_Session_Handler::get_customer_unique_id()186 * Which is only present in 5.3+ while we need to support 5.0+187 * @psalm-suppress all188 * phpcs:disable189 */190 $idExtractor = function (): string {191 $id = '';192 if (193 194 $this->has_session()195 && $this->_customer_id196 ) {197 $id = $this->_customer_id;198 } elseif (is_user_logged_in()) {199 $id = (string)get_current_user_id();200 }201 202 return $id;203 };204 //phpcs:enable205 return (string)$idExtractor->call($wcSession);206 159 } 207 160 ), -
payoneer-checkout/trunk/payoneer-checkout.php
r2915933 r2921678 4 4 * Plugin Name: Payoneer Checkout 5 5 * Description: Payoneer Checkout for WooCommerce 6 * Version: 1. 3.26 * Version: 1.4.0-rc3 7 7 * Author: Payoneer 8 8 * Requires at least: 5.4 … … 15 15 * Text Domain: payoneer-checkout 16 16 * Domain Path: /languages 17 * SHA: 853f56317 * SHA: 0b759ed 18 18 */ 19 19 -
payoneer-checkout/trunk/vendor/autoload.php
r2915933 r2921678 23 23 require_once __DIR__ . '/composer/autoload_real.php'; 24 24 25 return ComposerAutoloaderInit 8ad44ad16bf2f8d4f4584bd8fd37ad9f::getLoader();25 return ComposerAutoloaderInit6829d72963e55d0174a46b02fef9558d::getLoader(); -
payoneer-checkout/trunk/vendor/composer/autoload_classmap.php
r2915933 r2921678 205 205 'Inpsyde\\PayoneerForWoocommerce\\Checkout\\ListSession\\WcSessionListSessionManager' => $baseDir . '/modules.local/checkout/src/ListSession/WcSessionListSessionManager.php', 206 206 'Inpsyde\\PayoneerForWoocommerce\\Checkout\\ListSession\\WcTransientListSessionManager' => $baseDir . '/modules.local/checkout/src/ListSession/WcTransientListSessionManager.php', 207 'Inpsyde\\PayoneerForWoocommerce\\Checkout\\MisconfigurationDetector\\MisconfigurationDetector' => $baseDir . '/modules.local/checkout/src/MisconfigurationDetector/MisconfigurationDetector.php', 208 'Inpsyde\\PayoneerForWoocommerce\\Checkout\\MisconfigurationDetector\\MisconfigurationDetectorInterface' => $baseDir . '/modules.local/checkout/src/MisconfigurationDetector/MisconfigurationDetectorInterface.php', 207 209 'Inpsyde\\PayoneerForWoocommerce\\Checkout\\PaymentFieldsRenderer\\CompoundPaymentFieldsRenderer' => $baseDir . '/modules.local/checkout/src/PaymentFieldsRenderer/CompoundPaymentFieldsRenderer.php', 208 210 'Inpsyde\\PayoneerForWoocommerce\\Checkout\\PaymentProcessor\\AbstractPaymentProcessor' => $baseDir . '/modules.local/checkout/src/PaymentProcessor/AbstractPaymentProcessor.php', -
payoneer-checkout/trunk/vendor/composer/autoload_real.php
r2915933 r2921678 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 8ad44ad16bf2f8d4f4584bd8fd37ad9f5 class ComposerAutoloaderInit6829d72963e55d0174a46b02fef9558d 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit 8ad44ad16bf2f8d4f4584bd8fd37ad9f', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInit6829d72963e55d0174a46b02fef9558d', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit 8ad44ad16bf2f8d4f4584bd8fd37ad9f', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInit6829d72963e55d0174a46b02fef9558d', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit 8ad44ad16bf2f8d4f4584bd8fd37ad9f::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInit6829d72963e55d0174a46b02fef9558d::getInitializer($loader)); 33 33 34 34 $loader->register(true); 35 35 36 $filesToLoad = \Composer\Autoload\ComposerStaticInit 8ad44ad16bf2f8d4f4584bd8fd37ad9f::$files;36 $filesToLoad = \Composer\Autoload\ComposerStaticInit6829d72963e55d0174a46b02fef9558d::$files; 37 37 $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { 38 38 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
payoneer-checkout/trunk/vendor/composer/autoload_static.php
r2915933 r2921678 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 8ad44ad16bf2f8d4f4584bd8fd37ad9f7 class ComposerStaticInit6829d72963e55d0174a46b02fef9558d 8 8 { 9 9 public static $files = array ( … … 438 438 'Inpsyde\\PayoneerForWoocommerce\\Checkout\\ListSession\\WcSessionListSessionManager' => __DIR__ . '/../..' . '/modules.local/checkout/src/ListSession/WcSessionListSessionManager.php', 439 439 'Inpsyde\\PayoneerForWoocommerce\\Checkout\\ListSession\\WcTransientListSessionManager' => __DIR__ . '/../..' . '/modules.local/checkout/src/ListSession/WcTransientListSessionManager.php', 440 'Inpsyde\\PayoneerForWoocommerce\\Checkout\\MisconfigurationDetector\\MisconfigurationDetector' => __DIR__ . '/../..' . '/modules.local/checkout/src/MisconfigurationDetector/MisconfigurationDetector.php', 441 'Inpsyde\\PayoneerForWoocommerce\\Checkout\\MisconfigurationDetector\\MisconfigurationDetectorInterface' => __DIR__ . '/../..' . '/modules.local/checkout/src/MisconfigurationDetector/MisconfigurationDetectorInterface.php', 440 442 'Inpsyde\\PayoneerForWoocommerce\\Checkout\\PaymentFieldsRenderer\\CompoundPaymentFieldsRenderer' => __DIR__ . '/../..' . '/modules.local/checkout/src/PaymentFieldsRenderer/CompoundPaymentFieldsRenderer.php', 441 443 'Inpsyde\\PayoneerForWoocommerce\\Checkout\\PaymentProcessor\\AbstractPaymentProcessor' => __DIR__ . '/../..' . '/modules.local/checkout/src/PaymentProcessor/AbstractPaymentProcessor.php', … … 859 861 { 860 862 return \Closure::bind(function () use ($loader) { 861 $loader->prefixLengthsPsr4 = ComposerStaticInit 8ad44ad16bf2f8d4f4584bd8fd37ad9f::$prefixLengthsPsr4;862 $loader->prefixDirsPsr4 = ComposerStaticInit 8ad44ad16bf2f8d4f4584bd8fd37ad9f::$prefixDirsPsr4;863 $loader->classMap = ComposerStaticInit 8ad44ad16bf2f8d4f4584bd8fd37ad9f::$classMap;863 $loader->prefixLengthsPsr4 = ComposerStaticInit6829d72963e55d0174a46b02fef9558d::$prefixLengthsPsr4; 864 $loader->prefixDirsPsr4 = ComposerStaticInit6829d72963e55d0174a46b02fef9558d::$prefixDirsPsr4; 865 $loader->classMap = ComposerStaticInit6829d72963e55d0174a46b02fef9558d::$classMap; 864 866 865 867 }, null, ClassLoader::class); -
payoneer-checkout/trunk/vendor/composer/installed.php
r2915933 r2921678 2 2 'root' => array( 3 3 'name' => 'inpsyde/payoneer-checkout', 4 'pretty_version' => 'dev-release/1. 3.2',5 'version' => 'dev-release/1. 3.2',6 'reference' => ' 853f5638ad5614d9c343391533b6e7c4d5bb00c5',4 'pretty_version' => 'dev-release/1.4.0', 5 'version' => 'dev-release/1.4.0', 6 'reference' => '0b759edaef2068d711a2a299b5000e464e2fc6ca', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 113 113 ), 114 114 'inpsyde/payoneer-checkout' => array( 115 'pretty_version' => 'dev-release/1. 3.2',116 'version' => 'dev-release/1. 3.2',117 'reference' => ' 853f5638ad5614d9c343391533b6e7c4d5bb00c5',115 'pretty_version' => 'dev-release/1.4.0', 116 'version' => 'dev-release/1.4.0', 117 'reference' => '0b759edaef2068d711a2a299b5000e464e2fc6ca', 118 118 'type' => 'wordpress-plugin', 119 119 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.