WooCommerce PayPal Payments - Version 1.8.0

Version Description

  • Add - Allow free trial subscriptions #580
  • Fix - The Card Processing does not appear as an available payment method when manually creating an order #562
  • Fix - Express buttons & Pay Later visible on variable Subscription products /w disabled vaulting #281
  • Fix - Pay for order (guest) failing when no email address available #535
  • Fix - Emoji in product description causing INVALID_STRING_LENGTH error #491
  • Enhancement - Change cart total amount that is sent to PayPal gateway #486
  • Enhancement - Include dark Visa and Mastercard gateway icon list for PayPal Card Processing #566
  • Enhancement - Onboarding errors improvements #558
  • Enhancement - "Place order" button visible during gateway load time when DCC gateway is selected as the default #560
Download this release

Release Info

Developer automattic
Plugin Icon 128x128 WooCommerce PayPal Payments
Version 1.8.0
Comparing to
See all releases

Code changes from version 1.7.1 to 1.8.0

Files changed (52) hide show
  1. changelog.txt +11 -0
  2. modules/ppcp-api-client/services.php +13 -1
  3. modules/ppcp-api-client/src/Endpoint/OrderEndpoint.php +6 -1
  4. modules/ppcp-api-client/src/Endpoint/PaymentTokenEndpoint.php +155 -11
  5. modules/ppcp-api-client/src/Entity/PaymentTokenActionLinks.php +76 -0
  6. modules/ppcp-api-client/src/Entity/PurchaseUnit.php +9 -0
  7. modules/ppcp-api-client/src/Exception/AlreadyVaultedException.php +16 -0
  8. modules/ppcp-api-client/src/Factory/AmountFactory.php +18 -3
  9. modules/ppcp-api-client/src/Factory/ItemFactory.php +1 -1
  10. modules/ppcp-api-client/src/Factory/PaymentTokenActionLinksFactory.php +53 -0
  11. modules/ppcp-api-client/src/Repository/OrderRepository.php +54 -0
  12. modules/ppcp-api-client/src/Repository/PayPalRequestIdRepository.php +29 -7
  13. modules/ppcp-button/assets/js/button.js +1 -1
  14. modules/ppcp-button/resources/js/button.js +34 -2
  15. modules/ppcp-button/resources/js/modules/ActionHandler/CartActionHandler.js +3 -0
  16. modules/ppcp-button/resources/js/modules/ActionHandler/CheckoutActionHandler.js +3 -0
  17. modules/ppcp-button/resources/js/modules/ActionHandler/FreeTrialHandler.js +43 -0
  18. modules/ppcp-button/resources/js/modules/ActionHandler/SingleProductActionHandler.js +3 -0
  19. modules/ppcp-button/resources/js/modules/ContextBootstrap/CheckoutBootstap.js +7 -4
  20. modules/ppcp-button/resources/js/modules/Renderer/CreditCardRenderer.js +6 -1
  21. modules/ppcp-button/services.php +11 -1
  22. modules/ppcp-button/src/Assets/SmartButton.php +140 -7
  23. modules/ppcp-button/src/ButtonModule.php +10 -0
  24. modules/ppcp-button/src/Endpoint/CreateOrderEndpoint.php +24 -2
  25. modules/ppcp-button/src/Endpoint/StartPayPalVaultingEndpoint.php +111 -0
  26. modules/ppcp-onboarding/assets/js/settings.js +33 -1
  27. modules/ppcp-onboarding/src/OnboardingRESTController.php +2 -1
  28. modules/ppcp-onboarding/src/Render/OnboardingRenderer.php +5 -3
  29. modules/ppcp-subscription/src/FreeTrialHandlerTrait.php +94 -0
  30. modules/ppcp-subscription/src/Helper/SubscriptionHelper.php +8 -24
  31. modules/ppcp-subscription/src/SubscriptionsHandlerTrait.php +26 -0
  32. modules/ppcp-vaulting/services.php +13 -7
  33. modules/ppcp-vaulting/src/CustomerApprovalListener.php +110 -0
  34. modules/ppcp-vaulting/src/PaymentTokenChecker.php +29 -64
  35. modules/ppcp-vaulting/src/VaultingModule.php +5 -0
  36. modules/ppcp-vaulting/yarn.lock +3 -3
  37. modules/ppcp-wc-gateway/extensions.php +1 -2
  38. modules/ppcp-wc-gateway/services.php +50 -23
  39. modules/ppcp-wc-gateway/src/Gateway/CreditCardGateway.php +4 -2
  40. modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php +1 -0
  41. modules/ppcp-wc-gateway/src/Gateway/ProcessPaymentTrait.php +30 -2
  42. modules/ppcp-wc-gateway/src/Processor/AuthorizedPaymentsProcessor.php +34 -0
  43. modules/ppcp-wc-gateway/src/Processor/OrderMetaTrait.php +24 -0
  44. modules/ppcp-wc-gateway/yarn.lock +3 -3
  45. modules/ppcp-webhooks/yarn.lock +3 -3
  46. psalm-baseline.xml +1 -57
  47. psalm.xml.dist +1 -0
  48. readme.txt +12 -1
  49. vendor/autoload.php +1 -1
  50. vendor/composer/autoload_real.php +7 -7
  51. vendor/composer/autoload_static.php +4 -4
  52. woocommerce-paypal-payments.php +3 -3
changelog.txt CHANGED
@@ -1,5 +1,16 @@
1
  *** Changelog ***
2
 
 
 
 
 
 
 
 
 
 
 
 
3
  = 1.7.1 - 2022-04-06 =
4
  * Fix - Hide smart buttons for free products and zero-sum carts #499
5
  * Fix - Unprocessable Entity when paying with AMEX card #516
1
  *** Changelog ***
2
 
3
+ = 1.8.0 - 2022-05-03 =
4
+ * Add - Allow free trial subscriptions #580
5
+ * Fix - The Card Processing does not appear as an available payment method when manually creating an order #562
6
+ * Fix - Express buttons & Pay Later visible on variable Subscription products /w disabled vaulting #281
7
+ * Fix - Pay for order (guest) failing when no email address available #535
8
+ * Fix - Emoji in product description causing INVALID_STRING_LENGTH error #491
9
+ * Enhancement - Change cart total amount that is sent to PayPal gateway #486
10
+ * Enhancement - Include dark Visa and Mastercard gateway icon list for PayPal Card Processing #566
11
+ * Enhancement - Onboarding errors improvements #558
12
+ * Enhancement - "Place order" button visible during gateway load time when DCC gateway is selected as the default #560
13
+
14
  = 1.7.1 - 2022-04-06 =
15
  * Fix - Hide smart buttons for free products and zero-sum carts #499
16
  * Fix - Unprocessable Entity when paying with AMEX card #516
modules/ppcp-api-client/services.php CHANGED
@@ -35,6 +35,7 @@ use WooCommerce\PayPalCommerce\ApiClient\Factory\PayeeFactory;
35
  use WooCommerce\PayPalCommerce\ApiClient\Factory\PayerFactory;
36
  use WooCommerce\PayPalCommerce\ApiClient\Factory\PaymentsFactory;
37
  use WooCommerce\PayPalCommerce\ApiClient\Factory\PaymentSourceFactory;
 
38
  use WooCommerce\PayPalCommerce\ApiClient\Factory\PaymentTokenFactory;
39
  use WooCommerce\PayPalCommerce\ApiClient\Factory\PlatformFeeFactory;
40
  use WooCommerce\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
@@ -48,6 +49,7 @@ use WooCommerce\PayPalCommerce\ApiClient\Helper\DccApplies;
48
  use WooCommerce\PayPalCommerce\ApiClient\Repository\ApplicationContextRepository;
49
  use WooCommerce\PayPalCommerce\ApiClient\Repository\CartRepository;
50
  use WooCommerce\PayPalCommerce\ApiClient\Repository\CustomerRepository;
 
51
  use WooCommerce\PayPalCommerce\ApiClient\Repository\PartnerReferralsData;
52
  use WooCommerce\PayPalCommerce\ApiClient\Repository\PayeeRepository;
53
  use WooCommerce\PayPalCommerce\ApiClient\Repository\PayPalRequestIdRepository;
@@ -112,8 +114,10 @@ return array(
112
  $container->get( 'api.host' ),
113
  $container->get( 'api.bearer' ),
114
  $container->get( 'api.factory.payment-token' ),
 
115
  $container->get( 'woocommerce.logger.woocommerce' ),
116
- $container->get( 'api.repository.customer' )
 
117
  );
118
  },
119
  'api.endpoint.webhook' => static function ( ContainerInterface $container ) : WebhookEndpoint {
@@ -228,12 +232,20 @@ return array(
228
  $prefix = $container->get( 'api.prefix' );
229
  return new CustomerRepository( $prefix );
230
  },
 
 
 
 
 
231
  'api.factory.application-context' => static function ( ContainerInterface $container ) : ApplicationContextFactory {
232
  return new ApplicationContextFactory();
233
  },
234
  'api.factory.payment-token' => static function ( ContainerInterface $container ) : PaymentTokenFactory {
235
  return new PaymentTokenFactory();
236
  },
 
 
 
237
  'api.factory.webhook' => static function ( ContainerInterface $container ): WebhookFactory {
238
  return new WebhookFactory();
239
  },
35
  use WooCommerce\PayPalCommerce\ApiClient\Factory\PayerFactory;
36
  use WooCommerce\PayPalCommerce\ApiClient\Factory\PaymentsFactory;
37
  use WooCommerce\PayPalCommerce\ApiClient\Factory\PaymentSourceFactory;
38
+ use WooCommerce\PayPalCommerce\ApiClient\Factory\PaymentTokenActionLinksFactory;
39
  use WooCommerce\PayPalCommerce\ApiClient\Factory\PaymentTokenFactory;
40
  use WooCommerce\PayPalCommerce\ApiClient\Factory\PlatformFeeFactory;
41
  use WooCommerce\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
49
  use WooCommerce\PayPalCommerce\ApiClient\Repository\ApplicationContextRepository;
50
  use WooCommerce\PayPalCommerce\ApiClient\Repository\CartRepository;
51
  use WooCommerce\PayPalCommerce\ApiClient\Repository\CustomerRepository;
52
+ use WooCommerce\PayPalCommerce\ApiClient\Repository\OrderRepository;
53
  use WooCommerce\PayPalCommerce\ApiClient\Repository\PartnerReferralsData;
54
  use WooCommerce\PayPalCommerce\ApiClient\Repository\PayeeRepository;
55
  use WooCommerce\PayPalCommerce\ApiClient\Repository\PayPalRequestIdRepository;
114
  $container->get( 'api.host' ),
115
  $container->get( 'api.bearer' ),
116
  $container->get( 'api.factory.payment-token' ),
117
+ $container->get( 'api.factory.payment-token-action-links' ),
118
  $container->get( 'woocommerce.logger.woocommerce' ),
119
+ $container->get( 'api.repository.customer' ),
120
+ $container->get( 'api.repository.paypal-request-id' )
121
  );
122
  },
123
  'api.endpoint.webhook' => static function ( ContainerInterface $container ) : WebhookEndpoint {
232
  $prefix = $container->get( 'api.prefix' );
233
  return new CustomerRepository( $prefix );
234
  },
235
+ 'api.repository.order' => static function( ContainerInterface $container ): OrderRepository {
236
+ return new OrderRepository(
237
+ $container->get( 'api.endpoint.order' )
238
+ );
239
+ },
240
  'api.factory.application-context' => static function ( ContainerInterface $container ) : ApplicationContextFactory {
241
  return new ApplicationContextFactory();
242
  },
243
  'api.factory.payment-token' => static function ( ContainerInterface $container ) : PaymentTokenFactory {
244
  return new PaymentTokenFactory();
245
  },
246
+ 'api.factory.payment-token-action-links' => static function ( ContainerInterface $container ) : PaymentTokenActionLinksFactory {
247
+ return new PaymentTokenActionLinksFactory();
248
+ },
249
  'api.factory.webhook' => static function ( ContainerInterface $container ): WebhookFactory {
250
  return new WebhookFactory();
251
  },
modules/ppcp-api-client/src/Endpoint/OrderEndpoint.php CHANGED
@@ -226,7 +226,7 @@ class OrderEndpoint {
226
  'application_context' => $this->application_context_repository
227
  ->current_context( $shipping_preference )->to_array(),
228
  );
229
- if ( $payer ) {
230
  $data['payer'] = $payer->to_array();
231
  }
232
  if ( $payment_token ) {
@@ -235,6 +235,11 @@ class OrderEndpoint {
235
  if ( $payment_method ) {
236
  $data['payment_method'] = $payment_method->to_array();
237
  }
 
 
 
 
 
238
  $url = trailingslashit( $this->host ) . 'v2/checkout/orders';
239
  $args = array(
240
  'method' => 'POST',
226
  'application_context' => $this->application_context_repository
227
  ->current_context( $shipping_preference )->to_array(),
228
  );
229
+ if ( $payer && ! empty( $payer->email_address() ) && ! empty( $payer->name() ) ) {
230
  $data['payer'] = $payer->to_array();
231
  }
232
  if ( $payment_token ) {
235
  if ( $payment_method ) {
236
  $data['payment_method'] = $payment_method->to_array();
237
  }
238
+
239
+ /**
240
+ * The filter can be used to modify the order creation request body data.
241
+ */
242
+ $data = apply_filters( 'ppcp_create_order_request_body_data', $data );
243
  $url = trailingslashit( $this->host ) . 'v2/checkout/orders';
244
  $args = array(
245
  'method' => 'POST',
modules/ppcp-api-client/src/Endpoint/PaymentTokenEndpoint.php CHANGED
@@ -11,11 +11,15 @@ namespace WooCommerce\PayPalCommerce\ApiClient\Endpoint;
11
 
12
  use WooCommerce\PayPalCommerce\ApiClient\Authentication\Bearer;
13
  use WooCommerce\PayPalCommerce\ApiClient\Entity\PaymentToken;
 
 
14
  use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException;
15
  use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
 
16
  use WooCommerce\PayPalCommerce\ApiClient\Factory\PaymentTokenFactory;
17
  use Psr\Log\LoggerInterface;
18
  use WooCommerce\PayPalCommerce\ApiClient\Repository\CustomerRepository;
 
19
 
20
  /**
21
  * Class PaymentTokenEndpoint
@@ -45,6 +49,13 @@ class PaymentTokenEndpoint {
45
  */
46
  private $factory;
47
 
 
 
 
 
 
 
 
48
  /**
49
  * The logger.
50
  *
@@ -59,28 +70,41 @@ class PaymentTokenEndpoint {
59
  */
60
  protected $customer_repository;
61
 
 
 
 
 
 
 
 
62
  /**
63
  * PaymentTokenEndpoint constructor.
64
  *
65
- * @param string $host The host.
66
- * @param Bearer $bearer The bearer.
67
- * @param PaymentTokenFactory $factory The payment token factory.
68
- * @param LoggerInterface $logger The logger.
69
- * @param CustomerRepository $customer_repository The customer repository.
 
 
70
  */
71
  public function __construct(
72
  string $host,
73
  Bearer $bearer,
74
  PaymentTokenFactory $factory,
 
75
  LoggerInterface $logger,
76
- CustomerRepository $customer_repository
 
77
  ) {
78
 
79
- $this->host = $host;
80
- $this->bearer = $bearer;
81
- $this->factory = $factory;
82
- $this->logger = $logger;
83
- $this->customer_repository = $customer_repository;
 
 
84
  }
85
 
86
  /**
@@ -183,4 +207,124 @@ class PaymentTokenEndpoint {
183
 
184
  return wp_remote_retrieve_response_code( $response ) === 204;
185
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  }
11
 
12
  use WooCommerce\PayPalCommerce\ApiClient\Authentication\Bearer;
13
  use WooCommerce\PayPalCommerce\ApiClient\Entity\PaymentToken;
14
+ use WooCommerce\PayPalCommerce\ApiClient\Entity\PaymentTokenActionLinks;
15
+ use WooCommerce\PayPalCommerce\ApiClient\Exception\AlreadyVaultedException;
16
  use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException;
17
  use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
18
+ use WooCommerce\PayPalCommerce\ApiClient\Factory\PaymentTokenActionLinksFactory;
19
  use WooCommerce\PayPalCommerce\ApiClient\Factory\PaymentTokenFactory;
20
  use Psr\Log\LoggerInterface;
21
  use WooCommerce\PayPalCommerce\ApiClient\Repository\CustomerRepository;
22
+ use WooCommerce\PayPalCommerce\ApiClient\Repository\PayPalRequestIdRepository;
23
 
24
  /**
25
  * Class PaymentTokenEndpoint
49
  */
50
  private $factory;
51
 
52
+ /**
53
+ * The PaymentTokenActionLinks factory.
54
+ *
55
+ * @var PaymentTokenActionLinksFactory
56
+ */
57
+ private $payment_token_action_links_factory;
58
+
59
  /**
60
  * The logger.
61
  *
70
  */
71
  protected $customer_repository;
72
 
73
+ /**
74
+ * The request id repository.
75
+ *
76
+ * @var PayPalRequestIdRepository
77
+ */
78
+ private $request_id_repository;
79
+
80
  /**
81
  * PaymentTokenEndpoint constructor.
82
  *
83
+ * @param string $host The host.
84
+ * @param Bearer $bearer The bearer.
85
+ * @param PaymentTokenFactory $factory The payment token factory.
86
+ * @param PaymentTokenActionLinksFactory $payment_token_action_links_factory The PaymentTokenActionLinks factory.
87
+ * @param LoggerInterface $logger The logger.
88
+ * @param CustomerRepository $customer_repository The customer repository.
89
+ * @param PayPalRequestIdRepository $request_id_repository The request id repository.
90
  */
91
  public function __construct(
92
  string $host,
93
  Bearer $bearer,
94
  PaymentTokenFactory $factory,
95
+ PaymentTokenActionLinksFactory $payment_token_action_links_factory,
96
  LoggerInterface $logger,
97
+ CustomerRepository $customer_repository,
98
+ PayPalRequestIdRepository $request_id_repository
99
  ) {
100
 
101
+ $this->host = $host;
102
+ $this->bearer = $bearer;
103
+ $this->factory = $factory;
104
+ $this->payment_token_action_links_factory = $payment_token_action_links_factory;
105
+ $this->logger = $logger;
106
+ $this->customer_repository = $customer_repository;
107
+ $this->request_id_repository = $request_id_repository;
108
  }
109
 
110
  /**
207
 
208
  return wp_remote_retrieve_response_code( $response ) === 204;
209
  }
210
+
211
+ /**
212
+ * Starts the process of PayPal account vaulting (without payment), returns the links for further actions.
213
+ *
214
+ * @param int $user_id The WP user id.
215
+ * @param string $return_url The URL to which the customer is redirected after finishing the approval.
216
+ * @param string $cancel_url The URL to which the customer is redirected if cancelled the operation.
217
+ *
218
+ * @return PaymentTokenActionLinks
219
+ * @throws RuntimeException If the request fails.
220
+ * @throws PayPalApiException If the request fails.
221
+ */
222
+ public function start_paypal_token_creation(
223
+ int $user_id,
224
+ string $return_url,
225
+ string $cancel_url
226
+ ): PaymentTokenActionLinks {
227
+ $bearer = $this->bearer->bearer();
228
+
229
+ $url = trailingslashit( $this->host ) . 'v2/vault/payment-tokens';
230
+
231
+ $customer_id = $this->customer_repository->customer_id_for_user( ( $user_id ) );
232
+ $data = array(
233
+ 'customer_id' => $customer_id,
234
+ 'source' => array(
235
+ 'paypal' => array(
236
+ 'usage_type' => 'MERCHANT',
237
+ ),
238
+ ),
239
+ 'application_context' => array(
240
+ 'return_url' => $return_url,
241
+ 'cancel_url' => $cancel_url,
242
+ // TODO: can use vault_on_approval to avoid /confirm-payment-token, but currently it's not working.
243
+ ),
244
+ );
245
+
246
+ $request_id = uniqid( 'ppcp-vault', true );
247
+
248
+ $args = array(
249
+ 'method' => 'POST',
250
+ 'headers' => array(
251
+ 'Authorization' => 'Bearer ' . $bearer->token(),
252
+ 'Content-Type' => 'application/json',
253
+ 'Request-Id' => $request_id,
254
+ ),
255
+ 'body' => wp_json_encode( $data ),
256
+ );
257
+
258
+ $response = $this->request( $url, $args );
259
+
260
+ if ( is_wp_error( $response ) || ! is_array( $response ) ) {
261
+ throw new RuntimeException( 'Failed to create payment token.' );
262
+ }
263
+
264
+ $json = json_decode( $response['body'] );
265
+ $status_code = (int) wp_remote_retrieve_response_code( $response );
266
+ if ( 200 !== $status_code ) {
267
+ throw new PayPalApiException(
268
+ $json,
269
+ $status_code
270
+ );
271
+ }
272
+
273
+ $status = $json->status;
274
+ if ( 'CUSTOMER_ACTION_REQUIRED' !== $status ) {
275
+ throw new RuntimeException( 'Unexpected payment token creation status. ' . $status );
276
+ }
277
+
278
+ $links = $this->payment_token_action_links_factory->from_paypal_response( $json );
279
+
280
+ $this->request_id_repository->set( "ppcp-vault-{$user_id}", $request_id );
281
+
282
+ return $links;
283
+ }
284
+
285
+ /**
286
+ * Finishes the process of PayPal account vaulting.
287
+ *
288
+ * @param string $approval_token The id of the approval token approved by the customer.
289
+ * @param int $user_id The WP user id.
290
+ *
291
+ * @return string
292
+ * @throws RuntimeException If the request fails.
293
+ * @throws PayPalApiException If the request fails.
294
+ * @throws AlreadyVaultedException When new token was not created (for example, already vaulted with this merchant).
295
+ */
296
+ public function create_from_approval_token( string $approval_token, int $user_id ): string {
297
+ $bearer = $this->bearer->bearer();
298
+
299
+ $url = trailingslashit( $this->host ) . 'v2/vault/approval-tokens/' . $approval_token . '/confirm-payment-token';
300
+
301
+ $args = array(
302
+ 'method' => 'POST',
303
+ 'headers' => array(
304
+ 'Authorization' => 'Bearer ' . $bearer->token(),
305
+ 'Request-Id' => $this->request_id_repository->get( "ppcp-vault-{$user_id}" ),
306
+ 'Content-Type' => 'application/json',
307
+ ),
308
+ );
309
+
310
+ $response = $this->request( $url, $args );
311
+
312
+ if ( is_wp_error( $response ) || ! is_array( $response ) ) {
313
+ throw new RuntimeException( 'Failed to create payment token from approval token.' );
314
+ }
315
+
316
+ $json = json_decode( $response['body'] );
317
+ $status_code = (int) wp_remote_retrieve_response_code( $response );
318
+ if ( 200 === $status_code ) {
319
+ throw new AlreadyVaultedException( 'Already vaulted.' );
320
+ }
321
+ if ( 201 !== $status_code ) {
322
+ throw new PayPalApiException(
323
+ $json,
324
+ $status_code
325
+ );
326
+ }
327
+
328
+ return $json->id;
329
+ }
330
  }
modules/ppcp-api-client/src/Entity/PaymentTokenActionLinks.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The links from CUSTOMER_ACTION_REQUIRED v2/vault/payment-tokens response.
4
+ *
5
+ * @package WooCommerce\PayPalCommerce\ApiClient\Entity
6
+ */
7
+
8
+ declare(strict_types=1);
9
+
10
+ namespace WooCommerce\PayPalCommerce\ApiClient\Entity;
11
+
12
+ /**
13
+ * Class PaymentTokenActionLinks
14
+ */
15
+ class PaymentTokenActionLinks {
16
+ /**
17
+ * The URL for customer PayPal hosted contingency flow.
18
+ *
19
+ * @var string
20
+ */
21
+ private $approve_link;
22
+
23
+ /**
24
+ * The URL for a POST request to save an approved approval token and vault the underlying instrument.
25
+ *
26
+ * @var string
27
+ */
28
+ private $confirm_link;
29
+
30
+ /**
31
+ * The URL for a GET request to get the state of the approval token.
32
+ *
33
+ * @var string
34
+ */
35
+ private $status_link;
36
+
37
+ /**
38
+ * PaymentTokenActionLinks constructor.
39
+ *
40
+ * @param string $approve_link The URL for customer PayPal hosted contingency flow.
41
+ * @param string $confirm_link The URL for a POST request to save an approved approval token and vault the underlying instrument.
42
+ * @param string $status_link The URL for a GET request to get the state of the approval token.
43
+ */
44
+ public function __construct( string $approve_link, string $confirm_link, string $status_link ) {
45
+ $this->approve_link = $approve_link;
46
+ $this->confirm_link = $confirm_link;
47
+ $this->status_link = $status_link;
48
+ }
49
+
50
+ /**
51
+ * Returns the URL for customer PayPal hosted contingency flow.
52
+ *
53
+ * @return string
54
+ */
55
+ public function approve_link(): string {
56
+ return $this->approve_link;
57
+ }
58
+
59
+ /**
60
+ * Returns the URL for a POST request to save an approved approval token and vault the underlying instrument.
61
+ *
62
+ * @return string
63
+ */
64
+ public function confirm_link(): string {
65
+ return $this->confirm_link;
66
+ }
67
+
68
+ /**
69
+ * Returns the URL for a GET request to get the state of the approval token.
70
+ *
71
+ * @return string
72
+ */
73
+ public function status_link(): string {
74
+ return $this->status_link;
75
+ }
76
+ }
modules/ppcp-api-client/src/Entity/PurchaseUnit.php CHANGED
@@ -157,6 +157,15 @@ class PurchaseUnit {
157
  return $this->amount;
158
  }
159
 
 
 
 
 
 
 
 
 
 
160
  /**
161
  * Returns the shipping.
162
  *
157
  return $this->amount;
158
  }
159
 
160
+ /**
161
+ * Sets the amount.
162
+ *
163
+ * @param Amount $amount The value to set.
164
+ */
165
+ public function set_amount( Amount $amount ): void {
166
+ $this->amount = $amount;
167
+ }
168
+
169
  /**
170
  * Returns the shipping.
171
  *
modules/ppcp-api-client/src/Exception/AlreadyVaultedException.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * AlreadyVaultedException.
4
+ *
5
+ * @package WooCommerce\PayPalCommerce\ApiClient\Exception
6
+ */
7
+
8
+ declare(strict_types=1);
9
+
10
+ namespace WooCommerce\PayPalCommerce\ApiClient\Exception;
11
+
12
+ /**
13
+ * Class AlreadyVaultedException
14
+ */
15
+ class AlreadyVaultedException extends RuntimeException {
16
+ }
modules/ppcp-api-client/src/Factory/AmountFactory.php CHANGED
@@ -14,12 +14,16 @@ use WooCommerce\PayPalCommerce\ApiClient\Entity\AmountBreakdown;
14
  use WooCommerce\PayPalCommerce\ApiClient\Entity\Item;
15
  use WooCommerce\PayPalCommerce\ApiClient\Entity\Money;
16
  use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
 
 
 
17
 
18
  /**
19
  * Class AmountFactory
20
  */
21
  class AmountFactory {
22
 
 
23
 
24
  /**
25
  * The item factory.
@@ -117,9 +121,20 @@ class AmountFactory {
117
  * @return Amount
118
  */
119
  public function from_wc_order( \WC_Order $order ): Amount {
120
- $currency = $order->get_currency();
121
- $items = $this->item_factory->from_wc_order( $order );
122
- $total = new Money( (float) $order->get_total(), $currency );
 
 
 
 
 
 
 
 
 
 
 
123
  $item_total = new Money(
124
  (float) array_reduce(
125
  $items,
14
  use WooCommerce\PayPalCommerce\ApiClient\Entity\Item;
15
  use WooCommerce\PayPalCommerce\ApiClient\Entity\Money;
16
  use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
17
+ use WooCommerce\PayPalCommerce\Subscription\FreeTrialHandlerTrait;
18
+ use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
19
+ use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
20
 
21
  /**
22
  * Class AmountFactory
23
  */
24
  class AmountFactory {
25
 
26
+ use FreeTrialHandlerTrait;
27
 
28
  /**
29
  * The item factory.
121
  * @return Amount
122
  */
123
  public function from_wc_order( \WC_Order $order ): Amount {
124
+ $currency = $order->get_currency();
125
+ $items = $this->item_factory->from_wc_order( $order );
126
+
127
+ $total_value = (float) $order->get_total();
128
+ if ( (
129
+ CreditCardGateway::ID === $order->get_payment_method()
130
+ || ( PayPalGateway::ID === $order->get_payment_method() && 'card' === $order->get_meta( PayPalGateway::ORDER_PAYMENT_SOURCE ) )
131
+ )
132
+ && $this->is_free_trial_order( $order )
133
+ ) {
134
+ $total_value = 1.0;
135
+ }
136
+ $total = new Money( $total_value, $currency );
137
+
138
  $item_total = new Money(
139
  (float) array_reduce(
140
  $items,
modules/ppcp-api-client/src/Factory/ItemFactory.php CHANGED
@@ -62,7 +62,7 @@ class ItemFactory {
62
  mb_substr( $product->get_name(), 0, 127 ),
63
  new Money( $price_without_tax_rounded, $this->currency ),
64
  $quantity,
65
- mb_substr( wp_strip_all_tags( $product->get_description() ), 0, 127 ),
66
  $tax,
67
  $product->get_sku(),
68
  ( $product->is_virtual() ) ? Item::DIGITAL_GOODS : Item::PHYSICAL_GOODS
62
  mb_substr( $product->get_name(), 0, 127 ),
63
  new Money( $price_without_tax_rounded, $this->currency ),
64
  $quantity,
65
+ substr( wp_strip_all_tags( $product->get_description() ), 0, 127 ) ?: '',
66
  $tax,
67
  $product->get_sku(),
68
  ( $product->is_virtual() ) ? Item::DIGITAL_GOODS : Item::PHYSICAL_GOODS
modules/ppcp-api-client/src/Factory/PaymentTokenActionLinksFactory.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The factory for links from CUSTOMER_ACTION_REQUIRED v2/vault/payment-tokens response.
4
+ *
5
+ * @package WooCommerce\PayPalCommerce\ApiClient\Factory
6
+ */
7
+
8
+ declare(strict_types=1);
9
+
10
+ namespace WooCommerce\PayPalCommerce\ApiClient\Factory;
11
+
12
+ use stdClass;
13
+ use WooCommerce\PayPalCommerce\ApiClient\Entity\PaymentTokenActionLinks;
14
+ use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
15
+
16
+ /**
17
+ * Class PaymentTokenActionLinksFactory
18
+ */
19
+ class PaymentTokenActionLinksFactory {
20
+
21
+ /**
22
+ * Returns a PaymentTokenActionLinks object based off a PayPal response.
23
+ *
24
+ * @param stdClass $data The JSON object.
25
+ *
26
+ * @return PaymentTokenActionLinks
27
+ * @throws RuntimeException When JSON object is malformed.
28
+ */
29
+ public function from_paypal_response( stdClass $data ): PaymentTokenActionLinks {
30
+ if ( ! isset( $data->links ) ) {
31
+ throw new RuntimeException( 'Links not found.' );
32
+ }
33
+
34
+ $links_map = array();
35
+ foreach ( $data->links as $link ) {
36
+ if ( ! isset( $link->rel ) || ! isset( $link->href ) ) {
37
+ throw new RuntimeException( 'Invalid link data.' );
38
+ }
39
+
40
+ $links_map[ $link->rel ] = $link->href;
41
+ }
42
+
43
+ if ( ! array_key_exists( 'approve', $links_map ) ) {
44
+ throw new RuntimeException( 'Payment token approve link not found.' );
45
+ }
46
+
47
+ return new PaymentTokenActionLinks(
48
+ $links_map['approve'],
49
+ $links_map['confirm'] ?? '',
50
+ $links_map['status'] ?? ''
51
+ );
52
+ }
53
+ }
modules/ppcp-api-client/src/Repository/OrderRepository.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PayPal order repository.
4
+ *
5
+ * @package WooCommerce\PayPalCommerce\ApiClient\Repository
6
+ */
7
+
8
+ declare(strict_types=1);
9
+
10
+ namespace WooCommerce\PayPalCommerce\ApiClient\Repository;
11
+
12
+ use WC_Order;
13
+ use WooCommerce\PayPalCommerce\ApiClient\Endpoint\OrderEndpoint;
14
+ use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
15
+ use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
16
+ use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
17
+
18
+ /**
19
+ * Class OrderRepository
20
+ */
21
+ class OrderRepository {
22
+
23
+ /**
24
+ * The order endpoint.
25
+ *
26
+ * @var OrderEndpoint
27
+ */
28
+ protected $order_endpoint;
29
+
30
+ /**
31
+ * OrderRepository constructor.
32
+ *
33
+ * @param OrderEndpoint $order_endpoint The order endpoint.
34
+ */
35
+ public function __construct( OrderEndpoint $order_endpoint ) {
36
+ $this->order_endpoint = $order_endpoint;
37
+ }
38
+
39
+ /**
40
+ * Gets a PayPal order for the given WooCommerce order.
41
+ *
42
+ * @param WC_Order $wc_order The WooCommerce order.
43
+ * @return Order The PayPal order.
44
+ * @throws RuntimeException When there is a problem getting the PayPal order.
45
+ */
46
+ public function for_wc_order( WC_Order $wc_order ): Order {
47
+ $paypal_order_id = $wc_order->get_meta( PayPalGateway::ORDER_ID_META_KEY );
48
+ if ( ! $paypal_order_id ) {
49
+ throw new RuntimeException( 'PayPal order ID not found in meta.' );
50
+ }
51
+
52
+ return $this->order_endpoint->order( $paypal_order_id );
53
+ }
54
+ }
modules/ppcp-api-client/src/Repository/PayPalRequestIdRepository.php CHANGED
@@ -26,8 +26,7 @@ class PayPalRequestIdRepository {
26
  * @return string
27
  */
28
  public function get_for_order_id( string $order_id ): string {
29
- $all = $this->all();
30
- return isset( $all[ $order_id ] ) ? (string) $all[ $order_id ]['id'] : '';
31
  }
32
 
33
  /**
@@ -50,14 +49,37 @@ class PayPalRequestIdRepository {
50
  * @return bool
51
  */
52
  public function set_for_order( Order $order, string $request_id ): bool {
53
- $all = $this->all();
54
- $all[ $order->id() ] = array(
 
 
 
 
 
 
 
 
 
 
 
 
55
  'id' => $request_id,
56
- 'expiration' => time() + 10 * DAY_IN_SECONDS,
57
  );
58
- $all = $this->cleanup( $all );
59
  update_option( self::KEY, $all );
60
- return true;
 
 
 
 
 
 
 
 
 
 
 
61
  }
62
 
63
  /**
26
  * @return string
27
  */
28
  public function get_for_order_id( string $order_id ): string {
29
+ return $this->get( $order_id );
 
30
  }
31
 
32
  /**
49
  * @return bool
50
  */
51
  public function set_for_order( Order $order, string $request_id ): bool {
52
+ $this->set( $order->id(), $request_id );
53
+ return true;
54
+ }
55
+
56
+ /**
57
+ * Sets a request ID for the given key.
58
+ *
59
+ * @param string $key The key in the request ID storage.
60
+ * @param string $request_id The ID.
61
+ */
62
+ public function set( string $key, string $request_id ): void {
63
+ $all = $this->all();
64
+ $day_in_seconds = 86400;
65
+ $all[ $key ] = array(
66
  'id' => $request_id,
67
+ 'expiration' => time() + 10 * $day_in_seconds,
68
  );
69
+ $all = $this->cleanup( $all );
70
  update_option( self::KEY, $all );
71
+ }
72
+
73
+ /**
74
+ * Returns a request ID.
75
+ *
76
+ * @param string $key The key in the request ID storage.
77
+ *
78
+ * @return string
79
+ */
80
+ public function get( string $key ): string {
81
+ $all = $this->all();
82
+ return isset( $all[ $key ] ) ? (string) $all[ $key ]['id'] : '';
83
  }
84
 
85
  /**
modules/ppcp-button/assets/js/button.js CHANGED
@@ -1 +1 @@
1
- (()=>{"use strict";var __webpack_modules__={210:()=>{eval("\n;// CONCATENATED MODULE: ./resources/js/modules/ErrorHandler.js\nclass ErrorHandler {\n constructor(genericErrorText) {\n this.genericErrorText = genericErrorText;\n this.wrapper = document.querySelector('.woocommerce-notices-wrapper');\n this.messagesList = document.querySelector('ul.woocommerce-error');\n }\n\n genericError() {\n if (this.wrapper.classList.contains('ppcp-persist')) {\n return;\n }\n\n this.clear();\n this.message(this.genericErrorText);\n }\n\n appendPreparedErrorMessageElement(errorMessageElement) {\n if (this.messagesList === null) {\n this.prepareMessagesList();\n }\n\n this.messagesList.replaceWith(errorMessageElement);\n }\n\n message(text, persist = false) {\n if (!typeof String || text.length === 0) {\n throw new Error('A new message text must be a non-empty string.');\n }\n\n if (this.messagesList === null) {\n this.prepareMessagesList();\n }\n\n if (persist) {\n this.wrapper.classList.add('ppcp-persist');\n } else {\n this.wrapper.classList.remove('ppcp-persist');\n }\n\n let messageNode = this.prepareMessagesListItem(text);\n this.messagesList.appendChild(messageNode);\n jQuery.scroll_to_notices(jQuery('.woocommerce-notices-wrapper'));\n }\n\n prepareMessagesList() {\n if (this.messagesList === null) {\n this.messagesList = document.createElement('ul');\n this.messagesList.setAttribute('class', 'woocommerce-error');\n this.messagesList.setAttribute('role', 'alert');\n this.wrapper.appendChild(this.messagesList);\n }\n }\n\n prepareMessagesListItem(message) {\n const li = document.createElement('li');\n li.innerHTML = message;\n return li;\n }\n\n sanitize(text) {\n const textarea = document.createElement('textarea');\n textarea.innerHTML = text;\n return textarea.value.replace('Error: ', '');\n }\n\n clear() {\n if (this.messagesList === null) {\n return;\n }\n\n this.messagesList.innerHTML = '';\n }\n\n}\n\n/* harmony default export */ const modules_ErrorHandler = (ErrorHandler);\n;// CONCATENATED MODULE: ./resources/js/modules/OnApproveHandler/onApproveForContinue.js\nconst onApprove = (context, errorHandler) => {\n return (data, actions) => {\n return fetch(context.config.ajax.approve_order.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: context.config.ajax.approve_order.nonce,\n order_id: data.orderID,\n funding_source: window.ppcpFundingSource\n })\n }).then(res => {\n return res.json();\n }).then(data => {\n if (!data.success) {\n errorHandler.genericError();\n return actions.restart().catch(err => {\n errorHandler.genericError();\n });\n }\n\n location.href = context.config.redirect;\n });\n };\n};\n\n/* harmony default export */ const onApproveForContinue = (onApprove);\n;// CONCATENATED MODULE: ./resources/js/modules/Helper/PayerData.js\nconst payerData = () => {\n const payer = PayPalCommerceGateway.payer;\n\n if (!payer) {\n return null;\n }\n\n const phone = document.querySelector('#billing_phone') || typeof payer.phone !== 'undefined' ? {\n phone_type: \"HOME\",\n phone_number: {\n national_number: document.querySelector('#billing_phone') ? document.querySelector('#billing_phone').value : payer.phone.phone_number.national_number\n }\n } : null;\n const payerData = {\n email_address: document.querySelector('#billing_email') ? document.querySelector('#billing_email').value : payer.email_address,\n name: {\n surname: document.querySelector('#billing_last_name') ? document.querySelector('#billing_last_name').value : payer.name.surname,\n given_name: document.querySelector('#billing_first_name') ? document.querySelector('#billing_first_name').value : payer.name.given_name\n },\n address: {\n country_code: document.querySelector('#billing_country') ? document.querySelector('#billing_country').value : payer.address.country_code,\n address_line_1: document.querySelector('#billing_address_1') ? document.querySelector('#billing_address_1').value : payer.address.address_line_1,\n address_line_2: document.querySelector('#billing_address_2') ? document.querySelector('#billing_address_2').value : payer.address.address_line_2,\n admin_area_1: document.querySelector('#billing_state') ? document.querySelector('#billing_state').value : payer.address.admin_area_1,\n admin_area_2: document.querySelector('#billing_city') ? document.querySelector('#billing_city').value : payer.address.admin_area_2,\n postal_code: document.querySelector('#billing_postcode') ? document.querySelector('#billing_postcode').value : payer.address.postal_code\n }\n };\n\n if (phone) {\n payerData.phone = phone;\n }\n\n return payerData;\n};\n;// CONCATENATED MODULE: ./resources/js/modules/ActionHandler/CartActionHandler.js\n\n\n\nclass CartActionHandler {\n constructor(config, errorHandler) {\n this.config = config;\n this.errorHandler = errorHandler;\n }\n\n configuration() {\n const createOrder = (data, actions) => {\n const payer = payerData();\n const bnCode = typeof this.config.bn_codes[this.config.context] !== 'undefined' ? this.config.bn_codes[this.config.context] : '';\n return fetch(this.config.ajax.create_order.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: this.config.ajax.create_order.nonce,\n purchase_units: [],\n bn_code: bnCode,\n payer,\n context: this.config.context\n })\n }).then(function (res) {\n return res.json();\n }).then(function (data) {\n if (!data.success) {\n console.error(data);\n throw Error(data.data.message);\n }\n\n return data.data.id;\n });\n };\n\n return {\n createOrder,\n onApprove: onApproveForContinue(this, this.errorHandler),\n onError: error => {\n this.errorHandler.genericError();\n }\n };\n }\n\n}\n\n/* harmony default export */ const ActionHandler_CartActionHandler = (CartActionHandler);\n;// CONCATENATED MODULE: ./resources/js/modules/ContextBootstrap/MiniCartBootstap.js\n\n\n\nclass MiniCartBootstap {\n constructor(gateway, renderer) {\n this.gateway = gateway;\n this.renderer = renderer;\n this.actionHandler = null;\n }\n\n init() {\n this.actionHandler = new ActionHandler_CartActionHandler(PayPalCommerceGateway, new modules_ErrorHandler(this.gateway.labels.error.generic));\n this.render();\n jQuery(document.body).on('wc_fragments_loaded wc_fragments_refreshed', () => {\n this.render();\n });\n }\n\n shouldRender() {\n return document.querySelector(this.gateway.button.mini_cart_wrapper) !== null || document.querySelector(this.gateway.hosted_fields.mini_cart_wrapper) !== null;\n }\n\n render() {\n if (!this.shouldRender()) {\n return;\n }\n\n this.renderer.render(this.gateway.button.mini_cart_wrapper, this.gateway.hosted_fields.mini_cart_wrapper, this.actionHandler.configuration());\n }\n\n}\n\n/* harmony default export */ const ContextBootstrap_MiniCartBootstap = (MiniCartBootstap);\n;// CONCATENATED MODULE: ./resources/js/modules/Helper/UpdateCart.js\n\n\nclass UpdateCart {\n constructor(endpoint, nonce) {\n this.endpoint = endpoint;\n this.nonce = nonce;\n }\n /**\n *\n * @param onResolve\n * @param {Product[]} products\n * @returns {Promise<unknown>}\n */\n\n\n update(onResolve, products) {\n return new Promise((resolve, reject) => {\n fetch(this.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: this.nonce,\n products\n })\n }).then(result => {\n return result.json();\n }).then(result => {\n if (!result.success) {\n reject(result.data);\n return;\n }\n\n const resolved = onResolve(result.data);\n resolve(resolved);\n });\n });\n }\n\n}\n\n/* harmony default export */ const Helper_UpdateCart = (UpdateCart);\n;// CONCATENATED MODULE: ./resources/js/modules/Helper/ButtonsToggleListener.js\n/**\n * When you can't add something to the cart, the PayPal buttons should not show.\n * Therefore we listen for changes on the add to cart button and show/hide the buttons accordingly.\n */\nclass ButtonsToggleListener {\n constructor(element, showCallback, hideCallback) {\n this.element = element;\n this.showCallback = showCallback;\n this.hideCallback = hideCallback;\n this.observer = null;\n }\n\n init() {\n const config = {\n attributes: true\n };\n\n const callback = () => {\n if (this.element.classList.contains('disabled')) {\n this.hideCallback();\n return;\n }\n\n this.showCallback();\n };\n\n this.observer = new MutationObserver(callback);\n this.observer.observe(this.element, config);\n callback();\n }\n\n disconnect() {\n this.observer.disconnect();\n }\n\n}\n\n/* harmony default export */ const Helper_ButtonsToggleListener = (ButtonsToggleListener);\n;// CONCATENATED MODULE: ./resources/js/modules/Entity/Product.js\nclass Product {\n constructor(id, quantity, variations) {\n this.id = id;\n this.quantity = quantity;\n this.variations = variations;\n }\n\n data() {\n return {\n id: this.id,\n quantity: this.quantity,\n variations: this.variations\n };\n }\n\n}\n\n/* harmony default export */ const Entity_Product = (Product);\n;// CONCATENATED MODULE: ./resources/js/modules/ActionHandler/SingleProductActionHandler.js\n\n\n\n\n\nclass SingleProductActionHandler {\n constructor(config, updateCart, showButtonCallback, hideButtonCallback, formElement, errorHandler) {\n this.config = config;\n this.updateCart = updateCart;\n this.showButtonCallback = showButtonCallback;\n this.hideButtonCallback = hideButtonCallback;\n this.formElement = formElement;\n this.errorHandler = errorHandler;\n }\n\n configuration() {\n if (this.hasVariations()) {\n const observer = new Helper_ButtonsToggleListener(this.formElement.querySelector('.single_add_to_cart_button'), this.showButtonCallback, this.hideButtonCallback);\n observer.init();\n }\n\n return {\n createOrder: this.createOrder(),\n onApprove: onApproveForContinue(this, this.errorHandler),\n onError: error => {\n this.errorHandler.genericError();\n }\n };\n }\n\n createOrder() {\n var getProducts = null;\n\n if (!this.isGroupedProduct()) {\n getProducts = () => {\n const id = document.querySelector('[name=\"add-to-cart\"]').value;\n const qty = document.querySelector('[name=\"quantity\"]').value;\n const variations = this.variations();\n return [new Entity_Product(id, qty, variations)];\n };\n } else {\n getProducts = () => {\n const products = [];\n this.formElement.querySelectorAll('input[type=\"number\"]').forEach(element => {\n if (!element.value) {\n return;\n }\n\n const elementName = element.getAttribute('name').match(/quantity\\[([\\d]*)\\]/);\n\n if (elementName.length !== 2) {\n return;\n }\n\n const id = parseInt(elementName[1]);\n const quantity = parseInt(element.value);\n products.push(new Entity_Product(id, quantity, null));\n });\n return products;\n };\n }\n\n const createOrder = (data, actions) => {\n this.errorHandler.clear();\n\n const onResolve = purchase_units => {\n const payer = payerData();\n const bnCode = typeof this.config.bn_codes[this.config.context] !== 'undefined' ? this.config.bn_codes[this.config.context] : '';\n return fetch(this.config.ajax.create_order.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: this.config.ajax.create_order.nonce,\n purchase_units,\n payer,\n bn_code: bnCode,\n context: this.config.context\n })\n }).then(function (res) {\n return res.json();\n }).then(function (data) {\n if (!data.success) {\n console.error(data);\n throw Error(data.data.message);\n }\n\n return data.data.id;\n });\n };\n\n const promise = this.updateCart.update(onResolve, getProducts());\n return promise;\n };\n\n return createOrder;\n }\n\n variations() {\n if (!this.hasVariations()) {\n return null;\n }\n\n const attributes = [...this.formElement.querySelectorAll(\"[name^='attribute_']\")].map(element => {\n return {\n value: element.value,\n name: element.name\n };\n });\n return attributes;\n }\n\n hasVariations() {\n return this.formElement.classList.contains('variations_form');\n }\n\n isGroupedProduct() {\n return this.formElement.classList.contains('grouped_form');\n }\n\n}\n\n/* harmony default export */ const ActionHandler_SingleProductActionHandler = (SingleProductActionHandler);\n;// CONCATENATED MODULE: ./resources/js/modules/ContextBootstrap/SingleProductBootstap.js\n\n\n\n\nclass SingleProductBootstap {\n constructor(gateway, renderer, messages) {\n this.gateway = gateway;\n this.renderer = renderer;\n this.messages = messages;\n }\n\n handleChange() {\n if (!this.shouldRender()) {\n this.renderer.hideButtons(this.gateway.hosted_fields.wrapper);\n this.renderer.hideButtons(this.gateway.button.wrapper);\n return;\n }\n\n this.render();\n }\n\n init() {\n document.querySelector('form.cart').addEventListener('change', this.handleChange.bind(this));\n\n if (!this.shouldRender()) {\n this.renderer.hideButtons(this.gateway.hosted_fields.wrapper);\n return;\n }\n\n this.render();\n }\n\n shouldRender() {\n return document.querySelector('form.cart') !== null && !this.priceAmountIsZero();\n }\n\n priceAmountIsZero() {\n let priceText = \"0\";\n\n if (document.querySelector('form.cart ins .woocommerce-Price-amount')) {\n priceText = document.querySelector('form.cart ins .woocommerce-Price-amount').innerText;\n } else if (document.querySelector('form.cart .woocommerce-Price-amount')) {\n priceText = document.querySelector('form.cart .woocommerce-Price-amount').innerText;\n } else if (document.querySelector('.product .woocommerce-Price-amount')) {\n priceText = document.querySelector('.product .woocommerce-Price-amount').innerText;\n }\n\n const amount = parseFloat(priceText.replace(/([^\\d,\\.\\s]*)/g, ''));\n return amount === 0;\n }\n\n render() {\n const actionHandler = new ActionHandler_SingleProductActionHandler(this.gateway, new Helper_UpdateCart(this.gateway.ajax.change_cart.endpoint, this.gateway.ajax.change_cart.nonce), () => {\n this.renderer.showButtons(this.gateway.button.wrapper);\n this.renderer.showButtons(this.gateway.hosted_fields.wrapper);\n let priceText = \"0\";\n\n if (document.querySelector('form.cart ins .woocommerce-Price-amount')) {\n priceText = document.querySelector('form.cart ins .woocommerce-Price-amount').innerText;\n } else if (document.querySelector('form.cart .woocommerce-Price-amount')) {\n priceText = document.querySelector('form.cart .woocommerce-Price-amount').innerText;\n }\n\n const amount = parseInt(priceText.replace(/([^\\d,\\.\\s]*)/g, ''));\n this.messages.renderWithAmount(amount);\n }, () => {\n this.renderer.hideButtons(this.gateway.button.wrapper);\n this.renderer.hideButtons(this.gateway.hosted_fields.wrapper);\n }, document.querySelector('form.cart'), new modules_ErrorHandler(this.gateway.labels.error.generic));\n this.renderer.render(this.gateway.button.wrapper, this.gateway.hosted_fields.wrapper, actionHandler.configuration());\n }\n\n}\n\n/* harmony default export */ const ContextBootstrap_SingleProductBootstap = (SingleProductBootstap);\n;// CONCATENATED MODULE: ./resources/js/modules/ContextBootstrap/CartBootstap.js\n\n\n\nclass CartBootstrap {\n constructor(gateway, renderer) {\n this.gateway = gateway;\n this.renderer = renderer;\n }\n\n init() {\n if (!this.shouldRender()) {\n return;\n }\n\n this.render();\n jQuery(document.body).on('updated_cart_totals updated_checkout', () => {\n this.render();\n });\n }\n\n shouldRender() {\n return document.querySelector(this.gateway.button.wrapper) !== null || document.querySelector(this.gateway.hosted_fields.wrapper) !== null;\n }\n\n render() {\n const actionHandler = new ActionHandler_CartActionHandler(PayPalCommerceGateway, new modules_ErrorHandler(this.gateway.labels.error.generic));\n this.renderer.render(this.gateway.button.wrapper, this.gateway.hosted_fields.wrapper, actionHandler.configuration());\n }\n\n}\n\n/* harmony default export */ const CartBootstap = (CartBootstrap);\n;// CONCATENATED MODULE: ./resources/js/modules/OnApproveHandler/onApproveForPayNow.js\nconst onApproveForPayNow_onApprove = (context, errorHandler, spinner) => {\n return (data, actions) => {\n spinner.block();\n errorHandler.clear();\n return fetch(context.config.ajax.approve_order.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: context.config.ajax.approve_order.nonce,\n order_id: data.orderID,\n funding_source: window.ppcpFundingSource\n })\n }).then(res => {\n return res.json();\n }).then(data => {\n spinner.unblock();\n\n if (!data.success) {\n if (data.data.code === 100) {\n errorHandler.message(data.data.message);\n } else {\n errorHandler.genericError();\n }\n\n if (typeof actions !== 'undefined' && typeof actions.restart !== 'undefined') {\n return actions.restart();\n }\n\n throw new Error(data.data.message);\n }\n\n document.querySelector('#place_order').click();\n });\n };\n};\n\n/* harmony default export */ const onApproveForPayNow = (onApproveForPayNow_onApprove);\n;// CONCATENATED MODULE: ./resources/js/modules/ActionHandler/CheckoutActionHandler.js\n\n\n\nclass CheckoutActionHandler {\n constructor(config, errorHandler, spinner) {\n this.config = config;\n this.errorHandler = errorHandler;\n this.spinner = spinner;\n }\n\n configuration() {\n const spinner = this.spinner;\n\n const createOrder = (data, actions) => {\n const payer = payerData();\n const bnCode = typeof this.config.bn_codes[this.config.context] !== 'undefined' ? this.config.bn_codes[this.config.context] : '';\n const errorHandler = this.errorHandler;\n const formSelector = this.config.context === 'checkout' ? 'form.checkout' : 'form#order_review';\n const formValues = jQuery(formSelector).serialize();\n const createaccount = jQuery('#createaccount').is(\":checked\") ? true : false;\n return fetch(this.config.ajax.create_order.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: this.config.ajax.create_order.nonce,\n payer,\n bn_code: bnCode,\n context: this.config.context,\n order_id: this.config.order_id,\n form: formValues,\n createaccount: createaccount\n })\n }).then(function (res) {\n return res.json();\n }).then(function (data) {\n if (!data.success) {\n spinner.unblock(); //handle both messages sent from Woocommerce (data.messages) and this plugin (data.data.message)\n\n if (typeof data.messages !== 'undefined') {\n const domParser = new DOMParser();\n errorHandler.appendPreparedErrorMessageElement(domParser.parseFromString(data.messages, 'text/html').querySelector('ul'));\n } else {\n errorHandler.clear();\n\n if (data.data.details.length > 0) {\n errorHandler.message(data.data.details.map(d => `${d.issue} ${d.description}`).join('<br/>'), true);\n } else {\n errorHandler.message(data.data.message, true);\n }\n }\n\n return;\n }\n\n const input = document.createElement('input');\n input.setAttribute('type', 'hidden');\n input.setAttribute('name', 'ppcp-resume-order');\n input.setAttribute('value', data.data.purchase_units[0].custom_id);\n document.querySelector(formSelector).append(input);\n return data.data.id;\n });\n };\n\n return {\n createOrder,\n onApprove: onApproveForPayNow(this, this.errorHandler, this.spinner),\n onCancel: () => {\n spinner.unblock();\n },\n onError: () => {\n this.errorHandler.genericError();\n spinner.unblock();\n }\n };\n }\n\n}\n\n/* harmony default export */ const ActionHandler_CheckoutActionHandler = (CheckoutActionHandler);\n;// CONCATENATED MODULE: ./resources/js/modules/Helper/Hiding.js\nconst getElement = selectorOrElement => {\n if (typeof selectorOrElement === 'string') {\n return document.querySelector(selectorOrElement);\n }\n\n return selectorOrElement;\n};\n\nconst isVisible = element => {\n return !!(element.offsetWidth || element.offsetHeight || element.getClientRects().length);\n};\nconst setVisible = (selectorOrElement, show, important = false) => {\n const element = getElement(selectorOrElement);\n\n if (!element) {\n return;\n }\n\n const currentValue = element.style.getPropertyValue('display');\n\n if (!show) {\n if (currentValue === 'none') {\n return;\n }\n\n element.style.setProperty('display', 'none', important ? 'important' : '');\n } else {\n if (currentValue === 'none') {\n element.style.removeProperty('display');\n } // still not visible (if something else added display: none in CSS)\n\n\n if (!isVisible(element)) {\n element.style.setProperty('display', 'block');\n }\n }\n};\nconst hide = (selectorOrElement, important = false) => {\n setVisible(selectorOrElement, false, important);\n};\nconst show = selectorOrElement => {\n setVisible(selectorOrElement, true);\n};\n;// CONCATENATED MODULE: ./resources/js/modules/Helper/CheckoutMethodState.js\nconst PaymentMethods = {\n PAYPAL: 'ppcp-gateway',\n CARDS: 'ppcp-credit-card-gateway'\n};\nconst ORDER_BUTTON_SELECTOR = '#place_order';\nconst getCurrentPaymentMethod = () => {\n const el = document.querySelector('input[name=\"payment_method\"]:checked');\n\n if (!el) {\n return null;\n }\n\n return el.value;\n};\nconst isSavedCardSelected = () => {\n const savedCardList = document.querySelector('#saved-credit-card');\n return savedCardList && savedCardList.value !== '';\n};\n;// CONCATENATED MODULE: ./resources/js/modules/ContextBootstrap/CheckoutBootstap.js\n\n\n\n\n\nclass CheckoutBootstap {\n constructor(gateway, renderer, messages, spinner) {\n this.gateway = gateway;\n this.renderer = renderer;\n this.messages = messages;\n this.spinner = spinner;\n this.standardOrderButtonSelector = ORDER_BUTTON_SELECTOR;\n this.buttonChangeObserver = new MutationObserver(el => {\n this.updateUi();\n });\n }\n\n init() {\n this.render(); // Unselect saved card.\n // WC saves form values, so with our current UI it would be a bit weird\n // if the user paid with saved, then after some time tries to pay again,\n // but wants to enter a new card, and to do that they have to choose “Select payment” in the list.\n\n jQuery('#saved-credit-card').val(jQuery('#saved-credit-card option:first').val());\n jQuery(document.body).on('updated_checkout', () => {\n this.render();\n });\n jQuery(document.body).on('updated_checkout payment_method_selected', () => {\n this.updateUi();\n });\n jQuery(document).on('hosted_fields_loaded', () => {\n jQuery('#saved-credit-card').on('change', () => {\n this.updateUi();\n });\n });\n this.updateUi();\n }\n\n shouldRender() {\n if (document.querySelector(this.gateway.button.cancel_wrapper)) {\n return false;\n }\n\n return document.querySelector(this.gateway.button.wrapper) !== null || document.querySelector(this.gateway.hosted_fields.wrapper) !== null;\n }\n\n render() {\n if (!this.shouldRender()) {\n return;\n }\n\n if (document.querySelector(this.gateway.hosted_fields.wrapper + '>div')) {\n document.querySelector(this.gateway.hosted_fields.wrapper + '>div').setAttribute('style', '');\n }\n\n const actionHandler = new ActionHandler_CheckoutActionHandler(PayPalCommerceGateway, new modules_ErrorHandler(this.gateway.labels.error.generic), this.spinner);\n this.renderer.render(this.gateway.button.wrapper, this.gateway.hosted_fields.wrapper, actionHandler.configuration());\n this.buttonChangeObserver.observe(document.querySelector(this.standardOrderButtonSelector), {\n attributes: true\n });\n }\n\n updateUi() {\n const currentPaymentMethod = getCurrentPaymentMethod();\n const isPaypal = currentPaymentMethod === PaymentMethods.PAYPAL;\n const isCard = currentPaymentMethod === PaymentMethods.CARDS;\n const isSavedCard = isCard && isSavedCardSelected();\n const isNotOurGateway = !isPaypal && !isCard;\n setVisible(this.standardOrderButtonSelector, isNotOurGateway || isSavedCard, true);\n setVisible(this.gateway.button.wrapper, isPaypal);\n setVisible(this.gateway.messages.wrapper, isPaypal);\n setVisible(this.gateway.hosted_fields.wrapper, isCard && !isSavedCard);\n\n if (isPaypal) {\n this.messages.render();\n }\n\n if (isCard) {\n if (isSavedCard) {\n this.disableCreditCardFields();\n } else {\n this.enableCreditCardFields();\n }\n }\n }\n\n disableCreditCardFields() {\n jQuery('label[for=\"ppcp-credit-card-gateway-card-number\"]').addClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('#ppcp-credit-card-gateway-card-number').addClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('label[for=\"ppcp-credit-card-gateway-card-expiry\"]').addClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('#ppcp-credit-card-gateway-card-expiry').addClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('label[for=\"ppcp-credit-card-gateway-card-cvc\"]').addClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('#ppcp-credit-card-gateway-card-cvc').addClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('label[for=\"vault\"]').addClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('#ppcp-credit-card-vault').addClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('#ppcp-credit-card-vault').attr(\"disabled\", true);\n this.renderer.disableCreditCardFields();\n }\n\n enableCreditCardFields() {\n jQuery('label[for=\"ppcp-credit-card-gateway-card-number\"]').removeClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('#ppcp-credit-card-gateway-card-number').removeClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('label[for=\"ppcp-credit-card-gateway-card-expiry\"]').removeClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('#ppcp-credit-card-gateway-card-expiry').removeClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('label[for=\"ppcp-credit-card-gateway-card-cvc\"]').removeClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('#ppcp-credit-card-gateway-card-cvc').removeClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('label[for=\"vault\"]').removeClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('#ppcp-credit-card-vault').removeClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('#ppcp-credit-card-vault').attr(\"disabled\", false);\n this.renderer.enableCreditCardFields();\n }\n\n}\n\n/* harmony default export */ const ContextBootstrap_CheckoutBootstap = (CheckoutBootstap);\n;// CONCATENATED MODULE: ./resources/js/modules/Helper/Subscriptions.js\nconst isChangePaymentPage = () => {\n const urlParams = new URLSearchParams(window.location.search);\n return urlParams.has('change_payment_method');\n};\n;// CONCATENATED MODULE: ./resources/js/modules/ContextBootstrap/PayNowBootstrap.js\n\n\n\nclass PayNowBootstrap extends ContextBootstrap_CheckoutBootstap {\n constructor(gateway, renderer, messages, spinner) {\n super(gateway, renderer, messages, spinner);\n }\n\n updateUi() {\n if (isChangePaymentPage()) {\n return;\n }\n\n super.updateUi();\n }\n\n}\n\n/* harmony default export */ const ContextBootstrap_PayNowBootstrap = (PayNowBootstrap);\n;// CONCATENATED MODULE: ./resources/js/modules/Renderer/Renderer.js\nclass Renderer {\n constructor(creditCardRenderer, defaultConfig, onSmartButtonClick, onSmartButtonsInit) {\n this.defaultConfig = defaultConfig;\n this.creditCardRenderer = creditCardRenderer;\n this.onSmartButtonClick = onSmartButtonClick;\n this.onSmartButtonsInit = onSmartButtonsInit;\n }\n\n render(wrapper, hostedFieldsWrapper, contextConfig) {\n this.renderButtons(wrapper, contextConfig);\n this.creditCardRenderer.render(hostedFieldsWrapper, contextConfig);\n }\n\n renderButtons(wrapper, contextConfig) {\n if (!document.querySelector(wrapper) || this.isAlreadyRendered(wrapper) || 'undefined' === typeof paypal.Buttons) {\n return;\n }\n\n const style = wrapper === this.defaultConfig.button.wrapper ? this.defaultConfig.button.style : this.defaultConfig.button.mini_cart_style;\n paypal.Buttons({\n style,\n ...contextConfig,\n onClick: this.onSmartButtonClick,\n onInit: this.onSmartButtonsInit\n }).render(wrapper);\n }\n\n isAlreadyRendered(wrapper) {\n return document.querySelector(wrapper).hasChildNodes();\n }\n\n hideButtons(element) {\n const domElement = document.querySelector(element);\n\n if (!domElement) {\n return false;\n }\n\n domElement.style.display = 'none';\n return true;\n }\n\n showButtons(element) {\n const domElement = document.querySelector(element);\n\n if (!domElement) {\n return false;\n }\n\n domElement.style.display = 'block';\n return true;\n }\n\n disableCreditCardFields() {\n this.creditCardRenderer.disableFields();\n }\n\n enableCreditCardFields() {\n this.creditCardRenderer.enableFields();\n }\n\n}\n\n/* harmony default export */ const Renderer_Renderer = (Renderer);\n;// CONCATENATED MODULE: ./resources/js/modules/Helper/DccInputFactory.js\nconst dccInputFactory = original => {\n const styles = window.getComputedStyle(original);\n const newElement = document.createElement('span');\n newElement.setAttribute('id', original.id);\n Object.values(styles).forEach(prop => {\n if (!styles[prop] || !isNaN(prop)) {\n return;\n }\n\n newElement.style.setProperty(prop, '' + styles[prop]);\n });\n return newElement;\n};\n\n/* harmony default export */ const DccInputFactory = (dccInputFactory);\n;// CONCATENATED MODULE: ./resources/js/modules/Renderer/CreditCardRenderer.js\n\n\nclass CreditCardRenderer {\n constructor(defaultConfig, errorHandler, spinner) {\n this.defaultConfig = defaultConfig;\n this.errorHandler = errorHandler;\n this.spinner = spinner;\n this.cardValid = false;\n this.formValid = false;\n this.currentHostedFieldsInstance = null;\n }\n\n render(wrapper, contextConfig) {\n if (this.defaultConfig.context !== 'checkout' && this.defaultConfig.context !== 'pay-now' || wrapper === null || document.querySelector(wrapper) === null) {\n return;\n }\n\n if (typeof paypal.HostedFields === 'undefined' || !paypal.HostedFields.isEligible()) {\n const wrapperElement = document.querySelector(wrapper);\n wrapperElement.parentNode.removeChild(wrapperElement);\n return;\n }\n\n if (this.currentHostedFieldsInstance) {\n this.currentHostedFieldsInstance.teardown().catch(err => console.error(`Hosted fields teardown error: ${err}`));\n this.currentHostedFieldsInstance = null;\n }\n\n const gateWayBox = document.querySelector('.payment_box.payment_method_ppcp-credit-card-gateway');\n const oldDisplayStyle = gateWayBox.style.display;\n gateWayBox.style.display = 'block';\n const hideDccGateway = document.querySelector('#ppcp-hide-dcc');\n\n if (hideDccGateway) {\n hideDccGateway.parentNode.removeChild(hideDccGateway);\n }\n\n const cardNumberField = document.querySelector('#ppcp-credit-card-gateway-card-number');\n const stylesRaw = window.getComputedStyle(cardNumberField);\n let styles = {};\n Object.values(stylesRaw).forEach(prop => {\n if (!stylesRaw[prop]) {\n return;\n }\n\n styles[prop] = '' + stylesRaw[prop];\n });\n const cardNumber = DccInputFactory(cardNumberField);\n cardNumberField.parentNode.replaceChild(cardNumber, cardNumberField);\n const cardExpiryField = document.querySelector('#ppcp-credit-card-gateway-card-expiry');\n const cardExpiry = DccInputFactory(cardExpiryField);\n cardExpiryField.parentNode.replaceChild(cardExpiry, cardExpiryField);\n const cardCodeField = document.querySelector('#ppcp-credit-card-gateway-card-cvc');\n const cardCode = DccInputFactory(cardCodeField);\n cardCodeField.parentNode.replaceChild(cardCode, cardCodeField);\n gateWayBox.style.display = oldDisplayStyle;\n const formWrapper = '.payment_box payment_method_ppcp-credit-card-gateway';\n\n if (this.defaultConfig.enforce_vault && document.querySelector(formWrapper + ' .ppcp-credit-card-vault')) {\n document.querySelector(formWrapper + ' .ppcp-credit-card-vault').checked = true;\n document.querySelector(formWrapper + ' .ppcp-credit-card-vault').setAttribute('disabled', true);\n }\n\n paypal.HostedFields.render({\n createOrder: contextConfig.createOrder,\n styles: {\n 'input': styles\n },\n fields: {\n number: {\n selector: '#ppcp-credit-card-gateway-card-number',\n placeholder: this.defaultConfig.hosted_fields.labels.credit_card_number\n },\n cvv: {\n selector: '#ppcp-credit-card-gateway-card-cvc',\n placeholder: this.defaultConfig.hosted_fields.labels.cvv\n },\n expirationDate: {\n selector: '#ppcp-credit-card-gateway-card-expiry',\n placeholder: this.defaultConfig.hosted_fields.labels.mm_yy\n }\n }\n }).then(hostedFields => {\n document.dispatchEvent(new CustomEvent(\"hosted_fields_loaded\"));\n this.currentHostedFieldsInstance = hostedFields;\n hostedFields.on('inputSubmitRequest', () => {\n this._submit(contextConfig);\n });\n hostedFields.on('cardTypeChange', event => {\n if (!event.cards.length) {\n this.cardValid = false;\n return;\n }\n\n const validCards = this.defaultConfig.hosted_fields.valid_cards;\n this.cardValid = validCards.indexOf(event.cards[0].type) !== -1;\n });\n hostedFields.on('validityChange', event => {\n const formValid = Object.keys(event.fields).every(function (key) {\n return event.fields[key].isValid;\n });\n this.formValid = formValid;\n });\n\n if (document.querySelector(wrapper).getAttribute('data-ppcp-subscribed') !== true) {\n document.querySelector(wrapper + ' button').addEventListener('click', event => {\n event.preventDefault();\n\n this._submit(contextConfig);\n });\n document.querySelector(wrapper).setAttribute('data-ppcp-subscribed', true);\n }\n });\n document.querySelector('#payment_method_ppcp-credit-card-gateway').addEventListener('click', () => {\n document.querySelector('label[for=ppcp-credit-card-gateway-card-number]').click();\n });\n }\n\n disableFields() {\n if (this.currentHostedFieldsInstance) {\n this.currentHostedFieldsInstance.setAttribute({\n field: 'number',\n attribute: 'disabled'\n });\n this.currentHostedFieldsInstance.setAttribute({\n field: 'cvv',\n attribute: 'disabled'\n });\n this.currentHostedFieldsInstance.setAttribute({\n field: 'expirationDate',\n attribute: 'disabled'\n });\n }\n }\n\n enableFields() {\n if (this.currentHostedFieldsInstance) {\n this.currentHostedFieldsInstance.removeAttribute({\n field: 'number',\n attribute: 'disabled'\n });\n this.currentHostedFieldsInstance.removeAttribute({\n field: 'cvv',\n attribute: 'disabled'\n });\n this.currentHostedFieldsInstance.removeAttribute({\n field: 'expirationDate',\n attribute: 'disabled'\n });\n }\n }\n\n _submit(contextConfig) {\n this.spinner.block();\n this.errorHandler.clear();\n\n if (this.formValid && this.cardValid) {\n const save_card = this.defaultConfig.can_save_vault_token ? true : false;\n let vault = document.getElementById('ppcp-credit-card-vault') ? document.getElementById('ppcp-credit-card-vault').checked : save_card;\n\n if (this.defaultConfig.enforce_vault) {\n vault = true;\n }\n\n const contingency = this.defaultConfig.hosted_fields.contingency;\n const hostedFieldsData = {\n vault: vault\n };\n\n if (contingency !== 'NO_3D_SECURE') {\n hostedFieldsData.contingencies = [contingency];\n }\n\n if (this.defaultConfig.payer) {\n hostedFieldsData.cardholderName = this.defaultConfig.payer.name.given_name + ' ' + this.defaultConfig.payer.name.surname;\n }\n\n if (!hostedFieldsData.cardholderName) {\n const firstName = document.getElementById('billing_first_name') ? document.getElementById('billing_first_name').value : '';\n const lastName = document.getElementById('billing_last_name') ? document.getElementById('billing_last_name').value : '';\n\n if (!firstName || !lastName) {\n this.spinner.unblock();\n this.errorHandler.message(this.defaultConfig.hosted_fields.labels.cardholder_name_required);\n return;\n }\n\n hostedFieldsData.cardholderName = firstName + ' ' + lastName;\n }\n\n this.currentHostedFieldsInstance.submit(hostedFieldsData).then(payload => {\n payload.orderID = payload.orderId;\n this.spinner.unblock();\n return contextConfig.onApprove(payload);\n }).catch(err => {\n this.spinner.unblock();\n this.errorHandler.clear();\n\n if (err.details) {\n this.errorHandler.message(err.details.map(d => `${d.issue} ${d.description}`).join('<br/>'), true);\n }\n });\n } else {\n this.spinner.unblock();\n const message = !this.cardValid ? this.defaultConfig.hosted_fields.labels.card_not_supported : this.defaultConfig.hosted_fields.labels.fields_not_valid;\n this.errorHandler.message(message);\n }\n }\n\n}\n\n/* harmony default export */ const Renderer_CreditCardRenderer = (CreditCardRenderer);\n;// CONCATENATED MODULE: ./resources/js/modules/DataClientIdAttributeHandler.js\nconst storageKey = 'ppcp-data-client-id';\n\nconst validateToken = (token, user) => {\n if (!token) {\n return false;\n }\n\n if (token.user !== user) {\n return false;\n }\n\n const currentTime = new Date().getTime();\n const isExpired = currentTime >= token.expiration * 1000;\n return !isExpired;\n};\n\nconst storedTokenForUser = user => {\n const token = JSON.parse(sessionStorage.getItem(storageKey));\n\n if (validateToken(token, user)) {\n return token.token;\n }\n\n return null;\n};\n\nconst storeToken = token => {\n sessionStorage.setItem(storageKey, JSON.stringify(token));\n};\n\nconst dataClientIdAttributeHandler = (script, config) => {\n fetch(config.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: config.nonce\n })\n }).then(res => {\n return res.json();\n }).then(data => {\n const isValid = validateToken(data, config.user);\n\n if (!isValid) {\n return;\n }\n\n storeToken(data);\n script.setAttribute('data-client-token', data.token);\n document.body.append(script);\n });\n};\n\n/* harmony default export */ const DataClientIdAttributeHandler = (dataClientIdAttributeHandler);\n;// CONCATENATED MODULE: ./resources/js/modules/Renderer/MessageRenderer.js\nclass MessageRenderer {\n constructor(config) {\n this.config = config;\n }\n\n render() {\n if (!this.shouldRender()) {\n return;\n }\n\n paypal.Messages({\n amount: this.config.amount,\n placement: this.config.placement,\n style: this.config.style\n }).render(this.config.wrapper);\n }\n\n renderWithAmount(amount) {\n if (!this.shouldRender()) {\n return;\n }\n\n const newWrapper = document.createElement('div');\n newWrapper.setAttribute('id', this.config.wrapper.replace('#', ''));\n const sibling = document.querySelector(this.config.wrapper).nextSibling;\n document.querySelector(this.config.wrapper).parentElement.removeChild(document.querySelector(this.config.wrapper));\n sibling.parentElement.insertBefore(newWrapper, sibling);\n paypal.Messages({\n amount,\n placement: this.config.placement,\n style: this.config.style\n }).render(this.config.wrapper);\n }\n\n shouldRender() {\n if (typeof paypal.Messages === 'undefined' || typeof this.config.wrapper === 'undefined') {\n return false;\n }\n\n if (!document.querySelector(this.config.wrapper)) {\n return false;\n }\n\n return true;\n }\n\n}\n\n/* harmony default export */ const Renderer_MessageRenderer = (MessageRenderer);\n;// CONCATENATED MODULE: ./resources/js/modules/Helper/Spinner.js\nclass Spinner {\n constructor(target = 'form.woocommerce-checkout') {\n this.target = target;\n }\n\n setTarget(target) {\n this.target = target;\n }\n\n block() {\n jQuery(this.target).block({\n message: null,\n overlayCSS: {\n background: '#fff',\n opacity: 0.6\n }\n });\n }\n\n unblock() {\n jQuery(this.target).unblock();\n }\n\n}\n\n/* harmony default export */ const Helper_Spinner = (Spinner);\n;// CONCATENATED MODULE: ./resources/js/button.js\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst buttonsSpinner = new Helper_Spinner('.ppc-button-wrapper');\n\nconst bootstrap = () => {\n const errorHandler = new modules_ErrorHandler(PayPalCommerceGateway.labels.error.generic);\n const spinner = new Helper_Spinner();\n const creditCardRenderer = new Renderer_CreditCardRenderer(PayPalCommerceGateway, errorHandler, spinner);\n\n const onSmartButtonClick = data => {\n window.ppcpFundingSource = data.fundingSource;\n };\n\n const onSmartButtonsInit = () => {\n buttonsSpinner.unblock();\n };\n\n const renderer = new Renderer_Renderer(creditCardRenderer, PayPalCommerceGateway, onSmartButtonClick, onSmartButtonsInit);\n const messageRenderer = new Renderer_MessageRenderer(PayPalCommerceGateway.messages);\n const context = PayPalCommerceGateway.context;\n\n if (context === 'mini-cart' || context === 'product') {\n if (PayPalCommerceGateway.mini_cart_buttons_enabled === '1') {\n const miniCartBootstrap = new ContextBootstrap_MiniCartBootstap(PayPalCommerceGateway, renderer);\n miniCartBootstrap.init();\n }\n }\n\n if (context === 'product' && PayPalCommerceGateway.single_product_buttons_enabled === '1') {\n const singleProductBootstrap = new ContextBootstrap_SingleProductBootstap(PayPalCommerceGateway, renderer, messageRenderer);\n singleProductBootstrap.init();\n }\n\n if (context === 'cart') {\n const cartBootstrap = new CartBootstap(PayPalCommerceGateway, renderer);\n cartBootstrap.init();\n }\n\n if (context === 'checkout') {\n const checkoutBootstap = new ContextBootstrap_CheckoutBootstap(PayPalCommerceGateway, renderer, messageRenderer, spinner);\n checkoutBootstap.init();\n }\n\n if (context === 'pay-now') {\n const payNowBootstrap = new ContextBootstrap_PayNowBootstrap(PayPalCommerceGateway, renderer, messageRenderer, spinner);\n payNowBootstrap.init();\n }\n\n if (context !== 'checkout') {\n messageRenderer.render();\n }\n};\n\ndocument.addEventListener('DOMContentLoaded', () => {\n if (!typeof PayPalCommerceGateway) {\n console.error('PayPal button could not be configured.');\n return;\n }\n\n if (PayPalCommerceGateway.context !== 'checkout' && PayPalCommerceGateway.data_client_id.user === 0 && PayPalCommerceGateway.data_client_id.has_subscriptions) {\n return;\n } // Sometimes PayPal script takes long time to load,\n // so we additionally hide the standard order button here to avoid failed orders.\n // Normally it is hidden later after the script load.\n\n\n const hideOrderButtonIfPpcpGateway = () => {\n // only in checkout and pay now page, otherwise it may break things (e.g. payment via product page),\n // and also the loading spinner may look weird on other pages\n if (!['checkout', 'pay-now'].includes(PayPalCommerceGateway.context) || isChangePaymentPage()) {\n return;\n }\n\n const currentPaymentMethod = getCurrentPaymentMethod();\n const isPaypal = currentPaymentMethod === PaymentMethods.PAYPAL;\n setVisible(ORDER_BUTTON_SELECTOR, !isPaypal, true);\n\n if (isPaypal) {\n // stopped after the first rendering of the buttons, in onInit\n buttonsSpinner.block();\n } else {\n buttonsSpinner.unblock();\n }\n };\n\n let bootstrapped = false;\n hideOrderButtonIfPpcpGateway();\n jQuery(document.body).on('updated_checkout payment_method_selected', () => {\n if (bootstrapped) {\n return;\n }\n\n hideOrderButtonIfPpcpGateway();\n });\n const script = document.createElement('script');\n script.addEventListener('load', event => {\n bootstrapped = true;\n bootstrap();\n });\n script.setAttribute('src', PayPalCommerceGateway.button.url);\n Object.entries(PayPalCommerceGateway.script_attributes).forEach(keyValue => {\n script.setAttribute(keyValue[0], keyValue[1]);\n });\n\n if (PayPalCommerceGateway.data_client_id.set_attribute) {\n DataClientIdAttributeHandler(script, PayPalCommerceGateway.data_client_id);\n return;\n }\n\n document.body.append(script);\n});//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjEwLmpzIiwibWFwcGluZ3MiOiI7O0FBQUEsTUFBTUEsWUFBTixDQUFtQjtBQUVmQyxFQUFBQSxXQUFXLENBQUNDLGdCQUFELEVBQ1g7QUFDSSxTQUFLQSxnQkFBTCxHQUF3QkEsZ0JBQXhCO0FBQ0EsU0FBS0MsT0FBTCxHQUFlQyxRQUFRLENBQUNDLGFBQVQsQ0FBdUIsOEJBQXZCLENBQWY7QUFDQSxTQUFLQyxZQUFMLEdBQW9CRixRQUFRLENBQUNDLGFBQVQsQ0FBdUIsc0JBQXZCLENBQXBCO0FBQ0g7O0FBRURFLEVBQUFBLFlBQVksR0FBRztBQUNYLFFBQUksS0FBS0osT0FBTCxDQUFhSyxTQUFiLENBQXVCQyxRQUF2QixDQUFnQyxjQUFoQyxDQUFKLEVBQXFEO0FBQ2pEO0FBQ0g7O0FBQ0QsU0FBS0MsS0FBTDtBQUNBLFNBQUtDLE9BQUwsQ0FBYSxLQUFLVCxnQkFBbEI7QUFDSDs7QUFFRFUsRUFBQUEsaUNBQWlDLENBQUNDLG1CQUFELEVBQ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HVybiAoZGF0YSwgYWN0aW9ucykgPT4ge1xuICAgICAgICByZXR1cm4gZmV0Y2goY29udGV4dC5jb25maWcuYWpheC5hcHByb3ZlX29yZGVyLmVuZHBvaW50LCB7XG4gICAgICAgICAgICBtZXRob2Q6ICdQT1NUJyxcbiAgICAgICAgICAgIGJvZHk6IEpTT04uc3RyaW5naWZ5KHtcbiAgICAgICAgICAgICAgICBub25jZTogY29udGV4dC5jb25maWcuYWpheC5hcHByb3ZlX29yZGVyLm5vbmNlLFxuICAgICAgICAgICAgICAgIG9yZGVyX2lkOmRhdGEub3JkZXJJRCxcbiAgICAgICAgICAgICAgICBmdW5kaW5nX3NvdXJjZTogd2luZG93LnBwY3BGdW5kaW5nU291cmNlLFxuICAgICAgICAgICAgfSlcbiAgICAgICAgfSkudGhlbigocmVzKT0+e1xuICAgICAgICAgICAgcmV0dXJuIHJlcy5qc29uKCk7XG4gICAgICAgIH0pLnRoZW4oKGRhdGEpPT57XG4gICAgICAgICAgICBpZiAoIWRhdGEuc3VjY2Vzcykge1xuICAgICAgICAgICAgICAgIGVycm9ySGFuZGxlci5nZW5lcmljRXJyb3IoKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gYWN0aW9ucy5yZXN0YXJ0KCkuY2F0Y2goZXJyID0+IHtcbiAgICAgICAgICAgICAgICAgICAgZXJyb3JIYW5kbGVyLmdlbmVyaWNFcnJvcigpO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbG9jYXRpb24uaHJlZiA9IGNvbnRleHQuY29uZmlnLnJlZGlyZWN0O1xuICAgICAgICB9KTtcblxuICAgIH1cbn1cblxuZXhwb3J0IGRlZmF1bHQgb25BcHByb3ZlO1xuIiwiZXhwb3J0IGNvbnN0IHBheWVyRGF0YSA9ICgpID0+IHtcbiAgICBjb25zdCBwYXllciA9IFBheVBhbENvbW1lcmNlR2F0ZXdheS5wYXllcjtcbiAgICBpZiAoISBwYXllcikge1xuICAgICAgICBy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vbmZpZy5hamF4LmNyZWF0ZV9vcmRlci5lbmRwb2ludCwge1xuICAgICAgICAgICAgICAgIG1ldGhvZDogJ1BPU1QnLFxuICAgICAgICAgICAgICAgIGJvZHk6IEpTT04uc3RyaW5naWZ5KHtcbiAgICAgICAgICAgICAgICAgICAgbm9uY2U6IHRoaXMuY29uZmlnLmFqYXguY3JlYXRlX29yZGVyLm5vbmNlLFxuICAgICAgICAgICAgICAgICAgICBwdXJjaGFzZV91bml0czogW10sXG4gICAgICAgICAgICAgICAgICAgIGJuX2NvZGU6Ym5Db2RlLFxuICAgICAgICAgICAgICAgICAgICBwYXllcixcbiAgICAgICAgICAgICAgICAgICAgY29udGV4dDp0aGlzLmNvbmZpZy5jb250ZXh0XG4gICAgICAgICAgICAgICAgfSksXG4gICAgICAgICAgICB9KS50aGVuKGZ1bmN0aW9uKHJlcykge1xuICAgICAgICAgICAgICAgIHJldHVybiByZXMuanNvbigpO1xuICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbihkYXRhKSB7XG4gICAgICAgICAgICAgICAgaWYgKCFkYXRhLnN1Y2Nlc3MpIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcihkYXRhKTtcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoZGF0YS5kYXRhLm1lc3NhZ2UpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gZGF0YS5kYXRhLmlkO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH07XG5cbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIGNyZWF0ZU9yZGVyLFxuICAgICAgICAgICAgb25BcHByb3ZlOiBvbkFwcHJvdmUodGhpcywgdGhpcy5lcnJvckhhbmRsZXIpLFxuICAgICAgICAgICAgb25FcnJvcjogKGVycm9yKSA9PiB7XG4gICAgICAgICAgICAgICAgdGhpcy5lcnJvckhhbmRsZXIuZ2VuZXJpY0Vycm9yKCk7XG4gICAgICA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ICAgICBmZXRjaChcbiAgICAgICAgICAgICAgICB0aGlzLmVuZHBvaW50LFxuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiAnUE9TVCcsXG4gICAgICAgICAgICAgICAgICAgIGJvZHk6IEpTT04uc3RyaW5naWZ5KHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG5vbmNlOiB0aGlzLm5vbmNlLFxuICAgICAgICAgICAgICAgICAgICAgICAgcHJvZHVjdHMsXG4gICAgICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgKS50aGVuKFxuICAgICAgICAgICAgICAgIChyZXN1bHQpID0+IHtcbiAgICAgICAgICAgICAgICByZXR1cm4gcmVzdWx0Lmpzb24oKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICApLnRoZW4oKHJlc3VsdCkgPT4ge1xuICAgICAgICAgICAgICAgIGlmICghIHJlc3VsdC5zdWNjZXNzKSB7XG4gICAgICAgICAgICAgICAgICAgIHJlamVjdChyZXN1bHQuZGF0YSk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgY29uc3QgcmVzb2x2ZWQgPSBvblJlc29sdmUocmVzdWx0LmRhdGEpO1xuICAgICAgICAgICAgICAgICAgICByZXNvbHZlKHJlc29sdmVkKTtcbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICB9KTtcbiAgICB9XG59XG5cbmV4cG9ydCBkZWZhdWx0IFVwZGF0ZUNhcnQ7IiwiLyoqXG4gKiBXaGVuIHlvdSBjYW4ndCBhZGQgc29tZXRoaW5nIHRvIHRoZSBjYXJ0LCB0aGUgUGF5UGFsIGJ1dHRvbnMgc2hvdWxkIG5vdCBzaG93LlxuICogVGhlcmVmb3JlIHdlIGxpc3RlbiBmb3IgY2hhbmdlcyBvbiB0aGUgYWRkIHRvIGNhcnQgYnV0dG9uIGFuZ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AgY3JlYXRlT3JkZXIoKVxuICAgIHtcbiAgICAgICAgdmFyIGdldFByb2R1Y3RzID0gbnVsbDtcbiAgICAgICAgaWYgKCEgdGhpcy5pc0dyb3VwZWRQcm9kdWN0KCkgKSB7XG4gICAgICAgICAgICBnZXRQcm9kdWN0cyA9ICgpID0+IHtcbiAgICAgICAgICAgICAgICBjb25zdCBpZCA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoJ1tuYW1lPVwiYWRkLXRvLWNhcnRcIl0nKS52YWx1ZTtcbiAgICAgICAgICAgICAgICBjb25zdCBxdHkgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCdbbmFtZT1cInF1YW50aXR5XCJdJykudmFsdWU7XG4gICAgICAgICAgICAgICAgY29uc3QgdmFyaWF0aW9ucyA9IHRoaXMudmFyaWF0aW9ucygpO1xuICAgICAgICAgICAgICAgIHJldHVybiBbbmV3IFByb2R1Y3QoaWQsIHF0eSwgdmFyaWF0aW9ucyldO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgZ2V0UHJvZHVjdHMgPSAoKSA9PiB7XG4gICAgICAgICAgICAgICAgY29uc3QgcHJvZHVjdHMgPSBbXTtcbiAgICAgICAgICAgICAgICB0aGlzLmZvcm1FbGVtZW50LnF1ZXJ5U2VsZWN0b3JBbGwoJ2lucHV0W3R5cGU9XCJudW1iZXJcIl0nKS5mb3JFYWNoKChlbGVtZW50KSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGlmICghIGVsZW1lbnQudmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBjb25zdCBlbGVtZW50TmFtZSA9IGVsZW1lbnQuZ2V0QXR0cmlidXRlKCduYW1lJykubWF0Y2goL3F1YW50aXR5XFxbKFtcXGRdKilcXF0vKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGVsZW1lbnROYW1lLmxlbmd0aCAhPT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGlkID0gcGFyc2VJbnQoZWxlbWVudE5hbWVbMV0pO1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBxdWFudGl0eSA9IHBhcnNlSW50KGVsZW1lbnQudmFsdWUpO1xuICAgICAgICAgICAgICAgICAgICBwcm9kdWN0cy5wdXNoKG5ldyBQcm9kdWN0KGlkLCBxdWFudGl0eSwgbnVsbCkpO1xuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgcmV0dXJuIHByb2R1Y3RzO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGNvbnN0IGNyZWF0ZU9yZGVyID0gKGRhdGEsIGFjdGlvbnMpID0+IHtcbiAgICAgICAgICAgIHRoaXMuZXJyb3JIYW5kbGVyLmNsZWFyKCk7XG5cbiAgICAgICAgICAgIGNvbnN0IG9uUmVzb2x2ZSA9IChwdXJjaGFzZV91bml0cykgPT4ge1xuICAgICAgICAgICAgICAgIGNvbnN0IHBheWVyID0gcGF5ZXJEYXRhKCk7XG4gICAgICAgICAgICAgICAgY29uc3QgYm5Db2RlID0gdHlwZW9mIHRoaXMuY29uZmlnLmJuX2NvZGVzW3RoaXMuY29uZmlnLmNvbnRleHRdICE9PSAndW5kZWZpbmVkJyA/XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY29uZmlnLmJuX2NvZGVzW3RoaXMuY29uZmlnLmNvbnRleHRdIDogJyc7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGZldGNoKHRoaXMuY29uZmlnLmFqYXguY3JlYXRlX29yZGVyLmVuZHBvaW50LCB7XG4gICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ1BPU1QnLFxuICAgICAgICAgICAgICAgICAgICBib2R5OiBKU09OLnN0cmluZ2lmeSh7XG4gICAgICAgICAgICAgICAgICAgICAgICBub25jZTogdGhpcy5jb25maWcuYWpheC5jcmVhdGVfb3JkZXIubm9uY2UsXG4gICAgICAgICAgICAgICAgICAgICAgICBwdXJjaGFzZV91bml0cyxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBheWVyLFxuICAgICAgICAgICAgICAgICAgICAgICAgYm5fY29kZTpibkNvZGUsXG4gICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0OnRoaXMuY29uZmlnLmNvbnRleHRcbiAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICB9KS50aGVuKGZ1bmN0aW9uIChyZXMpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlcy5qc29uKCk7XG4gICAgICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbiAoZGF0YSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoIWRhdGEuc3VjY2Vzcykge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcihkYXRhKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGRhdGEuZGF0YS5tZXNzYWdlKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZGF0YS5kYXRhLmlkO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfTtcblxuICAgICAgICAgICAgY29uc3QgcHJvbWlzZSA9IHRoaXMudXBkYXRlQ2FydC51cGRhdGUob25SZXNvbHZlLCBnZXRQcm9kdWN0cygpKTtcbiAgICAgICAgICAgIHJldHVybiBwcm9taXNlO1xuICAgICAgICB9O1xuICAgICAgICByZXR1cm4gY3JlYXRlT3JkZXI7XG4gICAgfVxuXG4gICAgdmFyaWF0aW9ucygpXG4gICAge1xuXG4gICAgICAgIGlmICghIHRoaXMuaGFzVmFyaWF0aW9ucygpKSB7XG4gICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgICAgfVxuICAgICA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XRld2F5Lmhvc3RlZF9maWVsZHMud3JhcHBlcixcbiAgICAgICAgICAgIGFjdGlvbkhhbmRsZXIuY29uZmlndXJhdGlvbigpLFxuICAgICAgICApO1xuICAgIH1cbn1cblxuZXhwb3J0IGRlZmF1bHQgQ2FydEJvb3RzdHJhcDtcbiIsImNvbnN0IG9uQXBwcm92ZSA9IChjb250ZXh0LCBlcnJvckhhbmRsZXIsIHNwaW5uZXIpID0+IHtcbiAgICByZXR1cm4gKGRhdGEsIGFjdGlvbnMpID0+IHtcbiAgICAgICAgc3Bpbm5lci5ibG9jaygpO1xuICAgICAgICBlcnJvckhhbmRsZXIuY2xlYXIoKTtcblxuICAgICAgICByZXR1cm4gZmV0Y2goY29udGV4dC5jb25maWcuYWpheC5hcHByb3ZlX29yZGVyLmVuZHBvaW50LCB7XG4gICAgICAgICAgICBtZXRob2Q6ICdQT1NUJyxcbiAgICAgICAgICAgIGJvZHk6IEpTT04uc3RyaW5naWZ5KHtcbiAgICAgICAgICAgICAgICBub25jZTogY29udGV4dC5jb25maWcuYWpheC5hcHByb3ZlX29yZGVyLm5vbmNlLFxuICAgICAgICAgICAgICAgIG9yZGVyX2lkOmRhdGEub3JkZXJJRCxcbiAgICAgICAgICAgICAgICBmdW5kaW5nX3NvdXJjZTogd2luZG93LnBwY3BGdW5kaW5nU291cmNlLFxuICAgICAgICAgICAgfSlcbiAgICAgICAgfSkudGhlbigocmVzKT0+e1xuICAgICAgICAgICAgcmV0dXJuIHJlcy5qc29uKCk7XG4gICAgICAgIH0pLnRoZW4oKGRhdGEpPT57XG4gICAgICAgICAgICBzcGlubmVyLnVuYmxvY2soKTtcbiAgICAgICAgICAgIGlmICghZGF0YS5zdWNjZXNzKSB7XG4gICAgICAgICAgICAgICAgaWYgKGRhdGEuZGF0YS5jb2RlID09PSAxMDApIHtcbiAgICAgICAgICAgICAgICAgICAgZXJyb3JIYW5kbGVyLm1lc3NhZ2UoZGF0YS5kYXRhLm1lc3NhZ2UpO1xuICAgICA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GVyID0gKGRhdGEsIGFjdGlvbnMpID0+IHtcbiAgICAgICAgICAgIGNvbnN0IHBheWVyID0gcGF5ZXJEYXRhKCk7XG4gICAgICAgICAgICBjb25zdCBibkNvZGUgPSB0eXBlb2YgdGhpcy5jb25maWcuYm5fY29kZXNbdGhpcy5jb25maWcuY29udGV4dF0gIT09ICd1bmRlZmluZWQnID9cbiAgICAgICAgICAgICAgICB0aGlzLmNvbmZpZy5ibl9jb2Rlc1t0aGlzLmNvbmZpZy5jb250ZXh0XSA6ICcnO1xuXG4gICAgICAgICAgICBjb25zdCBlcnJvckhhbmRsZXIgPSB0aGlzLmVycm9ySGFuZGxlcjtcblxuICAgICAgICAgICAgY29uc3QgZm9ybVNlbGVjdG9yID0gdGhpcy5jb25maWcuY29udGV4dCA9PT0gJ2NoZWNrb3V0JyA/ICdmb3JtLmNoZWNrb3V0JyA6ICdmb3JtI29yZGVyX3Jldmlldyc7XG4gICAgICAgICAgICBjb25zdCBmb3JtVmFsdWVzID0galF1ZXJ5KGZvcm1TZWxlY3Rvcikuc2VyaWFsaXplKCk7XG5cbiAgICAgICAgICAgIGNvbnN0IGNyZWF0ZWFjY291bnQgPSBqUXVlcnkoJyNjcmVhdGVhY2NvdW50JykuaXMoXCI6Y2hlY2tlZFwiKSA/IHRydWUgOiBmYWxzZTtcblxuICAgICAgICAgICAgcmV0dXJuIGZldGNoKHRoaXMuY29uZmlnLmFqYXguY3JlYXRlX29yZGVyLmVuZHBvaW50LCB7XG4gICAgICAgICAgICAgICAgbWV0aG9kOiAnUE9TVCcsXG4gICAgICAgICAgICAgICAgYm9keTogSlNPTi5zdHJpbmdpZnkoe1xuICAgICAgICAgICAgICAgICAgICBub25jZTogdGhpcy5jb25maWcuYWpheC5jcmVhdGVfb3JkZXIubm9uY2UsXG4gICAgICAgICAgICAgICAgICAgIHBheWVyLFxuICAgICAgICAgICAgICAgICAgICBibl9jb2RlOmJuQ29kZSxcbiAgICAgICAgICAgICAgICAgICAgY29udGV4dDp0aGlzLmNvbmZpZy5jb250ZXh0LFxuICAgICAgICAgICAgICAgICAgICBvcmRlcl9pZDp0aGlzLmNvbmZpZy5vcmRlcl9pZCxcbiAgICAgICAgICAgICAgICAgICAgZm9ybTpmb3JtVmFsdWVzLFxuICAgICAgICAgICAgICAgICAgICBjcmVhdGVhY2NvdW50OiBjcmVhdGVhY2NvdW50XG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIH0pLnRoZW4oZnVuY3Rpb24gKHJlcykge1xuICAgICAgICAgICAgICAgIHJldHVybiByZXMuanNvbigpO1xuICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbiAoZGF0YSkge1xuICAgICAgICAgICAgICAgIGlmICghZGF0YS5zdWNjZXNzKSB7XG4gICAgICAgICAgICAgICAgICAgIHNwaW5uZXIudW5ibG9jaygpO1xuICAgICAgICAgICAgICAgICAgICAvL2hhbmRsZSBib3RoIG1lc3NhZ2VzIHNlbnQgZnJvbSBXb29jb21tZXJjZSAoZGF0YS5tZXNzYWdlcykgYW5kIHRoaXMgcGx1Z2luIChkYXRhLmRhdGEubWVzc2FnZSlcbiAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZihkYXRhLm1lc3NhZ2VzKSAhPT0gJ3VuZGVmaW5lZCcgKVxuICAgICAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBkb21QYXJzZXIgPSBuZXcgRE9NUGFyc2VyKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBlcnJvckhhbmRsZXIuYXBwZW5kUHJlcGFyZWRFcnJvck1lc3NhZ2VFbGVtZW50KFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbVBhcnNlci5wYXJzZUZyb21TdHJpbmcoZGF0YS5tZXNzYWdlcywgJ3RleHQvaHRtbCcpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5xdWVyeVNlbGVjdG9yKCd1bCcpXG4gICAgICAgICAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3JIYW5kbGVyLmNsZWFyKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGF0YS5kYXRhLmRldGFpbHMubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9ySGFuZGxlci5tZXNzYWdlKGRhdGEuZGF0YS5kZXRhaWxzLm1hcChkID0+IGAke2QuaXNzdWV9ICR7ZC5kZXNjcmlwdGlvbn1gKS5qb2luKCc8YnIvPicpLCB0cnVlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3JIYW5kbGVyLm1lc3NhZ2UoZGF0YS5kYXRhLm1lc3NhZ2UsIHRydWUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBjb25zdCBpbnB1dCA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2lucHV0Jyk7XG4gICAgICAgICAgICAgICAgaW5wdXQuc2V0QXR0cmlidXRlKCd0eXBlJywgJ2hpZGRlbicpO1xuICAgICAgICAgICAgICAgIGlucHV0LnNldEF0dHJpYnV0ZSgnbmFtZScsICdwcGNwLXJlc3VtZS1vcmRlcicpO1xuICAgICAgICAgICAgICAgIGlucHV0LnNldEF0dHJpYnV0ZSgndmFsdWUnLCBkYXRhLmRhdGEucHVyY2hhc2VfdW5pdHNbMF0uY3VzdG9tX2lkKTtcbiAgICAgICAgICAgICAgICBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKGZvcm1TZWxlY3RvcikuYXBwZW5kKGlucHV0KTtcbiAgICAgICAgICAgICAgICByZXR1cm4gZGF0YS5kYXRhLmlkO1xuICAgIC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0+IHtcbiAgICBjb25zdCBlbGVtZW50ID0gZ2V0RWxlbWVudChzZWxlY3Rvck9yRWxlbWVudCk7XG4gICAgaWYgKCFlbGVtZW50KSB7XG4gICAgICAgIHJldHVybjtcbiAgICB9XG5cbiAgICBjb25zdCBjdXJyZW50VmFsdWUgPSBlbGVtZW50LnN0eWxlLmdldFByb3BlcnR5VmFsdWUoJ2Rpc3BsYXknKTtcblxuICAgIGlmICghc2hvdykge1xuICAgICAgICBpZiAoY3VycmVudFZhbHVlID09PSAnbm9uZScpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIGVsZW1lbnQuc3R5bGUuc2V0UHJvcGVydHkoJ2Rpc3BsYXknLCAnbm9uZScsIGltcG9ydGFudCA/ICdpbXBvcnRhbnQnIDogJycpO1xuICAgIH0gZWxzZSB7XG4gICAgICAgIGlmIChjdXJyZW50VmFsdWUgPT09ICdub25lJykge1xuICAgICAgICAgICAgZWxlbWVudC5zdHlsZS5yZW1vdmVQcm9wZXJ0eSgnZGlzcGxheScpO1xuICAgICAgICB9XG5cbiAgICAgICAgLy8gc3RpbGwgbm90IHZpc2libGUgKGlmIHNvbWV0aGluZyBlbHNlIGFkZGVkIGRpc3BsYXk6IG5vbmUgaW4gQ1NTKVxuICAgICAgICBpZiAoIWlzVmlzaWJsZShlbGVtZW50KSkge1xuICAgICAgICAgICAgZWxlbWVudC5zdHlsZS5zZXRQcm9wZXJ0eSgnZGlzcGxheScsICdibG9jaycpO1xuICAgICAgICB9XG4gICAgfVxufTtcblxuZXhwb3J0IGNvbnN0IGhpZGUgPSAoc2VsZWN0b3JPckVsZW1lbnQsIGltcG9ydGFudCA9IGZhbHNlKSA9PiB7XG4gICAgc2V0VmlzaWJsZShzZWxlY3Rvck9yRWxlbWVudCwgZmFsc2UsIGltcG9ydGFudCk7XG59O1xuXG5leHBvcnQgY29uc3Qgc2hvdyA9IChzZWxlY3Rvck9yRWxlbWVudCkgPT4ge1xuICAgI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cy5jdXJyZW50SG9zdGVkRmllbGRzSW5zdGFuY2UgPSBudWxsO1xuICAgIH1cblxuICAgIHJlbmRlcih3cmFwcGVyLCBjb250ZXh0Q29uZmlnKSB7XG5cbiAgICAgICAgaWYgKFxuICAgICAgICAgICAgKFxuICAgICAgICAgICAgICAgIHRoaXMuZGVmYXVsdENvbmZpZy5jb250ZXh0ICE9PSAnY2hlY2tvdXQnXG4gICAgICAgICAgICAgICAgJiYgdGhpcy5kZWZhdWx0Q29uZmlnLmNvbnRleHQgIT09ICdwYXktbm93J1xuICAgICAgICAgICAgKVxuICAgICAgICAgICAgfHwgd3JhcHBlciA9PT0gbnVsbFxuICAgICAgICAgICAgfHwgZG9jdW1lbnQucXVlcnlTZWxlY3Rvcih3cmFwcGVyKSA9PT0gbnVsbFxuICAgICAgICApIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBpZiAoXG4gICAgICAgICAgICB0eXBlb2YgcGF5cGFsLkhvc3RlZEZpZWxkcyA9PT0gJ3VuZGVmaW5lZCdcbiAgICAgICAgICAgIHx8ICEgcGF5cGFsLkhvc3RlZEZpZWxkcy5pc0VsaWdpYmxlKClcbiAgICAgICAgKSB7XG4gICAgICAgICAgICBjb25zdCB3cmFwcGVyRWxlbWVudCA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3Iod3JhcHBlcik7XG4gICAgICAgICAgICB3cmFwcGVyRWxlbWVudC5wYXJlbnROb2RlLnJlbW92ZUNoaWxkKHdyYXBwZXJFbGVtZW50KTtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmICh0aGlzLmN1cnJlbnRIb3N0ZWRGaWVsZHNJbnN0YW5jZSkge1xuICAgICAgICAgICAgdGhpcy5jdXJyZW50SG9zdGVkRmllbGRzSW5zdGFuY2UudGVhcmRvd24oKVxuICAgICAgICAgICAgICAgIC5jYXRjaChlcnIgPT4gY29uc29sZS5lcnJvcihgSG9zdGV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Y3AtY3JlZGl0LWNhcmQtZ2F0ZXdheS1jYXJkLWN2YycsXG4gICAgICAgICAgICAgICAgICAgIHBsYWNlaG9sZGVyOiB0aGlzLmRlZmF1bHRDb25maWcuaG9zdGVkX2ZpZWxkcy5sYWJlbHMuY3Z2LFxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgZXhwaXJhdGlvbkRhdGU6IHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZWN0b3I6ICcjcHBjcC1jcmVkaXQtY2FyZC1nYXRld2F5LWNhcmQtZXhwaXJ5JyxcbiAgICAgICAgICAgICAgICAgICAgcGxhY2Vob2xkZXI6IHRoaXMuZGVmYXVsdENvbmZpZy5ob3N0ZWRfZmllbGRzLmxhYmVscy5tbV95eSxcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pLnRoZW4oaG9zdGVkRmllbGRzID0+IHtcbiAgICAgICAgICAgIGRvY3VtZW50LmRpc3BhdGNoRXZlbnQobmV3IEN1c3RvbUV2ZW50KFwiaG9zdGVkX2ZpZWxkc19sb2FkZWRcIikpO1xuICAgICAgICAgICAgdGhpcy5jdXJyZW50SG9zdGVkRmllbGRzSW5zdGFuY2UgPSBob3N0ZWRGaWVsZHM7XG5cbiAgICAgICAgICAgIGhvc3RlZEZpZWxkcy5vbignaW5wdXRTdWJtaXRSZXF1ZXN0JywgKCkgPT4ge1xuICAgICAgICAgICAgICAgIHRoaXMuX3N1Ym1pdChjb250ZXh0Q29uZmlnKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgaG9zdGVkRmllbGRzLm9uKCdjYXJkVHlwZUNoYW5nZScsIChldmVudCkgPT4ge1xuICAgICAgICAgICAgICAgIGlmICggISBldmVudC5jYXJkcy5sZW5ndGggKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY2FyZFZhbGlkID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgY29uc3QgdmFsaWRDYXJkcyA9IHRoaXMuZGVmYXVsdENvbmZpZy5ob3N0ZWRfZmllbGRzLnZhbGlkX2NhcmRzO1xuICAgICAgICAgICAgICAgIHRoaXMuY2FyZFZhbGlkID0gdmFsaWRDYXJkcy5pbmRleE9mKGV2ZW50LmNhcmRzWzBdLnR5cGUpICE9PSAtMTtcbiAgICAgICAgICAgIH0pXG4gICAgICAgICAgICBob3N0ZWRGaWVsZHMub24oJ3ZhbGlkaXR5Q2hhbmdlJywgKGV2ZW50KSA9PiB7XG4gICAgICAgICAgICAgICAgY29uc3QgZm9ybVZhbGlkID0gT2JqZWN0LmtleXMoZXZlbnQuZmllbGRzKS5ldmVyeShmdW5jdGlvbiAoa2V5KSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBldmVudC5maWVsZHNba2V5XS5pc1ZhbGlkO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgdGhpcy5mb3JtVmFsaWQgPSBmb3JtVmFsaWQ7XG5cbiAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICBpZiAoZG9jdW1lbnQucXVlcnlTZWxlY3Rvcih3cmFwcGVyKS5nZXRBdHRyaWJ1dGUoJ2RhdGEtcHBjcC1zdWJzY3JpYmVkJykgIT09IHRydWUpIHtcbiAgICAgICAgICAgICAgICBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKHdyYXBwZXIgKyAnIGJ1dHRvbicpLmFkZEV2ZW50TGlzdGVuZXIoXG4gICAgICAgICAgICAgICAgICAgICdjbGljaycsXG4gICAgICAgICAgICAgICAgICAgIGV2ZW50ID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9zdWJtaXQoY29udGV4dENvbmZpZyk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAp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ICAgICAgZmllbGQ6ICdleHBpcmF0aW9uRGF0ZScsXG4gICAgICAgICAgICAgICAgYXR0cmlidXRlOiAnZGlzYWJsZWQnXG4gICAgICAgICAgICB9KVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgZW5hYmxlRmllbGRzKCkge1xuICAgICAgICBpZiAodGhpcy5jdXJyZW50SG9zdGVkRmllbGRzSW5zdGFuY2UpIHtcbiAgICAgICAgICAgIHRoaXMuY3VycmVudEhvc3RlZEZpZWxkc0luc3RhbmNlLnJlbW92ZUF0dHJpYnV0ZSh7XG4gICAgICAgICAgICAgICAgZmllbGQ6ICdudW1iZXInLFxuICAgICAgICAgICAgICAgIGF0dHJpYnV0ZTogJ2Rpc2FibGVkJ1xuICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIHRoaXMuY3VycmVudEhvc3RlZEZpZWxkc0luc3RhbmNlLnJlbW92ZUF0dHJpYnV0ZSh7XG4gICAgICAgICAgICAgICAgZmllbGQ6ICdjdnYnLFxuICAgICAgICAgICAgICAgIGF0dHJpYnV0ZTogJ2Rpc2FibGVkJ1xuICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIHRoaXMuY3VycmVudEhvc3RlZEZpZWxkc0luc3RhbmNlLnJlbW92ZUF0dHJpYnV0ZSh7XG4gICAgICAgICAgICAgICAgZmllbGQ6ICdleHBpcmF0aW9uRGF0ZScsXG4gICAgICAgICAgICAgICAgYXR0cmlidXRlOiAnZGlzYWJsZWQnXG4gICAgICAgICAgICB9KVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgX3N1Ym1pdChjb250ZXh0Q29uZmlnKSB7XG4gICAgICAgIHRoaXMuc3Bpbm5lci5ibG9jaygpO1xuICAgICAgICB0aGlzLmVycm9ySGFuZGxlci5jbGVhcigpO1xuXG4gICAgICAgIGlmICh0aGlzLmZvcm1WYWxpZCAmJiB0aGlzLmNhcmRWYWxpZCkge1xuICAgICAgICAgICAgY29uc3Qgc2F2ZV9jYXJkID0gdGhpcy5kZW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lZEZpZWxkc0RhdGEuY2FyZGhvbGRlck5hbWUpIHtcbiAgICAgICAgICAgICAgICBjb25zdCBmaXJzdE5hbWUgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnYmlsbGluZ19maXJzdF9uYW1lJykgPyBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnYmlsbGluZ19maXJzdF9uYW1lJykudmFsdWUgOiAnJztcbiAgICAgICAgICAgICAgICBjb25zdCBsYXN0TmFtZSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdiaWxsaW5nX2xhc3RfbmFtZScpID8gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ2JpbGxpbmdfbGFzdF9uYW1lJykudmFsdWUgOiAnJztcblxuICAgICAgICAgICAgICAgIGlmICghZmlyc3ROYW1lIHx8ICFsYXN0TmFtZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnNwaW5uZXIudW5ibG9jaygpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmVycm9ySGFuZGxlci5tZXNzYWdlKHRoaXMuZGVmYXVsdENvbmZpZy5ob3N0ZWRfZmllbGRzLmxhYmVscy5jYXJkaG9sZGVyX25hbWVfcmVxdWlyZWQpO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgaG9zdGVkRmllbGRzRGF0YS5jYXJkaG9sZGVyTmFtZSA9IGZpcnN0TmFtZSArICcgJyArIGxhc3ROYW1lO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0aGlzLmN1cnJlbnRIb3N0ZWRGaWVsZHNJbnN0YW5jZS5zdWJtaXQoaG9zdGVkRmllbGRzRGF0YSkudGhlbigocGF5bG9hZCkgPT4ge1xuICAgICAgICAgICAgICAgIHBheWxvYWQub3JkZXJJRCA9IHBheWxvYWQub3JkZXJJZDtcbiAgICAgICAgICAgICAgICB0aGlzLnNwaW5uZXIudW5ibG9jaygpO1xuIC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2FydEJvb3RzdHJhcCA9IG5ldyBNaW5pQ2FydEJvb3RzdGFwKFxuICAgICAgICAgICAgICAgIFBheVBhbENvbW1lcmNlR2F0ZXdheSxcbiAgICAgICAgICAgICAgICByZW5kZXJlclxuICAgICAgICAgICAgKTtcblxuICAgICAgICAgICAgbWluaUNhcnRCb290c3RyYXAuaW5pdCgpO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgaWYgKGNvbnRleHQgPT09ICdwcm9kdWN0JyAmJiBQYXlQYWxDb21tZXJjZUdhdGV3YXkuc2luZ2xlX3Byb2R1Y3RfYnV0dG9uc19lbmFibGVkID09PSAnMScpIHtcbiAgICAgICAgY29uc3Qgc2luZ2xlUHJvZHVjdEJvb3RzdHJhcCA9IG5ldyBTaW5nbGVQcm9kdWN0Qm9vdHN0YXAoXG4gICAgICAgICAgICBQYXlQYWxDb21tZXJjZUdhdGV3YXksXG4gICAgICAgICAgICByZW5kZXJlcixcbiAgICAgICAgICAgIG1lc3NhZ2VSZW5kZXJlcixcbiAgICAgICAgKTtcblxuICAgICAgICBzaW5nbGVQcm9kdWN0Qm9vdHN0cmFwLmluaXQoKTtcbiAgICB9XG5cbiAgICBpZiAoY29udGV4dCA9PT0gJ2NhcnQnKSB7XG4gICAgICAgIGNvbnN0IGNhcnRCb290c3RyYXAgPSBuZXcgQ2FydEJvb3RzdHJhcChcbiAgICAgICAgICAgIFBheVBhbENvbW1lcmNlR2F0ZXdheSxcbiAgICAgICAgICAgIHJlbmRlcmVyLFxuICAgICAgICApO1xuXG4gICAgICAgIGNhcnRCb290c3RyYXAuaW5pdCgpO1xuICAgIH1cblxuICAgIGlmIChjb250ZXh0ID09PSAnY2hlY2tvdXQnKSB7XG4gICAgICAgIGNvbnN0IGNoZWNrb3V0Qm9vdHN0YXAgPSBuZXcgQ2hlY2tvdXRCb290c3RhcChcbiAgICAgICAgICAgIFBheVBhbENvbW1lcmNlR2F0ZXdheSxcbiAgICAgICAgICAgIHJlbmRlcmVyLFxuICAgICAgICAgICAgbWVzc2FnZVJlbmRlcmVyLFxuICAgICAgICAgICAgc3Bpbm5lclxuICAgICAgICApO1xuXG4gICAgICAgIGNoZWNrb3V0Qm9vdHN0YXAuaW5pdCgpO1xuICAgIH1cblxuICAgIGlmIChjb250ZXh0ID09PSAncGF5LW5vdycgKSB7XG4gICAgICAgIGNvbnN0IHBheU5vd0Jvb3RzdHJhcCA9IG5ldyBQYXlOb3dCb290c3RyYXAoXG4gICAgICAgICAgICBQYXlQYWxDb21tZXJjZUdhdGV3YXksXG4gICAgICAgICAgICByZW5kZXJlcixcbiAgICAgICAgICAgIG1lc3NhZ2VSZW5kZXJlcixcbiAgICAgICAgICAgIHNwaW5uZXJcbiAgICAgICAgKTtcbiAgICAgICAgcGF5Tm93Qm9vdHN0cmFwLmluaXQoKTtcbiAgICB9XG5cbiAgICBpZiAoY29udGV4dCAhPT0gJ2NoZWNrb3V0Jykge1xuICAgICAgICBtZXNzYWdlUmVuZGVyZXIucmVuZGVyKCk7XG4gICAgfVxufTtcbmRvY3VtZW50LmFkZEV2ZW50TGlzdGVuZXIoXG4gICAgJ0RPTUNvbnRlbnRMb2FkZWQnLFxuICAgICgpID0+IHtcbiAgICAgICAgaWYgKCF0eXBlb2YgKFBheVBhbENvbW1lcmNlR2F0ZXdheSkpIHtcbiAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoJ1BheVBhbCBidXR0b24gY291bGQgbm90IGJlIGNvbmZpZ3VyZWQuJyk7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoXG4gICAgICAgICAgICBQYXlQYWxDb21tZXJjZUdhdGV3YXkuY29udGV4dCAhPT0gJ2NoZWNrb3V0J1xuICAgICAgICAgICAgJiYgUGF5UGFsQ29tbWVyY2VHYXRld2F5LmRhdGFfY2xpZW50X2lkLnVzZXIgPT09IDBcbiAgICAgICAgICAgICYmIFBheVBhbENvbW1lcmNlR2F0ZXdheS5kYXRhX2NsaWVudF9pZC5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1c2VyIiwiY3VycmVudFRpbWUiLCJEYXRlIiwiZ2V0VGltZSIsImlzRXhwaXJlZCIsImV4cGlyYXRpb24iLCJzdG9yZWRUb2tlbkZvclVzZXIiLCJwYXJzZSIsInNlc3Npb25TdG9yYWdlIiwiZ2V0SXRlbSIsInN0b3JlVG9rZW4iLCJzZXRJdGVtIiwiZGF0YUNsaWVudElkQXR0cmlidXRlSGFuZGxlciIsInNjcmlwdCIsIk1lc3NhZ2VSZW5kZXJlciIsIk1lc3NhZ2VzIiwicGxhY2VtZW50IiwibmV3V3JhcHBlciIsInNpYmxpbmciLCJuZXh0U2libGluZyIsInBhcmVudEVsZW1lbnQiLCJpbnNlcnRCZWZvcmUiLCJTcGlubmVyIiwidGFyZ2V0Iiwic2V0VGFyZ2V0Iiwib3ZlcmxheUNTUyIsImJhY2tncm91bmQiLCJvcGFjaXR5IiwiYnV0dG9uc1NwaW5uZXIiLCJib290c3RyYXAiLCJmdW5kaW5nU291cmNlIiwibWVzc2FnZVJlbmRlcmVyIiwibWluaV9jYXJ0X2J1dHRvbnNfZW5hYmxlZCIsIm1pbmlDYXJ0Qm9vdHN0cmFwIiwic2luZ2xlX3Byb2R1Y3RfYnV0dG9uc19lbmFibGVkIiwic2luZ2xlUHJvZHVjdEJvb3RzdHJhcCIsImNhcnRCb290c3RyYXAiLCJjaGVja291dEJvb3RzdGFwIiwicGF5Tm93Qm9vdHN0cmFwIiwiZGF0YV9jbGllbnRfaWQiLCJoYXNfc3Vic2NyaXB0aW9ucyIsImhpZGVPcmRlckJ1dHRvbklmUHBjcEdhdGV3YXkiLCJpbmNsdWRlcyIsImJvb3RzdHJhcHBlZCIsInVybCIsImVudHJpZXMiLCJzY3JpcHRfYXR0cmlidXRlcyIsImtleVZhbHVlIiwic2V0X2F0dHJpYnV0ZSJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///210\n")}},__webpack_exports__={};__webpack_modules__[210]()})();
1
+ (()=>{"use strict";var __webpack_modules__={536:()=>{eval("\n;// CONCATENATED MODULE: ./resources/js/modules/ErrorHandler.js\nclass ErrorHandler {\n constructor(genericErrorText) {\n this.genericErrorText = genericErrorText;\n this.wrapper = document.querySelector('.woocommerce-notices-wrapper');\n this.messagesList = document.querySelector('ul.woocommerce-error');\n }\n\n genericError() {\n if (this.wrapper.classList.contains('ppcp-persist')) {\n return;\n }\n\n this.clear();\n this.message(this.genericErrorText);\n }\n\n appendPreparedErrorMessageElement(errorMessageElement) {\n if (this.messagesList === null) {\n this.prepareMessagesList();\n }\n\n this.messagesList.replaceWith(errorMessageElement);\n }\n\n message(text, persist = false) {\n if (!typeof String || text.length === 0) {\n throw new Error('A new message text must be a non-empty string.');\n }\n\n if (this.messagesList === null) {\n this.prepareMessagesList();\n }\n\n if (persist) {\n this.wrapper.classList.add('ppcp-persist');\n } else {\n this.wrapper.classList.remove('ppcp-persist');\n }\n\n let messageNode = this.prepareMessagesListItem(text);\n this.messagesList.appendChild(messageNode);\n jQuery.scroll_to_notices(jQuery('.woocommerce-notices-wrapper'));\n }\n\n prepareMessagesList() {\n if (this.messagesList === null) {\n this.messagesList = document.createElement('ul');\n this.messagesList.setAttribute('class', 'woocommerce-error');\n this.messagesList.setAttribute('role', 'alert');\n this.wrapper.appendChild(this.messagesList);\n }\n }\n\n prepareMessagesListItem(message) {\n const li = document.createElement('li');\n li.innerHTML = message;\n return li;\n }\n\n sanitize(text) {\n const textarea = document.createElement('textarea');\n textarea.innerHTML = text;\n return textarea.value.replace('Error: ', '');\n }\n\n clear() {\n if (this.messagesList === null) {\n return;\n }\n\n this.messagesList.innerHTML = '';\n }\n\n}\n\n/* harmony default export */ const modules_ErrorHandler = (ErrorHandler);\n;// CONCATENATED MODULE: ./resources/js/modules/OnApproveHandler/onApproveForContinue.js\nconst onApprove = (context, errorHandler) => {\n return (data, actions) => {\n return fetch(context.config.ajax.approve_order.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: context.config.ajax.approve_order.nonce,\n order_id: data.orderID,\n funding_source: window.ppcpFundingSource\n })\n }).then(res => {\n return res.json();\n }).then(data => {\n if (!data.success) {\n errorHandler.genericError();\n return actions.restart().catch(err => {\n errorHandler.genericError();\n });\n }\n\n location.href = context.config.redirect;\n });\n };\n};\n\n/* harmony default export */ const onApproveForContinue = (onApprove);\n;// CONCATENATED MODULE: ./resources/js/modules/Helper/PayerData.js\nconst payerData = () => {\n const payer = PayPalCommerceGateway.payer;\n\n if (!payer) {\n return null;\n }\n\n const phone = document.querySelector('#billing_phone') || typeof payer.phone !== 'undefined' ? {\n phone_type: \"HOME\",\n phone_number: {\n national_number: document.querySelector('#billing_phone') ? document.querySelector('#billing_phone').value : payer.phone.phone_number.national_number\n }\n } : null;\n const payerData = {\n email_address: document.querySelector('#billing_email') ? document.querySelector('#billing_email').value : payer.email_address,\n name: {\n surname: document.querySelector('#billing_last_name') ? document.querySelector('#billing_last_name').value : payer.name.surname,\n given_name: document.querySelector('#billing_first_name') ? document.querySelector('#billing_first_name').value : payer.name.given_name\n },\n address: {\n country_code: document.querySelector('#billing_country') ? document.querySelector('#billing_country').value : payer.address.country_code,\n address_line_1: document.querySelector('#billing_address_1') ? document.querySelector('#billing_address_1').value : payer.address.address_line_1,\n address_line_2: document.querySelector('#billing_address_2') ? document.querySelector('#billing_address_2').value : payer.address.address_line_2,\n admin_area_1: document.querySelector('#billing_state') ? document.querySelector('#billing_state').value : payer.address.admin_area_1,\n admin_area_2: document.querySelector('#billing_city') ? document.querySelector('#billing_city').value : payer.address.admin_area_2,\n postal_code: document.querySelector('#billing_postcode') ? document.querySelector('#billing_postcode').value : payer.address.postal_code\n }\n };\n\n if (phone) {\n payerData.phone = phone;\n }\n\n return payerData;\n};\n;// CONCATENATED MODULE: ./resources/js/modules/Helper/CheckoutMethodState.js\nconst PaymentMethods = {\n PAYPAL: 'ppcp-gateway',\n CARDS: 'ppcp-credit-card-gateway'\n};\nconst ORDER_BUTTON_SELECTOR = '#place_order';\nconst getCurrentPaymentMethod = () => {\n const el = document.querySelector('input[name=\"payment_method\"]:checked');\n\n if (!el) {\n return null;\n }\n\n return el.value;\n};\nconst isSavedCardSelected = () => {\n const savedCardList = document.querySelector('#saved-credit-card');\n return savedCardList && savedCardList.value !== '';\n};\n;// CONCATENATED MODULE: ./resources/js/modules/ActionHandler/CartActionHandler.js\n\n\n\n\nclass CartActionHandler {\n constructor(config, errorHandler) {\n this.config = config;\n this.errorHandler = errorHandler;\n }\n\n configuration() {\n const createOrder = (data, actions) => {\n const payer = payerData();\n const bnCode = typeof this.config.bn_codes[this.config.context] !== 'undefined' ? this.config.bn_codes[this.config.context] : '';\n return fetch(this.config.ajax.create_order.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: this.config.ajax.create_order.nonce,\n purchase_units: [],\n payment_method: PaymentMethods.PAYPAL,\n funding_source: window.ppcpFundingSource,\n bn_code: bnCode,\n payer,\n context: this.config.context\n })\n }).then(function (res) {\n return res.json();\n }).then(function (data) {\n if (!data.success) {\n console.error(data);\n throw Error(data.data.message);\n }\n\n return data.data.id;\n });\n };\n\n return {\n createOrder,\n onApprove: onApproveForContinue(this, this.errorHandler),\n onError: error => {\n this.errorHandler.genericError();\n }\n };\n }\n\n}\n\n/* harmony default export */ const ActionHandler_CartActionHandler = (CartActionHandler);\n;// CONCATENATED MODULE: ./resources/js/modules/ContextBootstrap/MiniCartBootstap.js\n\n\n\nclass MiniCartBootstap {\n constructor(gateway, renderer) {\n this.gateway = gateway;\n this.renderer = renderer;\n this.actionHandler = null;\n }\n\n init() {\n this.actionHandler = new ActionHandler_CartActionHandler(PayPalCommerceGateway, new modules_ErrorHandler(this.gateway.labels.error.generic));\n this.render();\n jQuery(document.body).on('wc_fragments_loaded wc_fragments_refreshed', () => {\n this.render();\n });\n }\n\n shouldRender() {\n return document.querySelector(this.gateway.button.mini_cart_wrapper) !== null || document.querySelector(this.gateway.hosted_fields.mini_cart_wrapper) !== null;\n }\n\n render() {\n if (!this.shouldRender()) {\n return;\n }\n\n this.renderer.render(this.gateway.button.mini_cart_wrapper, this.gateway.hosted_fields.mini_cart_wrapper, this.actionHandler.configuration());\n }\n\n}\n\n/* harmony default export */ const ContextBootstrap_MiniCartBootstap = (MiniCartBootstap);\n;// CONCATENATED MODULE: ./resources/js/modules/Helper/UpdateCart.js\n\n\nclass UpdateCart {\n constructor(endpoint, nonce) {\n this.endpoint = endpoint;\n this.nonce = nonce;\n }\n /**\n *\n * @param onResolve\n * @param {Product[]} products\n * @returns {Promise<unknown>}\n */\n\n\n update(onResolve, products) {\n return new Promise((resolve, reject) => {\n fetch(this.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: this.nonce,\n products\n })\n }).then(result => {\n return result.json();\n }).then(result => {\n if (!result.success) {\n reject(result.data);\n return;\n }\n\n const resolved = onResolve(result.data);\n resolve(resolved);\n });\n });\n }\n\n}\n\n/* harmony default export */ const Helper_UpdateCart = (UpdateCart);\n;// CONCATENATED MODULE: ./resources/js/modules/Helper/ButtonsToggleListener.js\n/**\n * When you can't add something to the cart, the PayPal buttons should not show.\n * Therefore we listen for changes on the add to cart button and show/hide the buttons accordingly.\n */\nclass ButtonsToggleListener {\n constructor(element, showCallback, hideCallback) {\n this.element = element;\n this.showCallback = showCallback;\n this.hideCallback = hideCallback;\n this.observer = null;\n }\n\n init() {\n const config = {\n attributes: true\n };\n\n const callback = () => {\n if (this.element.classList.contains('disabled')) {\n this.hideCallback();\n return;\n }\n\n this.showCallback();\n };\n\n this.observer = new MutationObserver(callback);\n this.observer.observe(this.element, config);\n callback();\n }\n\n disconnect() {\n this.observer.disconnect();\n }\n\n}\n\n/* harmony default export */ const Helper_ButtonsToggleListener = (ButtonsToggleListener);\n;// CONCATENATED MODULE: ./resources/js/modules/Entity/Product.js\nclass Product {\n constructor(id, quantity, variations) {\n this.id = id;\n this.quantity = quantity;\n this.variations = variations;\n }\n\n data() {\n return {\n id: this.id,\n quantity: this.quantity,\n variations: this.variations\n };\n }\n\n}\n\n/* harmony default export */ const Entity_Product = (Product);\n;// CONCATENATED MODULE: ./resources/js/modules/ActionHandler/SingleProductActionHandler.js\n\n\n\n\n\n\nclass SingleProductActionHandler {\n constructor(config, updateCart, showButtonCallback, hideButtonCallback, formElement, errorHandler) {\n this.config = config;\n this.updateCart = updateCart;\n this.showButtonCallback = showButtonCallback;\n this.hideButtonCallback = hideButtonCallback;\n this.formElement = formElement;\n this.errorHandler = errorHandler;\n }\n\n configuration() {\n if (this.hasVariations()) {\n const observer = new Helper_ButtonsToggleListener(this.formElement.querySelector('.single_add_to_cart_button'), this.showButtonCallback, this.hideButtonCallback);\n observer.init();\n }\n\n return {\n createOrder: this.createOrder(),\n onApprove: onApproveForContinue(this, this.errorHandler),\n onError: error => {\n this.errorHandler.genericError();\n }\n };\n }\n\n createOrder() {\n var getProducts = null;\n\n if (!this.isGroupedProduct()) {\n getProducts = () => {\n const id = document.querySelector('[name=\"add-to-cart\"]').value;\n const qty = document.querySelector('[name=\"quantity\"]').value;\n const variations = this.variations();\n return [new Entity_Product(id, qty, variations)];\n };\n } else {\n getProducts = () => {\n const products = [];\n this.formElement.querySelectorAll('input[type=\"number\"]').forEach(element => {\n if (!element.value) {\n return;\n }\n\n const elementName = element.getAttribute('name').match(/quantity\\[([\\d]*)\\]/);\n\n if (elementName.length !== 2) {\n return;\n }\n\n const id = parseInt(elementName[1]);\n const quantity = parseInt(element.value);\n products.push(new Entity_Product(id, quantity, null));\n });\n return products;\n };\n }\n\n const createOrder = (data, actions) => {\n this.errorHandler.clear();\n\n const onResolve = purchase_units => {\n const payer = payerData();\n const bnCode = typeof this.config.bn_codes[this.config.context] !== 'undefined' ? this.config.bn_codes[this.config.context] : '';\n return fetch(this.config.ajax.create_order.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: this.config.ajax.create_order.nonce,\n purchase_units,\n payer,\n bn_code: bnCode,\n payment_method: PaymentMethods.PAYPAL,\n funding_source: window.ppcpFundingSource,\n context: this.config.context\n })\n }).then(function (res) {\n return res.json();\n }).then(function (data) {\n if (!data.success) {\n console.error(data);\n throw Error(data.data.message);\n }\n\n return data.data.id;\n });\n };\n\n const promise = this.updateCart.update(onResolve, getProducts());\n return promise;\n };\n\n return createOrder;\n }\n\n variations() {\n if (!this.hasVariations()) {\n return null;\n }\n\n const attributes = [...this.formElement.querySelectorAll(\"[name^='attribute_']\")].map(element => {\n return {\n value: element.value,\n name: element.name\n };\n });\n return attributes;\n }\n\n hasVariations() {\n return this.formElement.classList.contains('variations_form');\n }\n\n isGroupedProduct() {\n return this.formElement.classList.contains('grouped_form');\n }\n\n}\n\n/* harmony default export */ const ActionHandler_SingleProductActionHandler = (SingleProductActionHandler);\n;// CONCATENATED MODULE: ./resources/js/modules/ContextBootstrap/SingleProductBootstap.js\n\n\n\n\nclass SingleProductBootstap {\n constructor(gateway, renderer, messages) {\n this.gateway = gateway;\n this.renderer = renderer;\n this.messages = messages;\n }\n\n handleChange() {\n if (!this.shouldRender()) {\n this.renderer.hideButtons(this.gateway.hosted_fields.wrapper);\n this.renderer.hideButtons(this.gateway.button.wrapper);\n return;\n }\n\n this.render();\n }\n\n init() {\n document.querySelector('form.cart').addEventListener('change', this.handleChange.bind(this));\n\n if (!this.shouldRender()) {\n this.renderer.hideButtons(this.gateway.hosted_fields.wrapper);\n return;\n }\n\n this.render();\n }\n\n shouldRender() {\n return document.querySelector('form.cart') !== null && !this.priceAmountIsZero();\n }\n\n priceAmountIsZero() {\n let priceText = \"0\";\n\n if (document.querySelector('form.cart ins .woocommerce-Price-amount')) {\n priceText = document.querySelector('form.cart ins .woocommerce-Price-amount').innerText;\n } else if (document.querySelector('form.cart .woocommerce-Price-amount')) {\n priceText = document.querySelector('form.cart .woocommerce-Price-amount').innerText;\n } else if (document.querySelector('.product .woocommerce-Price-amount')) {\n priceText = document.querySelector('.product .woocommerce-Price-amount').innerText;\n }\n\n const amount = parseFloat(priceText.replace(/([^\\d,\\.\\s]*)/g, ''));\n return amount === 0;\n }\n\n render() {\n const actionHandler = new ActionHandler_SingleProductActionHandler(this.gateway, new Helper_UpdateCart(this.gateway.ajax.change_cart.endpoint, this.gateway.ajax.change_cart.nonce), () => {\n this.renderer.showButtons(this.gateway.button.wrapper);\n this.renderer.showButtons(this.gateway.hosted_fields.wrapper);\n let priceText = \"0\";\n\n if (document.querySelector('form.cart ins .woocommerce-Price-amount')) {\n priceText = document.querySelector('form.cart ins .woocommerce-Price-amount').innerText;\n } else if (document.querySelector('form.cart .woocommerce-Price-amount')) {\n priceText = document.querySelector('form.cart .woocommerce-Price-amount').innerText;\n }\n\n const amount = parseInt(priceText.replace(/([^\\d,\\.\\s]*)/g, ''));\n this.messages.renderWithAmount(amount);\n }, () => {\n this.renderer.hideButtons(this.gateway.button.wrapper);\n this.renderer.hideButtons(this.gateway.hosted_fields.wrapper);\n }, document.querySelector('form.cart'), new modules_ErrorHandler(this.gateway.labels.error.generic));\n this.renderer.render(this.gateway.button.wrapper, this.gateway.hosted_fields.wrapper, actionHandler.configuration());\n }\n\n}\n\n/* harmony default export */ const ContextBootstrap_SingleProductBootstap = (SingleProductBootstap);\n;// CONCATENATED MODULE: ./resources/js/modules/ContextBootstrap/CartBootstap.js\n\n\n\nclass CartBootstrap {\n constructor(gateway, renderer) {\n this.gateway = gateway;\n this.renderer = renderer;\n }\n\n init() {\n if (!this.shouldRender()) {\n return;\n }\n\n this.render();\n jQuery(document.body).on('updated_cart_totals updated_checkout', () => {\n this.render();\n });\n }\n\n shouldRender() {\n return document.querySelector(this.gateway.button.wrapper) !== null || document.querySelector(this.gateway.hosted_fields.wrapper) !== null;\n }\n\n render() {\n const actionHandler = new ActionHandler_CartActionHandler(PayPalCommerceGateway, new modules_ErrorHandler(this.gateway.labels.error.generic));\n this.renderer.render(this.gateway.button.wrapper, this.gateway.hosted_fields.wrapper, actionHandler.configuration());\n }\n\n}\n\n/* harmony default export */ const CartBootstap = (CartBootstrap);\n;// CONCATENATED MODULE: ./resources/js/modules/OnApproveHandler/onApproveForPayNow.js\nconst onApproveForPayNow_onApprove = (context, errorHandler, spinner) => {\n return (data, actions) => {\n spinner.block();\n errorHandler.clear();\n return fetch(context.config.ajax.approve_order.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: context.config.ajax.approve_order.nonce,\n order_id: data.orderID,\n funding_source: window.ppcpFundingSource\n })\n }).then(res => {\n return res.json();\n }).then(data => {\n spinner.unblock();\n\n if (!data.success) {\n if (data.data.code === 100) {\n errorHandler.message(data.data.message);\n } else {\n errorHandler.genericError();\n }\n\n if (typeof actions !== 'undefined' && typeof actions.restart !== 'undefined') {\n return actions.restart();\n }\n\n throw new Error(data.data.message);\n }\n\n document.querySelector('#place_order').click();\n });\n };\n};\n\n/* harmony default export */ const onApproveForPayNow = (onApproveForPayNow_onApprove);\n;// CONCATENATED MODULE: ./resources/js/modules/ActionHandler/CheckoutActionHandler.js\n\n\n\n\nclass CheckoutActionHandler {\n constructor(config, errorHandler, spinner) {\n this.config = config;\n this.errorHandler = errorHandler;\n this.spinner = spinner;\n }\n\n configuration() {\n const spinner = this.spinner;\n\n const createOrder = (data, actions) => {\n const payer = payerData();\n const bnCode = typeof this.config.bn_codes[this.config.context] !== 'undefined' ? this.config.bn_codes[this.config.context] : '';\n const errorHandler = this.errorHandler;\n const formSelector = this.config.context === 'checkout' ? 'form.checkout' : 'form#order_review';\n const formValues = jQuery(formSelector).serialize();\n const createaccount = jQuery('#createaccount').is(\":checked\") ? true : false;\n return fetch(this.config.ajax.create_order.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: this.config.ajax.create_order.nonce,\n payer,\n bn_code: bnCode,\n context: this.config.context,\n order_id: this.config.order_id,\n payment_method: getCurrentPaymentMethod(),\n funding_source: window.ppcpFundingSource,\n form: formValues,\n createaccount: createaccount\n })\n }).then(function (res) {\n return res.json();\n }).then(function (data) {\n if (!data.success) {\n spinner.unblock(); //handle both messages sent from Woocommerce (data.messages) and this plugin (data.data.message)\n\n if (typeof data.messages !== 'undefined') {\n const domParser = new DOMParser();\n errorHandler.appendPreparedErrorMessageElement(domParser.parseFromString(data.messages, 'text/html').querySelector('ul'));\n } else {\n errorHandler.clear();\n\n if (data.data.details.length > 0) {\n errorHandler.message(data.data.details.map(d => `${d.issue} ${d.description}`).join('<br/>'), true);\n } else {\n errorHandler.message(data.data.message, true);\n }\n }\n\n return;\n }\n\n const input = document.createElement('input');\n input.setAttribute('type', 'hidden');\n input.setAttribute('name', 'ppcp-resume-order');\n input.setAttribute('value', data.data.purchase_units[0].custom_id);\n document.querySelector(formSelector).append(input);\n return data.data.id;\n });\n };\n\n return {\n createOrder,\n onApprove: onApproveForPayNow(this, this.errorHandler, this.spinner),\n onCancel: () => {\n spinner.unblock();\n },\n onError: () => {\n this.errorHandler.genericError();\n spinner.unblock();\n }\n };\n }\n\n}\n\n/* harmony default export */ const ActionHandler_CheckoutActionHandler = (CheckoutActionHandler);\n;// CONCATENATED MODULE: ./resources/js/modules/Helper/Hiding.js\nconst getElement = selectorOrElement => {\n if (typeof selectorOrElement === 'string') {\n return document.querySelector(selectorOrElement);\n }\n\n return selectorOrElement;\n};\n\nconst isVisible = element => {\n return !!(element.offsetWidth || element.offsetHeight || element.getClientRects().length);\n};\nconst setVisible = (selectorOrElement, show, important = false) => {\n const element = getElement(selectorOrElement);\n\n if (!element) {\n return;\n }\n\n const currentValue = element.style.getPropertyValue('display');\n\n if (!show) {\n if (currentValue === 'none') {\n return;\n }\n\n element.style.setProperty('display', 'none', important ? 'important' : '');\n } else {\n if (currentValue === 'none') {\n element.style.removeProperty('display');\n } // still not visible (if something else added display: none in CSS)\n\n\n if (!isVisible(element)) {\n element.style.setProperty('display', 'block');\n }\n }\n};\nconst hide = (selectorOrElement, important = false) => {\n setVisible(selectorOrElement, false, important);\n};\nconst show = selectorOrElement => {\n setVisible(selectorOrElement, true);\n};\n;// CONCATENATED MODULE: ./resources/js/modules/ContextBootstrap/CheckoutBootstap.js\n\n\n\n\n\nclass CheckoutBootstap {\n constructor(gateway, renderer, messages, spinner) {\n this.gateway = gateway;\n this.renderer = renderer;\n this.messages = messages;\n this.spinner = spinner;\n this.standardOrderButtonSelector = ORDER_BUTTON_SELECTOR;\n this.buttonChangeObserver = new MutationObserver(el => {\n this.updateUi();\n });\n }\n\n init() {\n this.render(); // Unselect saved card.\n // WC saves form values, so with our current UI it would be a bit weird\n // if the user paid with saved, then after some time tries to pay again,\n // but wants to enter a new card, and to do that they have to choose “Select payment” in the list.\n\n jQuery('#saved-credit-card').val(jQuery('#saved-credit-card option:first').val());\n jQuery(document.body).on('updated_checkout', () => {\n this.render();\n });\n jQuery(document.body).on('updated_checkout payment_method_selected', () => {\n this.updateUi();\n });\n jQuery(document).on('hosted_fields_loaded', () => {\n jQuery('#saved-credit-card').on('change', () => {\n this.updateUi();\n });\n });\n this.updateUi();\n }\n\n shouldRender() {\n if (document.querySelector(this.gateway.button.cancel_wrapper)) {\n return false;\n }\n\n return document.querySelector(this.gateway.button.wrapper) !== null || document.querySelector(this.gateway.hosted_fields.wrapper) !== null;\n }\n\n render() {\n if (!this.shouldRender()) {\n return;\n }\n\n if (document.querySelector(this.gateway.hosted_fields.wrapper + '>div')) {\n document.querySelector(this.gateway.hosted_fields.wrapper + '>div').setAttribute('style', '');\n }\n\n const actionHandler = new ActionHandler_CheckoutActionHandler(PayPalCommerceGateway, new modules_ErrorHandler(this.gateway.labels.error.generic), this.spinner);\n this.renderer.render(this.gateway.button.wrapper, this.gateway.hosted_fields.wrapper, actionHandler.configuration());\n this.buttonChangeObserver.observe(document.querySelector(this.standardOrderButtonSelector), {\n attributes: true\n });\n }\n\n updateUi() {\n const currentPaymentMethod = getCurrentPaymentMethod();\n const isPaypal = currentPaymentMethod === PaymentMethods.PAYPAL;\n const isCard = currentPaymentMethod === PaymentMethods.CARDS;\n const isSavedCard = isCard && isSavedCardSelected();\n const isNotOurGateway = !isPaypal && !isCard;\n const isFreeTrial = PayPalCommerceGateway.is_free_trial_cart;\n const hasVaultedPaypal = PayPalCommerceGateway.vaulted_paypal_email !== '';\n setVisible(this.standardOrderButtonSelector, isPaypal && isFreeTrial && hasVaultedPaypal || isNotOurGateway || isSavedCard, true);\n setVisible('.ppcp-vaulted-paypal-details', isPaypal);\n setVisible(this.gateway.button.wrapper, isPaypal && !(isFreeTrial && hasVaultedPaypal));\n setVisible(this.gateway.messages.wrapper, isPaypal && !isFreeTrial);\n setVisible(this.gateway.hosted_fields.wrapper, isCard && !isSavedCard);\n\n if (isPaypal && !isFreeTrial) {\n this.messages.render();\n }\n\n if (isCard) {\n if (isSavedCard) {\n this.disableCreditCardFields();\n } else {\n this.enableCreditCardFields();\n }\n }\n }\n\n disableCreditCardFields() {\n jQuery('label[for=\"ppcp-credit-card-gateway-card-number\"]').addClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('#ppcp-credit-card-gateway-card-number').addClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('label[for=\"ppcp-credit-card-gateway-card-expiry\"]').addClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('#ppcp-credit-card-gateway-card-expiry').addClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('label[for=\"ppcp-credit-card-gateway-card-cvc\"]').addClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('#ppcp-credit-card-gateway-card-cvc').addClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('label[for=\"vault\"]').addClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('#ppcp-credit-card-vault').addClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('#ppcp-credit-card-vault').attr(\"disabled\", true);\n this.renderer.disableCreditCardFields();\n }\n\n enableCreditCardFields() {\n jQuery('label[for=\"ppcp-credit-card-gateway-card-number\"]').removeClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('#ppcp-credit-card-gateway-card-number').removeClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('label[for=\"ppcp-credit-card-gateway-card-expiry\"]').removeClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('#ppcp-credit-card-gateway-card-expiry').removeClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('label[for=\"ppcp-credit-card-gateway-card-cvc\"]').removeClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('#ppcp-credit-card-gateway-card-cvc').removeClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('label[for=\"vault\"]').removeClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('#ppcp-credit-card-vault').removeClass('ppcp-credit-card-gateway-form-field-disabled');\n jQuery('#ppcp-credit-card-vault').attr(\"disabled\", false);\n this.renderer.enableCreditCardFields();\n }\n\n}\n\n/* harmony default export */ const ContextBootstrap_CheckoutBootstap = (CheckoutBootstap);\n;// CONCATENATED MODULE: ./resources/js/modules/Helper/Subscriptions.js\nconst isChangePaymentPage = () => {\n const urlParams = new URLSearchParams(window.location.search);\n return urlParams.has('change_payment_method');\n};\n;// CONCATENATED MODULE: ./resources/js/modules/ContextBootstrap/PayNowBootstrap.js\n\n\n\nclass PayNowBootstrap extends ContextBootstrap_CheckoutBootstap {\n constructor(gateway, renderer, messages, spinner) {\n super(gateway, renderer, messages, spinner);\n }\n\n updateUi() {\n if (isChangePaymentPage()) {\n return;\n }\n\n super.updateUi();\n }\n\n}\n\n/* harmony default export */ const ContextBootstrap_PayNowBootstrap = (PayNowBootstrap);\n;// CONCATENATED MODULE: ./resources/js/modules/Renderer/Renderer.js\nclass Renderer {\n constructor(creditCardRenderer, defaultConfig, onSmartButtonClick, onSmartButtonsInit) {\n this.defaultConfig = defaultConfig;\n this.creditCardRenderer = creditCardRenderer;\n this.onSmartButtonClick = onSmartButtonClick;\n this.onSmartButtonsInit = onSmartButtonsInit;\n }\n\n render(wrapper, hostedFieldsWrapper, contextConfig) {\n this.renderButtons(wrapper, contextConfig);\n this.creditCardRenderer.render(hostedFieldsWrapper, contextConfig);\n }\n\n renderButtons(wrapper, contextConfig) {\n if (!document.querySelector(wrapper) || this.isAlreadyRendered(wrapper) || 'undefined' === typeof paypal.Buttons) {\n return;\n }\n\n const style = wrapper === this.defaultConfig.button.wrapper ? this.defaultConfig.button.style : this.defaultConfig.button.mini_cart_style;\n paypal.Buttons({\n style,\n ...contextConfig,\n onClick: this.onSmartButtonClick,\n onInit: this.onSmartButtonsInit\n }).render(wrapper);\n }\n\n isAlreadyRendered(wrapper) {\n return document.querySelector(wrapper).hasChildNodes();\n }\n\n hideButtons(element) {\n const domElement = document.querySelector(element);\n\n if (!domElement) {\n return false;\n }\n\n domElement.style.display = 'none';\n return true;\n }\n\n showButtons(element) {\n const domElement = document.querySelector(element);\n\n if (!domElement) {\n return false;\n }\n\n domElement.style.display = 'block';\n return true;\n }\n\n disableCreditCardFields() {\n this.creditCardRenderer.disableFields();\n }\n\n enableCreditCardFields() {\n this.creditCardRenderer.enableFields();\n }\n\n}\n\n/* harmony default export */ const Renderer_Renderer = (Renderer);\n;// CONCATENATED MODULE: ./resources/js/modules/Helper/DccInputFactory.js\nconst dccInputFactory = original => {\n const styles = window.getComputedStyle(original);\n const newElement = document.createElement('span');\n newElement.setAttribute('id', original.id);\n Object.values(styles).forEach(prop => {\n if (!styles[prop] || !isNaN(prop)) {\n return;\n }\n\n newElement.style.setProperty(prop, '' + styles[prop]);\n });\n return newElement;\n};\n\n/* harmony default export */ const DccInputFactory = (dccInputFactory);\n;// CONCATENATED MODULE: ./resources/js/modules/Renderer/CreditCardRenderer.js\n\n\n\nclass CreditCardRenderer {\n constructor(defaultConfig, errorHandler, spinner) {\n this.defaultConfig = defaultConfig;\n this.errorHandler = errorHandler;\n this.spinner = spinner;\n this.cardValid = false;\n this.formValid = false;\n this.currentHostedFieldsInstance = null;\n }\n\n render(wrapper, contextConfig) {\n if (this.defaultConfig.context !== 'checkout' && this.defaultConfig.context !== 'pay-now' || wrapper === null || document.querySelector(wrapper) === null) {\n return;\n }\n\n if (typeof paypal.HostedFields === 'undefined' || !paypal.HostedFields.isEligible()) {\n const wrapperElement = document.querySelector(wrapper);\n wrapperElement.parentNode.removeChild(wrapperElement);\n return;\n }\n\n const buttonSelector = wrapper + ' button';\n\n if (this.currentHostedFieldsInstance) {\n this.currentHostedFieldsInstance.teardown().catch(err => console.error(`Hosted fields teardown error: ${err}`));\n this.currentHostedFieldsInstance = null;\n }\n\n const gateWayBox = document.querySelector('.payment_box.payment_method_ppcp-credit-card-gateway');\n const oldDisplayStyle = gateWayBox.style.display;\n gateWayBox.style.display = 'block';\n const hideDccGateway = document.querySelector('#ppcp-hide-dcc');\n\n if (hideDccGateway) {\n hideDccGateway.parentNode.removeChild(hideDccGateway);\n }\n\n const cardNumberField = document.querySelector('#ppcp-credit-card-gateway-card-number');\n const stylesRaw = window.getComputedStyle(cardNumberField);\n let styles = {};\n Object.values(stylesRaw).forEach(prop => {\n if (!stylesRaw[prop]) {\n return;\n }\n\n styles[prop] = '' + stylesRaw[prop];\n });\n const cardNumber = DccInputFactory(cardNumberField);\n cardNumberField.parentNode.replaceChild(cardNumber, cardNumberField);\n const cardExpiryField = document.querySelector('#ppcp-credit-card-gateway-card-expiry');\n const cardExpiry = DccInputFactory(cardExpiryField);\n cardExpiryField.parentNode.replaceChild(cardExpiry, cardExpiryField);\n const cardCodeField = document.querySelector('#ppcp-credit-card-gateway-card-cvc');\n const cardCode = DccInputFactory(cardCodeField);\n cardCodeField.parentNode.replaceChild(cardCode, cardCodeField);\n gateWayBox.style.display = oldDisplayStyle;\n const formWrapper = '.payment_box payment_method_ppcp-credit-card-gateway';\n\n if (this.defaultConfig.enforce_vault && document.querySelector(formWrapper + ' .ppcp-credit-card-vault')) {\n document.querySelector(formWrapper + ' .ppcp-credit-card-vault').checked = true;\n document.querySelector(formWrapper + ' .ppcp-credit-card-vault').setAttribute('disabled', true);\n }\n\n paypal.HostedFields.render({\n createOrder: contextConfig.createOrder,\n styles: {\n 'input': styles\n },\n fields: {\n number: {\n selector: '#ppcp-credit-card-gateway-card-number',\n placeholder: this.defaultConfig.hosted_fields.labels.credit_card_number\n },\n cvv: {\n selector: '#ppcp-credit-card-gateway-card-cvc',\n placeholder: this.defaultConfig.hosted_fields.labels.cvv\n },\n expirationDate: {\n selector: '#ppcp-credit-card-gateway-card-expiry',\n placeholder: this.defaultConfig.hosted_fields.labels.mm_yy\n }\n }\n }).then(hostedFields => {\n document.dispatchEvent(new CustomEvent(\"hosted_fields_loaded\"));\n this.currentHostedFieldsInstance = hostedFields;\n hostedFields.on('inputSubmitRequest', () => {\n this._submit(contextConfig);\n });\n hostedFields.on('cardTypeChange', event => {\n if (!event.cards.length) {\n this.cardValid = false;\n return;\n }\n\n const validCards = this.defaultConfig.hosted_fields.valid_cards;\n this.cardValid = validCards.indexOf(event.cards[0].type) !== -1;\n });\n hostedFields.on('validityChange', event => {\n const formValid = Object.keys(event.fields).every(function (key) {\n return event.fields[key].isValid;\n });\n this.formValid = formValid;\n });\n show(buttonSelector);\n\n if (document.querySelector(wrapper).getAttribute('data-ppcp-subscribed') !== true) {\n document.querySelector(buttonSelector).addEventListener('click', event => {\n event.preventDefault();\n\n this._submit(contextConfig);\n });\n document.querySelector(wrapper).setAttribute('data-ppcp-subscribed', true);\n }\n });\n document.querySelector('#payment_method_ppcp-credit-card-gateway').addEventListener('click', () => {\n document.querySelector('label[for=ppcp-credit-card-gateway-card-number]').click();\n });\n }\n\n disableFields() {\n if (this.currentHostedFieldsInstance) {\n this.currentHostedFieldsInstance.setAttribute({\n field: 'number',\n attribute: 'disabled'\n });\n this.currentHostedFieldsInstance.setAttribute({\n field: 'cvv',\n attribute: 'disabled'\n });\n this.currentHostedFieldsInstance.setAttribute({\n field: 'expirationDate',\n attribute: 'disabled'\n });\n }\n }\n\n enableFields() {\n if (this.currentHostedFieldsInstance) {\n this.currentHostedFieldsInstance.removeAttribute({\n field: 'number',\n attribute: 'disabled'\n });\n this.currentHostedFieldsInstance.removeAttribute({\n field: 'cvv',\n attribute: 'disabled'\n });\n this.currentHostedFieldsInstance.removeAttribute({\n field: 'expirationDate',\n attribute: 'disabled'\n });\n }\n }\n\n _submit(contextConfig) {\n this.spinner.block();\n this.errorHandler.clear();\n\n if (this.formValid && this.cardValid) {\n const save_card = this.defaultConfig.can_save_vault_token ? true : false;\n let vault = document.getElementById('ppcp-credit-card-vault') ? document.getElementById('ppcp-credit-card-vault').checked : save_card;\n\n if (this.defaultConfig.enforce_vault) {\n vault = true;\n }\n\n const contingency = this.defaultConfig.hosted_fields.contingency;\n const hostedFieldsData = {\n vault: vault\n };\n\n if (contingency !== 'NO_3D_SECURE') {\n hostedFieldsData.contingencies = [contingency];\n }\n\n if (this.defaultConfig.payer) {\n hostedFieldsData.cardholderName = this.defaultConfig.payer.name.given_name + ' ' + this.defaultConfig.payer.name.surname;\n }\n\n if (!hostedFieldsData.cardholderName) {\n const firstName = document.getElementById('billing_first_name') ? document.getElementById('billing_first_name').value : '';\n const lastName = document.getElementById('billing_last_name') ? document.getElementById('billing_last_name').value : '';\n\n if (!firstName || !lastName) {\n this.spinner.unblock();\n this.errorHandler.message(this.defaultConfig.hosted_fields.labels.cardholder_name_required);\n return;\n }\n\n hostedFieldsData.cardholderName = firstName + ' ' + lastName;\n }\n\n this.currentHostedFieldsInstance.submit(hostedFieldsData).then(payload => {\n payload.orderID = payload.orderId;\n this.spinner.unblock();\n return contextConfig.onApprove(payload);\n }).catch(err => {\n this.spinner.unblock();\n this.errorHandler.clear();\n\n if (err.details) {\n this.errorHandler.message(err.details.map(d => `${d.issue} ${d.description}`).join('<br/>'), true);\n }\n });\n } else {\n this.spinner.unblock();\n const message = !this.cardValid ? this.defaultConfig.hosted_fields.labels.card_not_supported : this.defaultConfig.hosted_fields.labels.fields_not_valid;\n this.errorHandler.message(message);\n }\n }\n\n}\n\n/* harmony default export */ const Renderer_CreditCardRenderer = (CreditCardRenderer);\n;// CONCATENATED MODULE: ./resources/js/modules/DataClientIdAttributeHandler.js\nconst storageKey = 'ppcp-data-client-id';\n\nconst validateToken = (token, user) => {\n if (!token) {\n return false;\n }\n\n if (token.user !== user) {\n return false;\n }\n\n const currentTime = new Date().getTime();\n const isExpired = currentTime >= token.expiration * 1000;\n return !isExpired;\n};\n\nconst storedTokenForUser = user => {\n const token = JSON.parse(sessionStorage.getItem(storageKey));\n\n if (validateToken(token, user)) {\n return token.token;\n }\n\n return null;\n};\n\nconst storeToken = token => {\n sessionStorage.setItem(storageKey, JSON.stringify(token));\n};\n\nconst dataClientIdAttributeHandler = (script, config) => {\n fetch(config.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: config.nonce\n })\n }).then(res => {\n return res.json();\n }).then(data => {\n const isValid = validateToken(data, config.user);\n\n if (!isValid) {\n return;\n }\n\n storeToken(data);\n script.setAttribute('data-client-token', data.token);\n document.body.append(script);\n });\n};\n\n/* harmony default export */ const DataClientIdAttributeHandler = (dataClientIdAttributeHandler);\n;// CONCATENATED MODULE: ./resources/js/modules/Renderer/MessageRenderer.js\nclass MessageRenderer {\n constructor(config) {\n this.config = config;\n }\n\n render() {\n if (!this.shouldRender()) {\n return;\n }\n\n paypal.Messages({\n amount: this.config.amount,\n placement: this.config.placement,\n style: this.config.style\n }).render(this.config.wrapper);\n }\n\n renderWithAmount(amount) {\n if (!this.shouldRender()) {\n return;\n }\n\n const newWrapper = document.createElement('div');\n newWrapper.setAttribute('id', this.config.wrapper.replace('#', ''));\n const sibling = document.querySelector(this.config.wrapper).nextSibling;\n document.querySelector(this.config.wrapper).parentElement.removeChild(document.querySelector(this.config.wrapper));\n sibling.parentElement.insertBefore(newWrapper, sibling);\n paypal.Messages({\n amount,\n placement: this.config.placement,\n style: this.config.style\n }).render(this.config.wrapper);\n }\n\n shouldRender() {\n if (typeof paypal.Messages === 'undefined' || typeof this.config.wrapper === 'undefined') {\n return false;\n }\n\n if (!document.querySelector(this.config.wrapper)) {\n return false;\n }\n\n return true;\n }\n\n}\n\n/* harmony default export */ const Renderer_MessageRenderer = (MessageRenderer);\n;// CONCATENATED MODULE: ./resources/js/modules/Helper/Spinner.js\nclass Spinner {\n constructor(target = 'form.woocommerce-checkout') {\n this.target = target;\n }\n\n setTarget(target) {\n this.target = target;\n }\n\n block() {\n jQuery(this.target).block({\n message: null,\n overlayCSS: {\n background: '#fff',\n opacity: 0.6\n }\n });\n }\n\n unblock() {\n jQuery(this.target).unblock();\n }\n\n}\n\n/* harmony default export */ const Helper_Spinner = (Spinner);\n;// CONCATENATED MODULE: ./resources/js/modules/ActionHandler/FreeTrialHandler.js\n\n\n\nclass FreeTrialHandler {\n constructor(config, spinner, errorHandler) {\n this.config = config;\n this.spinner = spinner;\n this.errorHandler = errorHandler;\n }\n\n handle() {\n this.spinner.block();\n fetch(this.config.ajax.vault_paypal.endpoint, {\n method: 'POST',\n body: JSON.stringify({\n nonce: this.config.ajax.vault_paypal.nonce,\n return_url: location.href\n })\n }).then(res => {\n return res.json();\n }).then(data => {\n if (!data.success) {\n this.spinner.unblock();\n console.error(data);\n this.errorHandler.message(data.data.message);\n throw Error(data.data.message);\n }\n\n location.href = data.data.approve_link;\n }).catch(error => {\n this.spinner.unblock();\n console.error(error);\n this.errorHandler.genericError();\n });\n }\n\n}\n\n/* harmony default export */ const ActionHandler_FreeTrialHandler = (FreeTrialHandler);\n;// CONCATENATED MODULE: ./resources/js/button.js\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst buttonsSpinner = new Helper_Spinner('.ppc-button-wrapper');\nconst cardsSpinner = new Helper_Spinner('#ppcp-hosted-fields');\n\nconst bootstrap = () => {\n const errorHandler = new modules_ErrorHandler(PayPalCommerceGateway.labels.error.generic);\n const spinner = new Helper_Spinner();\n const creditCardRenderer = new Renderer_CreditCardRenderer(PayPalCommerceGateway, errorHandler, spinner);\n const freeTrialHandler = new ActionHandler_FreeTrialHandler(PayPalCommerceGateway, spinner, errorHandler);\n\n const onSmartButtonClick = (data, actions) => {\n window.ppcpFundingSource = data.fundingSource;\n const form = document.querySelector('form.woocommerce-checkout');\n\n if (form) {\n jQuery('#ppcp-funding-source-form-input').remove();\n form.insertAdjacentHTML('beforeend', `<input type=\"hidden\" name=\"ppcp-funding-source\" value=\"${data.fundingSource}\" id=\"ppcp-funding-source-form-input\">`);\n }\n\n const isFreeTrial = PayPalCommerceGateway.is_free_trial_cart;\n\n if (isFreeTrial && data.fundingSource !== 'card') {\n freeTrialHandler.handle();\n return actions.reject();\n }\n };\n\n const onSmartButtonsInit = () => {\n buttonsSpinner.unblock();\n };\n\n const renderer = new Renderer_Renderer(creditCardRenderer, PayPalCommerceGateway, onSmartButtonClick, onSmartButtonsInit);\n const messageRenderer = new Renderer_MessageRenderer(PayPalCommerceGateway.messages);\n const context = PayPalCommerceGateway.context;\n\n if (context === 'mini-cart' || context === 'product') {\n if (PayPalCommerceGateway.mini_cart_buttons_enabled === '1') {\n const miniCartBootstrap = new ContextBootstrap_MiniCartBootstap(PayPalCommerceGateway, renderer);\n miniCartBootstrap.init();\n }\n }\n\n if (context === 'product' && PayPalCommerceGateway.single_product_buttons_enabled === '1') {\n const singleProductBootstrap = new ContextBootstrap_SingleProductBootstap(PayPalCommerceGateway, renderer, messageRenderer);\n singleProductBootstrap.init();\n }\n\n if (context === 'cart') {\n const cartBootstrap = new CartBootstap(PayPalCommerceGateway, renderer);\n cartBootstrap.init();\n }\n\n if (context === 'checkout') {\n const checkoutBootstap = new ContextBootstrap_CheckoutBootstap(PayPalCommerceGateway, renderer, messageRenderer, spinner);\n checkoutBootstap.init();\n }\n\n if (context === 'pay-now') {\n const payNowBootstrap = new ContextBootstrap_PayNowBootstrap(PayPalCommerceGateway, renderer, messageRenderer, spinner);\n payNowBootstrap.init();\n }\n\n if (context !== 'checkout') {\n messageRenderer.render();\n }\n};\n\ndocument.addEventListener('DOMContentLoaded', () => {\n if (!typeof PayPalCommerceGateway) {\n console.error('PayPal button could not be configured.');\n return;\n }\n\n if (PayPalCommerceGateway.context !== 'checkout' && PayPalCommerceGateway.data_client_id.user === 0 && PayPalCommerceGateway.data_client_id.has_subscriptions) {\n return;\n } // Sometimes PayPal script takes long time to load,\n // so we additionally hide the standard order button here to avoid failed orders.\n // Normally it is hidden later after the script load.\n\n\n const hideOrderButtonIfPpcpGateway = () => {\n // only in checkout and pay now page, otherwise it may break things (e.g. payment via product page),\n // and also the loading spinner may look weird on other pages\n if (!['checkout', 'pay-now'].includes(PayPalCommerceGateway.context) || isChangePaymentPage() || PayPalCommerceGateway.is_free_trial_cart && PayPalCommerceGateway.vaulted_paypal_email !== '') {\n return;\n }\n\n const currentPaymentMethod = getCurrentPaymentMethod();\n const isPaypal = currentPaymentMethod === PaymentMethods.PAYPAL;\n const isCards = currentPaymentMethod === PaymentMethods.CARDS;\n setVisible(ORDER_BUTTON_SELECTOR, !isPaypal && !isCards, true);\n\n if (isPaypal) {\n // stopped after the first rendering of the buttons, in onInit\n buttonsSpinner.block();\n } else {\n buttonsSpinner.unblock();\n }\n\n if (isCards) {\n cardsSpinner.block();\n } else {\n cardsSpinner.unblock();\n }\n };\n\n jQuery(document).on('hosted_fields_loaded', () => {\n cardsSpinner.unblock();\n });\n let bootstrapped = false;\n hideOrderButtonIfPpcpGateway();\n jQuery(document.body).on('updated_checkout payment_method_selected', () => {\n if (bootstrapped) {\n return;\n }\n\n hideOrderButtonIfPpcpGateway();\n });\n const script = document.createElement('script');\n script.addEventListener('load', event => {\n bootstrapped = true;\n bootstrap();\n });\n script.setAttribute('src', PayPalCommerceGateway.button.url);\n Object.entries(PayPalCommerceGateway.script_attributes).forEach(keyValue => {\n script.setAttribute(keyValue[0], keyValue[1]);\n });\n\n if (PayPalCommerceGateway.data_client_id.set_attribute) {\n DataClientIdAttributeHandler(script, PayPalCommerceGateway.data_client_id);\n return;\n }\n\n document.body.append(script);\n});//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTM2LmpzIiwibWFwcGluZ3MiOiI7O0FBQUEsTUFBTUEsWUFBTixDQUFtQjtBQUVmQyxFQUFBQSxXQUFXLENBQUNDLGdCQUFELEVBQ1g7QUFDSSxTQUFLQSxnQkFBTCxHQUF3QkEsZ0JBQXhCO0FBQ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0ZVwiO1xuXG5jbGFzcyBDYXJ0QWN0aW9uSGFuZGxlciB7XG5cbiAgICBjb25zdHJ1Y3Rvcihjb25maWcsIGVycm9ySGFuZGxlcikge1xuICAgICAgICB0aGlzLmNvbmZpZyA9IGNvbmZpZztcbiAgICAgICAgdGhpcy5lcnJvckhhbmRsZXIgPSBlcnJvckhhbmRsZXI7XG4gICAgfVxuXG4gICAgY29uZmlndXJhdGlvbigpIHtcbiAgICAgICAgY29uc3QgY3JlYXRlT3JkZXIgPSAoZGF0YSwgYWN0aW9ucykgPT4ge1xuICAgICAgICAgICAgY29uc3QgcGF5ZXIgPSBwYXllckRhdGEoKTtcbiAgICAgICAgICAgIGNvbnN0IGJuQ29kZSA9IHR5cGVvZiB0aGlzLmNvbmZpZy5ibl9jb2Rlc1t0aGlzLmNvbmZpZy5jb250ZXh0XSAhPT0gJ3VuZGVmaW5lZCcgP1xuICAgICAgICAgICAgICAgIHRoaXMuY29uZmlnLmJuX2NvZGVzW3RoaXMuY29uZmlnLmNvbnRleHRdIDogJyc7XG4gICAgICAgICAgICByZXR1cm4gZmV0Y2godGhpcy5jb25maWcuYWpheC5jcmVhdGVfb3JkZXIuZW5kcG9pbnQsIHtcbiAgICAgICAgICAgICAgICBtZXRob2Q6ICdQT1NUJyxcbiAgICAgICAgICAgICAgICBib2R5OiBKU09OLnN0cmluZ2lmeSh7XG4gICAgICAgICAgICAgICAgICAgIG5vbmNlOiB0aGlzLmNvbmZpZy5hamF4LmNyZWF0ZV9vcmRlci5ub25jZSxcbiAgICAgICAgICAgICAgICAgICAgcHVyY2hhc2VfdW5pdHM6IFtdLFxuICAgICAgICAgICAgICAgICAgICBwYXltZW50X21ldGhvZDogUGF5bWVudE1ldGhvZHMuUEFZUEFMLFxuICAgICAgICAgICAgICAgICAgICBmdW5kaW5nX3NvdXJjZTogd2luZG93LnBwY3BGdW5kaW5nU291cmNlLFxuICAgICAgICAgICAgICAgICAgICBibl9jb2RlOmJuQ29kZSxcbiAgICAgICAgICAgICAgICAgICAgcGF5ZXIsXG4gICAgICAgICAgICAgICAgICAgIGNvbnRleHQ6dGhpcy5jb25maWcuY29udGV4dFxuICAgICAgICAgICAgICAgIH0pLFxuICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbihyZXMpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gcmVzLmpzb24oKTtcbiAgICAgICAgICAgIH0pLnRoZW4oZnVuY3Rpb24oZGF0YSkge1xuICAgICAgICAgICAgICAgIGlmICghZGF0YS5zdWNjZXNzKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoZGF0YSk7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGRhdGEuZGF0YS5tZXNzYWdlKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIGRhdGEuZGF0YS5pZDtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9O1xuXG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICBjcmVhdGVPcmRlcixcbiAgICAgICAgICAgIG9uQXBwcm92ZTogb25BcHByb3ZlKHRoaXMsIHRoaXMuZXJyb3JIYW5kbGVyKSxcbiAgICAgICAgICAgIG9uRXJyb3I6IChlcnJvcikgPT4ge1xuICAgICAgICAgICAgICAgIHRoaXMuZXJyb3JIYW5kbGVyLmdlbmVyaWNFcnJvcigpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9O1xuICAgIH1cbn1cblxuZXhwb3J0IGRlZmF1bHQgQ2FydEFjdGlvbkhhbmRsZXI7XG4iLCJpbXBvcnQgRXJyb3JIYW5kbGVyIGZyb20gJy4uL0Vycm9ySGFuZGxlcic7XG5pbXBvcnQgQ2FydEFjdGlvbkhhbmRsZXIgZnJvbSAnLi4vQWN0aW9uSGFuZGxlci9DYXJ0QWN0aW9uSGFuZGxlcic7XG5cbmNsYXNzIE1pbmlDYXJ0Qm9vdHN0YXAge1xuICAgIGNvbnN0cnVjdG9yKGdhd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XR0b24ubWluaV9jYXJ0X3dyYXBwZXIsXG4gICAgICAgICAgICB0aGlzLmdhdGV3YXkuaG9zdGVkX2ZpZWxkcy5taW5pX2NhcnRfd3JhcHBlcixcbiAgICAgICAgICAgIHRoaXMuYWN0aW9uSGFuZGxlci5jb25maWd1cmF0aW9uKClcbiAgICAgICAgKTtcbiAgICB9XG59XG5cbmV4cG9ydCBkZWZhdWx0IE1pbmlDYXJ0Qm9vdHN0YXA7XG4iLCJpbXBvcnQgUHJvZHVjdCBmcm9tIFwiLi4vRW50aXR5L1Byb2R1Y3RcIjtcbmNsYXNzIFVwZGF0ZUNhcnQge1xuXG4gICAgY29uc3RydWN0b3IoZW5kcG9pbnQsIG5vbmNlKVxuICAgIHtcbiAgICAgICAgdGhpcy5lbmRwb2ludCA9IGVuZHBvaW50O1xuICAgICAgICB0aGlzLm5vbmNlID0gbm9uY2U7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICpcbiAgICAgKiBAcGFyYW0gb25SZXNvbHZlXG4gICAgICogQHBhcmFtIHtQcm9kdWN0W119IHByb2R1Y3RzXG4gICAgICogQHJldHVybnMge1Byb21pc2U8dW5rbm93bj59XG4gICAgICovXG4gICAgdXBkYXRlKG9uUmVzb2x2ZSwgcHJvZHVjdHMpXG4gICAge1xuICAgICAgICByZXR1cm4gbmV3IFByb21pc2UoKHJlc29sdmUsIHJlamVjdCkgPT4ge1xuICAgICAgICAgICAgZmV0Y2goXG4gICAgICAgICAgICAgICAgdGhpcy5lbmRwb2ludCxcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ1BPU1QnLFxuICAgICAgICAgICAgICAgICAgICBib2R5OiBKU09OLnN0cmluZ2lmeSh7XG4gICAgICAgICAgICAgICAgICAgICAgICBub25jZTogdGhpcy5ub25jZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHByb2R1Y3RzLFxuICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICkudGhlbihcbiAgICAgICAgICAgICAgICAocmVzdWx0KSA9PiB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHJlc3VsdC5qc29uKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgKS50aGVuKChyZXN1bHQpID0+IHtcbiAgICAgICAgICAgICAgICBpZiAoISByZXN1bHQuc3VjY2Vzcykge1xuICAgICAgICAgICAgICAgICAgICByZWplY3QocmVzdWx0LmRhdGEpO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHJlc29sdmVkID0gb25SZXNvbHZlKHJlc3VsdC5kYXRhKTtcbiAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZShyZXNvbHZlZCk7XG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgfSk7XG4gICAgfVxufVxuXG5leHBvcnQgZGVmYXVsdCBVcGRhdGVDYXJ0OyIsIi8qKlxuICogV2hlbiB5b3UgY2FuJ3QgYWRkIHNvbWV0aGluZyB0byB0aGUgY2FydCwgdGhlIFBheVBhbCBidXR0b25zIHNob3VsZCBub3Qgc2hvdy5cbiAqIFRoZXJlZm9yZSB3ZSBsaXN0ZW4gZm9yIGNoYW5nZXMgb24gdGhlIGFkZCB0byBjYXJ0IGJ1dHRvbiBhbmQgc2hvdy9oaWRlIHRoZSBidXR0b25zIGFjY29yZGluZ2x5LlxuICovXG5cbmNsYXNzIEJ1dHRvbnNUb2dnbGVMaXN0ZW5lciB7XG4gICAgY29uc3RydWN0b3IoZWxlbWVudCwgc2hvd0NhbGxiYWNrLCBoaWRlQ2FsbGJhY2spXG4gICAge1xuICAgICAgICB0aGlzLmVsZW1lbnQgPSBlbGVtZW50O1xuICAgICAgICB0aGlzLnNob3dDYWxsYmFjayA9IHNob3dDYWxsYmFjaztcbiAgICAgICAgdGhpcy5oaWRlQ2FsbGJhY2sgPSBoaWRlQ2F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uYW1lPVwiYWRkLXRvLWNhcnRcIl0nKS52YWx1ZTtcbiAgICAgICAgICAgICAgICBjb25zdCBxdHkgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCdbbmFtZT1cInF1YW50aXR5XCJdJykudmFsdWU7XG4gICAgICAgICAgICAgICAgY29uc3QgdmFyaWF0aW9ucyA9IHRoaXMudmFyaWF0aW9ucygpO1xuICAgICAgICAgICAgICAgIHJldHVybiBbbmV3IFByb2R1Y3QoaWQsIHF0eSwgdmFyaWF0aW9ucyldO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgZ2V0UHJvZHVjdHMgPSAoKSA9PiB7XG4gICAgICAgICAgICAgICAgY29uc3QgcHJvZHVjdHMgPSBbXTtcbiAgICAgICAgICAgICAgICB0aGlzLmZvcm1FbGVtZW50LnF1ZXJ5U2VsZWN0b3JBbGwoJ2lucHV0W3R5cGU9XCJudW1iZXJcIl0nKS5mb3JFYWNoKChlbGVtZW50KSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGlmICghIGVsZW1lbnQudmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBjb25zdCBlbGVtZW50TmFtZSA9IGVsZW1lbnQuZ2V0QXR0cmlidXRlKCduYW1lJykubWF0Y2goL3F1YW50aXR5XFxbKFtcXGRdKilcXF0vKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGVsZW1lbnROYW1lLmxlbmd0aCAhPT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGlkID0gcGFyc2VJbnQoZWxlbWVudE5hbWVbMV0pO1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBxdWFudGl0eSA9IHBhcnNlSW50KGVsZW1lbnQudmFsdWUpO1xuICAgICAgICAgICAgICAgICAgICBwcm9kdWN0cy5wdXNoKG5ldyBQcm9kdWN0KGlkLCBxdWFudGl0eSwgbnVsbCkpO1xuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgcmV0dXJuIHByb2R1Y3RzO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGNvbnN0IGNyZWF0ZU9yZGVyID0gKGRhdGEsIGFjdGlvbnMpID0+IHtcbiAgICAgICAgICAgIHRoaXMuZXJyb3JIYW5kbGVyLmNsZWFyKCk7XG5cbiAgICAgICAgICAgIGNvbnN0IG9uUmVzb2x2ZSA9IChwdXJjaGFzZV91bml0cykgPT4ge1xuICAgICAgICAgICAgICAgIGNvbnN0IHBheWVyID0gcGF5ZXJEYXRhKCk7XG4gICAgICAgICAgICAgICAgY29uc3QgYm5Db2RlID0gdHlwZW9mIHRoaXMuY29uZmlnLmJuX2NvZGVzW3RoaXMuY29uZmlnLmNvbnRleHRdICE9PSAndW5kZWZpbmVkJyA/XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY29uZmlnLmJuX2NvZGVzW3RoaXMuY29uZmlnLmNvbnRleHRdIDogJyc7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGZldGNoKHRoaXMuY29uZmlnLmFqYXguY3JlYXRlX29yZGVyLmVuZHBvaW50LCB7XG4gICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ1BPU1QnLFxuICAgICAgICAgICAgICAgICAgICBib2R5OiBKU09OLnN0cmluZ2lmeSh7XG4gICAgICAgICAgICAgICAgICAgICAgICBub25jZTogdGhpcy5jb25maWcuYWpheC5jcmVhdGVfb3JkZXIubm9uY2UsXG4gICAgICAgICAgICAgICAgICAgICAgICBwdXJjaGFzZV91bml0cyxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBheWVyLFxuICAgICAgICAgICAgICAgICAgICAgICAgYm5fY29kZTpibkNvZGUsXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXltZW50X21ldGhvZDogUGF5bWVudE1ldGhvZHMuUEFZUEFMLFxuICAgICAgICAgICAgICAgICAgICAgICAgZnVuZGluZ19zb3VyY2U6IHdpbmRvdy5wcGNwRnVuZGluZ1NvdXJjZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRleHQ6dGhpcy5jb25maWcuY29udGV4dFxuICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgIH0pLnRoZW4oZnVuY3Rpb24gKHJlcykge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmVzLmpzb24oKTtcbiAgICAgICAgICAgICAgICB9KS50aGVuKGZ1bmN0aW9uIChkYXRhKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICghZGF0YS5zdWNjZXNzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmVycm9yKGRhdGEpO1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoZGF0YS5kYXRhLm1lc3NhZ2UpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBkYXRhLmRhdGEuaWQ7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9O1xuXG4gICAgICAgICAgICBjb25zdCBwcm9taXNlID0gdGhpcy51cGRhdGVDYXJ0LnVwZGF0ZShvblJlc29sdmUsIGdldFByb2R1Y3RzKCkpO1xuICAgICAgICAgICAgcmV0dXJuIHByb21pc2U7XG4gICAgICAgIH07XG4gICAgICAgIHJldHVybiBjcmVhdGVPcmRlcjtcbiAgICB9XG5cbiAgICB2YXJpYXRpb25zKClcbiAgICB7XG5cbiAgICAgICAgaWYgKCEgdGhpcy5oYXNWYXJpYXRpb25zKCkpIHtcbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG4gICAgICAgIGNvbnN0IGF0dHJpYnV0ZXMgPSBbLi4udGhpcy5mb3JtRWxlbWVudC5xdWVyeVNlbGVjdG9yQWxs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pcy5nYXRld2F5LmFqYXguY2hhbmdlX2NhcnQuZW5kcG9pbnQsXG4gICAgICAgICAgICAgICAgdGhpcy5nYXRld2F5LmFqYXguY2hhbmdlX2NhcnQubm9uY2UsXG4gICAgICAgICAgICApLFxuICAgICAgICAgICAgKCkgPT4ge1xuICAgICAgICAgICAgICAgIHRoaXMucmVuZGVyZXIuc2hvd0J1dHRvbnModGhpcy5nYXRld2F5LmJ1dHRvbi53cmFwcGVyKTtcbiAgICAgICAgICAgICAgICB0aGlzLnJlbmRlcmVyLnNob3dCdXR0b25zKHRoaXMuZ2F0ZXdheS5ob3N0ZWRfZmllbGRzLndyYXBwZXIpO1xuICAgICAgICAgICAgICAgIGxldCBwcmljZVRleHQgPSBcIjBcIjtcbiAgICAgICAgICAgICAgICBpZiAoZG9jdW1lbnQucXVlcnlTZWxlY3RvcignZm9ybS5jYXJ0IGlucyAud29vY29tbWVyY2UtUHJpY2UtYW1vdW50JykpIHtcbiAgICAgICAgICAgICAgICAgICAgcHJpY2VUZXh0ID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvcignZm9ybS5jYXJ0IGlucyAud29vY29tbWVyY2UtUHJpY2UtYW1vdW50JykuaW5uZXJUZXh0O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIGlmIChkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCdmb3JtLmNhcnQgLndvb2NvbW1lcmNlLVByaWNlLWFtb3VudCcpKSB7XG4gICAgICAgICAgICAgICAgICAgIHByaWNlVGV4dCA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoJ2Zvcm0uY2FydCAud29vY29tbWVyY2UtUHJpY2UtYW1vdW50JykuaW5uZXJUZXh0O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBjb25zdCBhbW91bnQgPSBwYXJzZUludChwcmljZVRleHQucmVwbGFjZSgvKFteXFxkLFxcLlxcc10qKS9nLCAnJykpO1xuICAgICAgICAgICAgICAg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7XG4gICAgfVxufVxuXG5leHBvcnQgZGVmYXVsdCBDYXJ0Qm9vdHN0cmFwO1xuIiwiY29uc3Qgb25BcHByb3ZlID0gKGNvbnRleHQsIGVycm9ySGFuZGxlciwgc3Bpbm5lcikgPT4ge1xuICAgIHJldHVybiAoZGF0YSwgYWN0aW9ucykgPT4ge1xuICAgICAgICBzcGlubmVyLmJsb2NrKCk7XG4gICAgICAgIGVycm9ySGFuZGxlci5jbGVhcigpO1xuXG4gICAgICAgIHJldHVybiBmZXRjaChjb250ZXh0LmNvbmZpZy5hamF4LmFwcHJvdmVfb3JkZXIuZW5kcG9pbnQsIHtcbiAgICAgICAgICAgIG1ldGhvZDogJ1BPU1QnLFxuICAgICAgICAgICAgYm9keTogSlNPTi5zdHJpbmdpZnkoe1xuICAgICAgICAgICAgICAgIG5vbmNlOiBjb250ZXh0LmNvbmZpZy5hamF4LmFwcHJvdmVfb3JkZXIubm9uY2UsXG4gICAgICAgICAgICAgICAgb3JkZXJfaWQ6ZGF0YS5vcmRlcklELFxuICAgICAgICAgICAgICAgIGZ1bmRpbmdfc291cmNlOiB3aW5kb3cucHBjcEZ1bmRpbmdTb3VyY2UsXG4gICAgICAgICAgICB9KVxuICAgICAgICB9KS50aGVuKChyZXMpPT57XG4gICAgICAgICAgICByZXR1cm4gcmVzLmpzb24oKTtcbiAgICAgICAgfSkudGhlbigoZGF0YSk9PntcbiAgICAgICAgICAgIHNwaW5uZXIudW5ibG9jaygpO1xuICAgICAgICAgICAgaWYgKCFkYXRhLnN1Y2Nlc3MpIHtcbiAgICAgICAgICAgICAgICBpZiAoZGF0YS5kYXRhLmNvZGUgPT09IDEwMCkge1xuICAgICAgICAgICAgICAgICAgICBlcnJvckhhbmRsZXIubWVzc2FnZShkYXRhLmRhdGEubWVzc2FnZSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgZXJyb3JIYW5kbGVyLmdlbmVyaWNFcnJvcigpO1xuICAgICAgIC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PcmRlciA9IChkYXRhLCBhY3Rpb25zKSA9PiB7XG4gICAgICAgICAgICBjb25zdCBwYXllciA9IHBheWVyRGF0YSgpO1xuICAgICAgICAgICAgY29uc3QgYm5Db2RlID0gdHlwZW9mIHRoaXMuY29uZmlnLmJuX2NvZGVzW3RoaXMuY29uZmlnLmNvbnRleHRdICE9PSAndW5kZWZpbmVkJyA/XG4gICAgICAgICAgICAgICAgdGhpcy5jb25maWcuYm5fY29kZXNbdGhpcy5jb25maWcuY29udGV4dF0gOiAnJztcblxuICAgICAgICAgICAgY29uc3QgZXJyb3JIYW5kbGVyID0gdGhpcy5lcnJvckhhbmRsZXI7XG5cbiAgICAgICAgICAgIGNvbnN0IGZvcm1TZWxlY3RvciA9IHRoaXMuY29uZmlnLmNvbnRleHQgPT09ICdjaGVja291dCcgPyAnZm9ybS5jaGVja291dCcgOiAnZm9ybSNvcmRlcl9yZXZpZXcnO1xuICAgICAgICAgICAgY29uc3QgZm9ybVZhbHVlcyA9IGpRdWVyeShmb3JtU2VsZWN0b3IpLnNlcmlhbGl6ZSgpO1xuXG4gICAgICAgICAgICBjb25zdCBjcmVhdGVhY2NvdW50ID0galF1ZXJ5KCcjY3JlYXRlYWNjb3VudCcpLmlzKFwiOmNoZWNrZWRcIikgPyB0cnVlIDogZmFsc2U7XG5cbiAgICAgICAgICAgIHJldHVybiBmZXRjaCh0aGlzLmNvbmZpZy5hamF4LmNyZWF0ZV9vcmRlci5lbmRwb2ludCwge1xuICAgICAgICAgICAgICAgIG1ldGhvZDogJ1BPU1QnLFxuICAgICAgICAgICAgICAgIGJvZHk6IEpTT04uc3RyaW5naWZ5KHtcbiAgICAgICAgICAgICAgICAgICAgbm9uY2U6IHRoaXMuY29uZmlnLmFqYXguY3JlYXRlX29yZGVyLm5vbmNlLFxuICAgICAgICAgICAgICAgICAgICBwYXllcixcbiAgICAgICAgICAgICAgICAgICAgYm5fY29kZTpibkNvZGUsXG4gICAgICAgICAgICAgICAgICAgIGNvbnRleHQ6dGhpcy5jb25maWcuY29udGV4dCxcbiAgICAgICAgICAgICAgICAgICAgb3JkZXJfaWQ6dGhpcy5jb25maWcub3JkZXJfaWQsXG4gICAgICAgICAgICAgICAgICAgIHBheW1lbnRfbWV0aG9kOiBnZXRDdXJyZW50UGF5bWVudE1ldGhvZCgpLFxuICAgICAgICAgICAgICAgICAgICBmdW5kaW5nX3NvdXJjZTogd2luZG93LnBwY3BGdW5kaW5nU291cmNlLFxuICAgICAgICAgICAgICAgICAgICBmb3JtOmZvcm1WYWx1ZXMsXG4gICAgICAgICAgICAgICAgICAgIGNyZWF0ZWFjY291bnQ6IGNyZWF0ZWFjY291bnRcbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbiAocmVzKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHJlcy5qc29uKCk7XG4gICAgICAgICAgICB9KS50aGVuKGZ1bmN0aW9uIChkYXRhKSB7XG4gICAgICAgICAgICAgICAgaWYgKCFkYXRhLnN1Y2Nlc3MpIHtcbiAgICAgICAgICAgICAgICAgICAgc3Bpbm5lci51bmJsb2NrKCk7XG4gICAgICAgICAgICAgICAgICAgIC8vaGFuZGxlIGJvdGggbWVzc2FnZXMgc2VudCBmcm9tIFdvb2NvbW1lcmNlIChkYXRhLm1lc3NhZ2VzKSBhbmQgdGhpcyBwbHVnaW4gKGRhdGEuZGF0YS5tZXNzYWdlKVxuICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mKGRhdGEubWVzc2FnZXMpICE9PSAndW5kZWZpbmVkJyApXG4gICAgICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGRvbVBhcnNlciA9IG5ldyBET01QYXJzZXIoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGVycm9ySGFuZGxlci5hcHBlbmRQcmVwYXJlZEVycm9yTWVzc2FnZUVsZW1lbnQoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9tUGFyc2VyLnBhcnNlRnJvbVN0cmluZyhkYXRhLm1lc3NhZ2VzLCAndGV4dC9odG1sJylcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLnF1ZXJ5U2VsZWN0b3IoJ3VsJylcbiAgICAgICAgICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBlcnJvckhhbmRsZXIuY2xlYXIoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkYXRhLmRhdGEuZGV0YWlscy5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3JIYW5kbGVyLm1lc3NhZ2UoZGF0YS5kYXRhLmRldGFpbHMubWFwKGQgPT4gYCR7ZC5pc3N1ZX0gJHtkLmRlc2NyaXB0aW9ufWApLmpvaW4oJzxici8+JyksIHRydWUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvckhhbmRsZXIubWVzc2FnZShkYXRhLmRhdGEubWVzc2FnZSwgdHJ1ZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNvbnN0IGlucHV0ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnaW5wdXQnKTtcbiAgICAgICAgICAgICAgICBpbnB1dC5zZXRBdHRyaWJ1dGUoJ3R5cGUnLCAnaGlkZGVuJyk7XG4gICAgICAgICAgICAgICAgaW5wdXQuc2V0QXR0cmlidXRlKCduYW1lJywgJ3BwY3AtcmVzdW1lLW9yZGVyJyk7XG4gICAgICAgICAgICAgICAgaW5wdXQuc2V0QXR0cmlidXRlKCd2YWx1ZScsIGRhdGEuZGF0YS5wdXJjaGFzZV91bml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Ehvc3RlZEZpZWxkc0luc3RhbmNlID0gbnVsbDtcbiAgICB9XG5cbiAgICByZW5kZXIod3JhcHBlciwgY29udGV4dENvbmZpZykge1xuXG4gICAgICAgIGlmIChcbiAgICAgICAgICAgIChcbiAgICAgICAgICAgICAgICB0aGlzLmRlZmF1bHRDb25maWcuY29udGV4dCAhPT0gJ2NoZWNrb3V0J1xuICAgICAgICAgICAgICAgICYmIHRoaXMuZGVmYXVsdENvbmZpZy5jb250ZXh0ICE9PSAncGF5LW5vdydcbiAgICAgICAgICAgIClcbiAgICAgICAgICAgIHx8IHdyYXBwZXIgPT09IG51bGxcbiAgICAgICAgICAgIHx8IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3Iod3JhcHBlcikgPT09IG51bGxcbiAgICAgICAgKSB7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cbiAgICAgICAgaWYgKFxuICAgICAgICAgICAgdHlwZW9mIHBheXBhbC5Ib3N0ZWRGaWVsZHMgPT09ICd1bmRlZmluZWQnXG4gICAgICAgICAgICB8fCAhIHBheXBhbC5Ib3N0ZWRGaWVsZHMuaXNFbGlnaWJsZSgpXG4gICAgICAgICkge1xuICAgICAgICAgICAgY29uc3Qgd3JhcHBlckVsZW1lbnQgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKHdyYXBwZXIpO1xuICAgICAgICAgICAgd3JhcHBlckVsZW1lbnQucGFyZW50Tm9kZS5yZW1vdmVDaGlsZCh3cmFwcGVyRWxlbWVudCk7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICBjb25zdCBidXR0b25TZWxlY3RvciA9IHdyYXBwZXIgKyAnIGJ1dHRvbic7XG5cbiAgICAgICAgaWYgKHRoaXMuY3VycmVudEhvc3RlZEZpZWxkc0luc3RhbmNlKSB7XG4gICAgICAgICAgICB0aGlzLmN1cnJlbnRIb3N0ZWRGaWVsZHNJbnN0YW5jZS50ZWFyZG93bigpXG4gICAgICAgICAgICA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gICAgICAgICAgc2VsZWN0b3I6ICcjcHBjcC1jcmVkaXQtY2FyZC1nYXRld2F5LWNhcmQtY3ZjJyxcbiAgICAgICAgICAgICAgICAgICAgcGxhY2Vob2xkZXI6IHRoaXMuZGVmYXVsdENvbmZpZy5ob3N0ZWRfZmllbGRzLmxhYmVscy5jdnYsXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBleHBpcmF0aW9uRGF0ZToge1xuICAgICAgICAgICAgICAgICAgICBzZWxlY3RvcjogJyNwcGNwLWNyZWRpdC1jYXJkLWdhdGV3YXktY2FyZC1leHBpcnknLFxuICAgICAgICAgICAgICAgICAgICBwbGFjZWhvbGRlcjogdGhpcy5kZWZhdWx0Q29uZmlnLmhvc3RlZF9maWVsZHMubGFiZWxzLm1tX3l5LFxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSkudGhlbihob3N0ZWRGaWVsZHMgPT4ge1xuICAgICAgICAgICAgZG9jdW1lbnQuZGlzcGF0Y2hFdmVudChuZXcgQ3VzdG9tRXZlbnQoXCJob3N0ZWRfZmllbGRzX2xvYWRlZFwiKSk7XG4gICAgICAgICAgICB0aGlzLmN1cnJlbnRIb3N0ZWRGaWVsZHNJbnN0YW5jZSA9IGhvc3RlZEZpZWxkcztcblxuICAgICAgICAgICAgaG9zdGVkRmllbGRzLm9uKCdpbnB1dFN1Ym1pdFJlcXVlc3QnLCAoKSA9PiB7XG4gICAgICAgICAgICAgICAgdGhpcy5fc3VibWl0KGNvbnRleHRDb25maWcpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBob3N0ZWRGaWVsZHMub24oJ2NhcmRUeXBlQ2hhbmdlJywgKGV2ZW50KSA9PiB7XG4gICAgICAgICAgICAgICAgaWYgKCAhIGV2ZW50LmNhcmRzLmxlbmd0aCApIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jYXJkVmFsaWQgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBjb25zdCB2YWxpZENhcmRzID0gdGhpcy5kZWZhdWx0Q29uZmlnLmhvc3RlZF9maWVsZHMudmFsaWRfY2FyZHM7XG4gICAgICAgICAgICAgICAgdGhpcy5jYXJkVmFsaWQgPSB2YWxpZENhcmRzLmluZGV4T2YoZXZlbnQuY2FyZHNbMF0udHlwZSkgIT09IC0xO1xuICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIGhvc3RlZEZpZWxkcy5vbigndmFsaWRpdHlDaGFuZ2UnLCAoZXZlbnQpID0+IHtcbiAgICAgICAgICAgICAgICBjb25zdCBmb3JtVmFsaWQgPSBPYmplY3Qua2V5cyhldmVudC5maWVsZHMpLmV2ZXJ5KGZ1bmN0aW9uIChrZXkpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGV2ZW50LmZpZWxkc1trZXldLmlzVmFsaWQ7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICB0aGlzLmZvcm1WYWxpZCA9IGZvcm1WYWxpZDtcblxuICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgIHNob3coYnV0dG9uU2VsZWN0b3IpO1xuXG4gICAgICAgICAgICBpZiAoZG9jdW1lbnQucXVlcnlTZWxlY3Rvcih3cmFwcGVyKS5nZXRBdHRyaWJ1dGUoJ2RhdGEtcHBjcC1zdWJzY3JpYmVkJykgIT09IHRydWUpIHtcbiAgICAgICAgICAgICAgICBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKGJ1dHRvblNlbGVjdG9yKS5hZGRFdmVudExpc3RlbmVyKFxuICAgICAgICAgICAgICAgICAgICAnY2xpY2snLFxuICAgICAgICAgICAgICAgICAgICBldmVudCA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBldmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fc3VibWl0KGNvbnRleHRDb25maWcpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgKTtcblxuICAgICAgICAgICAgICAgIGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3Iod3JhcHBlcikuc2V0QXR0cmlidXRlKCdkYXRhLXBwY3Atc3Vic2NyaWJlZCcsIHRydWUpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcblxuICAgICAgICBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCcjcGF5bWVudF9tZXRob2RfcHBjcC1jcmVkaXQtY2FyZC1nYXRld2F5JykuYWRkRXZlbnRMaXN0ZW5lcihcbiAgICAgICAgICAgICdjbGljaycsXG4gICAgICAgICAgICAoKSA9PiB7XG4gICAgICAgICAgICAgICAgZG9jdW1lbnQucXVlcnlTZWxlY3RvcignbGFiZWxbZm9yPXBwY3AtY3JlZGl0LWNhcmQtZ2F0ZXdheS1jYXJkLW51bWJlcl0nKS5jbGljaygpO1xuICAgICAgICAgICAgfVxuICAgICAgICApXG4gICAgfVxuXG4gICAgZGlzYWJsZUZpZWxkcygpIHtcbiAgICAgICAgaWYgKHRoaXMuY3VycmVudEhvc3RlZEZpZWxkc0luc3RhbmNlKSB7XG4gICAgICAgICAgICB0aGlzLmN1cnJlbnRIb3N0ZWRGaWVsZHNJbnN0YW5jZS5zZXRBdHRyaWJ1dGUoe1xuICAgICAgICAgICAgICAgIGZpZWxkOiAnbnVtYmVyJyxcbiAgICAgICAgICAgICAgICBhdHRyaWJ1dGU6ICdkaXNhYmxlZCdcbiAgICAgICAgICAgIH0pXG4gICAgICAgICAgICB0aGlzLmN1cnJlbnRIb3N0ZWRGaWVsZHNJbnN0YW5jZS5zZXRBdHRyaWJ1dGUoe1xuICAgICAgICAgICAgICAgIGZpZWxkOiAnY3Z2JyxcbiAgICAgICAgICAgICAgICBhdHRyaWJ1dGU6ICdkaXNhYmxlZCdcbiAgICAgICAgICAgIH0pXG4gICAgICAgICAgICB0aGlzLmN1cnJlb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igoZGF0YSk9PntcbiAgICAgICAgY29uc3QgaXNWYWxpZCA9IHZhbGlkYXRlVG9rZW4oZGF0YSwgY29uZmlnLnVzZXIpO1xuICAgICAgICBpZiAoIWlzVmFsaWQpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBzdG9yZVRva2VuKGRhdGEpO1xuICAgICAgICBzY3JpcHQuc2V0QXR0cmlidXRlKCdkYXRhLWNsaWVudC10b2tlbicsIGRhdGEudG9rZW4pO1xuICAgICAgICBkb2N1bWVudC5ib2R5LmFwcGVuZChzY3JpcHQpO1xuICAgIH0pO1xufVxuXG5leHBvcnQgZGVmYXVsdCBkYXRhQ2xpZW50SWRBdHRyaWJ1dGVIYW5kbGVyO1xuIiwiY2xhc3MgTWVzc2FnZVJlbmRlcmVyIHtcblxuICAgIGNvbnN0cnVjdG9yKGNvbmZpZykge1xuICAgICAgICB0aGlzLmNvbmZpZyA9IGNvbmZpZztcbiAgICB9XG5cbiAgICByZW5kZXIoKSB7XG4gICAgICAgIGlmICghIHRoaXMuc2hvdWxkUmVuZGVyKCkpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIHBheXBhbC5NZXNzYWdlcyh7XG4gICAgICAgICAgICBhbW91bnQ6IHRoaXMuY29uZmlnLmFtb3VudCxcbiAgICAgICAgICAgIHBsYWNlbWVudDogdGhpcy5jb25maWcucGxhY2VtZW50LFxuICAgICAgICAgICAgc3R5bGU6IHRoaXMuY29uZmlnLnN0eWxlXG4gICAgICAgIH0pLnJlbmRlcih0aGlzLmNvbmZpZy53cmFwcGVyKTtcbiAgICB9XG5cbiAgICByZW5kZXJXaXRoQW1vdW50KGFtb3VudCkge1xuXG4gICAgICAgIGlmICghIHRoaXMuc2hvdWxkUmVuZGVyKCkpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIGNvbnN0IG5ld1dyYXBwZXIgPSBkb2N1bWVud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ICAgIHRoaXMuZXJyb3JIYW5kbGVyID0gZXJyb3JIYW5kbGVyO1xuICAgIH1cblxuICAgIGhhbmRsZSgpXG4gICAge1xuICAgICAgICB0aGlzLnNwaW5uZXIuYmxvY2soKTtcblxuICAgICAgICBmZXRjaCh0aGlzLmNvbmZpZy5hamF4LnZhdWx0X3BheXBhbC5lbmRwb2ludCwge1xuICAgICAgICAgICAgbWV0aG9kOiAnUE9TVCcsXG4gICAgICAgICAgICBib2R5OiBKU09OLnN0cmluZ2lmeSh7XG4gICAgICAgICAgICAgICAgbm9uY2U6IHRoaXMuY29uZmlnLmFqYXgudmF1bHRfcGF5cGFsLm5vbmNlLFxuICAgICAgICAgICAgICAgIHJldHVybl91cmw6IGxvY2F0aW9uLmhyZWZcbiAgICAgICAgICAgIH0pLFxuICAgICAgICB9KS50aGVuKHJlcyA9PiB7XG4gICAgICAgICAgICByZXR1cm4gcmVzLmpzb24oKTtcbiAgICAgICAgfSkudGhlbihkYXRhID0+IHtcbiAgICAgICAgICAgIGlmICghZGF0YS5zdWNjZXNzKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5zcGlubmVyLnVuYmxvY2soKTtcbiAgICAgICAgICAgICAgICBjb25zb2xlLmVycm9yKGRhdGEpO1xuICAgICAgICAgICAgICAgIHRoaXMuZXJyb3JIYW5kbGVyLm1lc3NhZ2UoZGF0YS5kYXRhLm1lc3NhZ2UpO1xuICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGRhdGEuZGF0YS5tZXNzYWdlKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgbG9jYXRpb24uaHJlZiA9IGRhdGEuZGF0YS5hcHByb3ZlX2xpbms7XG4gICAgICAgIH0pLmNhdGNoKGVycm9yID0+IHtcbiAgICAgICAgICAgIHRoaXMuc3Bpbm5lci51bmJsb2NrKCk7XG4gICAgICAgICAgICBjb25zb2xlLmVycm9yKGVycm9yKTtcbiAgICAgICAgICAgIHRoaXMuZXJyb3JIYW5kbGVyLmdl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GFwKFxuICAgICAgICAgICAgUGF5UGFsQ29tbWVyY2VHYXRld2F5LFxuICAgICAgICAgICAgcmVuZGVyZXIsXG4gICAgICAgICAgICBtZXNzYWdlUmVuZGVyZXIsXG4gICAgICAgICk7XG5cbiAgICAgICAgc2luZ2xlUHJvZHVjdEJvb3RzdHJhcC5pbml0KCk7XG4gICAgfVxuXG4gICAgaWYgKGNvbnRleHQgPT09ICdjYXJ0Jykge1xuICAgICAgICBjb25zdCBjYXJ0Qm9vdHN0cmFwID0gbmV3IENhcnRCb290c3RyYXAoXG4gICAgICAgICAgICBQYXlQYWxDb21tZXJjZUdhdGV3YXksXG4gICAgICAgICAgICByZW5kZXJlcixcbiAgICAgICAgKTtcblxuICAgICAgICBjYXJ0Qm9vdHN0cmFwLmluaXQoKTtcbiAgICB9XG5cbiAgICBpZiAoY29udGV4dCA9PT0gJ2NoZWNrb3V0Jykge1xuICAgICAgICBjb25zdCBjaGVja291dEJvb3RzdGFwID0gbmV3IENoZWNrb3V0Qm9vdHN0YXAoXG4gICAgICAgICAgICBQYXlQYWxDb21tZXJjZUdhdGV3YXksXG4gICAgICAgICAgICByZW5kZXJlcixcbiAgICAgICAgICAgIG1lc3NhZ2VSZW5kZXJlcixcbiAgICAgICAgICAgIHNwaW5uZXJcbiAgICAgICAgKTtcblxuICAgICAgICBjaGVja291dEJvb3RzdGFwLmluaXQoKTtcbiAgICB9XG5cbiAgICBpZiAoY29udGV4dCA9PT0gJ3BheS1ub3cnICkge1xuICAgICAgICBjb25zdCBwYXlOb3dCb290c3RyYXAgPSBuZXcgUGF5Tm93Qm9vdHN0cmFwKFxuICAgICAgICAgICAgUGF5UGFsQ29tbWVyY2VHYXRld2F5LFxuICAgICAgICAgICAgcmVuZGVyZXIsXG4gICAgICAgICAgICBtZXNzYWdlUmVuZGVyZXIsXG4gICAgICAgICAgICBzcGlubmVyXG4gICAgICAgICk7XG4gICAgICAgIHBheU5vd0Jvb3RzdHJhcC5pbml0KCk7XG4gICAgfVx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Qm9vdHN0cmFwIiwic2luZ2xlX3Byb2R1Y3RfYnV0dG9uc19lbmFibGVkIiwic2luZ2xlUHJvZHVjdEJvb3RzdHJhcCIsImNhcnRCb290c3RyYXAiLCJjaGVja291dEJvb3RzdGFwIiwicGF5Tm93Qm9vdHN0cmFwIiwiZGF0YV9jbGllbnRfaWQiLCJoYXNfc3Vic2NyaXB0aW9ucyIsImhpZGVPcmRlckJ1dHRvbklmUHBjcEdhdGV3YXkiLCJpbmNsdWRlcyIsImlzQ2FyZHMiLCJib290c3RyYXBwZWQiLCJ1cmwiLCJlbnRyaWVzIiwic2NyaXB0X2F0dHJpYnV0ZXMiLCJrZXlWYWx1ZSIsInNldF9hdHRyaWJ1dGUiXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///536\n")}},__webpack_exports__={};__webpack_modules__[536]()})();
modules/ppcp-button/resources/js/button.js CHANGED
@@ -16,15 +16,35 @@ import {
16
  } from "./modules/Helper/CheckoutMethodState";
17
  import {hide, setVisible} from "./modules/Helper/Hiding";
18
  import {isChangePaymentPage} from "./modules/Helper/Subscriptions";
 
19
 
20
  const buttonsSpinner = new Spinner('.ppc-button-wrapper');
 
21
 
22
  const bootstrap = () => {
23
  const errorHandler = new ErrorHandler(PayPalCommerceGateway.labels.error.generic);
24
  const spinner = new Spinner();
25
  const creditCardRenderer = new CreditCardRenderer(PayPalCommerceGateway, errorHandler, spinner);
26
- const onSmartButtonClick = data => {
 
 
 
27
  window.ppcpFundingSource = data.fundingSource;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  };
29
  const onSmartButtonsInit = () => {
30
  buttonsSpinner.unblock();
@@ -112,14 +132,16 @@ document.addEventListener(
112
  if (
113
  !['checkout', 'pay-now'].includes(PayPalCommerceGateway.context)
114
  || isChangePaymentPage()
 
115
  ) {
116
  return;
117
  }
118
 
119
  const currentPaymentMethod = getCurrentPaymentMethod();
120
  const isPaypal = currentPaymentMethod === PaymentMethods.PAYPAL;
 
121
 
122
- setVisible(ORDER_BUTTON_SELECTOR, !isPaypal, true);
123
 
124
  if (isPaypal) {
125
  // stopped after the first rendering of the buttons, in onInit
@@ -127,8 +149,18 @@ document.addEventListener(
127
  } else {
128
  buttonsSpinner.unblock();
129
  }
 
 
 
 
 
 
130
  }
131
 
 
 
 
 
132
  let bootstrapped = false;
133
 
134
  hideOrderButtonIfPpcpGateway();
16
  } from "./modules/Helper/CheckoutMethodState";
17
  import {hide, setVisible} from "./modules/Helper/Hiding";
18
  import {isChangePaymentPage} from "./modules/Helper/Subscriptions";
19
+ import FreeTrialHandler from "./modules/ActionHandler/FreeTrialHandler";
20
 
21
  const buttonsSpinner = new Spinner('.ppc-button-wrapper');
22
+ const cardsSpinner = new Spinner('#ppcp-hosted-fields');
23
 
24
  const bootstrap = () => {
25
  const errorHandler = new ErrorHandler(PayPalCommerceGateway.labels.error.generic);
26
  const spinner = new Spinner();
27
  const creditCardRenderer = new CreditCardRenderer(PayPalCommerceGateway, errorHandler, spinner);
28
+
29
+ const freeTrialHandler = new FreeTrialHandler(PayPalCommerceGateway, spinner, errorHandler);
30
+
31
+ const onSmartButtonClick = (data, actions) => {
32
  window.ppcpFundingSource = data.fundingSource;
33
+
34
+ const form = document.querySelector('form.woocommerce-checkout');
35
+ if (form) {
36
+ jQuery('#ppcp-funding-source-form-input').remove();
37
+ form.insertAdjacentHTML(
38
+ 'beforeend',
39
+ `<input type="hidden" name="ppcp-funding-source" value="${data.fundingSource}" id="ppcp-funding-source-form-input">`
40
+ )
41
+ }
42
+
43
+ const isFreeTrial = PayPalCommerceGateway.is_free_trial_cart;
44
+ if (isFreeTrial && data.fundingSource !== 'card') {
45
+ freeTrialHandler.handle();
46
+ return actions.reject();
47
+ }
48
  };
49
  const onSmartButtonsInit = () => {
50
  buttonsSpinner.unblock();
132
  if (
133
  !['checkout', 'pay-now'].includes(PayPalCommerceGateway.context)
134
  || isChangePaymentPage()
135
+ || (PayPalCommerceGateway.is_free_trial_cart && PayPalCommerceGateway.vaulted_paypal_email !== '')
136
  ) {
137
  return;
138
  }
139
 
140
  const currentPaymentMethod = getCurrentPaymentMethod();
141
  const isPaypal = currentPaymentMethod === PaymentMethods.PAYPAL;
142
+ const isCards = currentPaymentMethod === PaymentMethods.CARDS;
143
 
144
+ setVisible(ORDER_BUTTON_SELECTOR, !isPaypal && !isCards, true);
145
 
146
  if (isPaypal) {
147
  // stopped after the first rendering of the buttons, in onInit
149
  } else {
150
  buttonsSpinner.unblock();
151
  }
152
+
153
+ if (isCards) {
154
+ cardsSpinner.block();
155
+ } else {
156
+ cardsSpinner.unblock();
157
+ }
158
  }
159
 
160
+ jQuery(document).on('hosted_fields_loaded', () => {
161
+ cardsSpinner.unblock();
162
+ });
163
+
164
  let bootstrapped = false;
165
 
166
  hideOrderButtonIfPpcpGateway();
modules/ppcp-button/resources/js/modules/ActionHandler/CartActionHandler.js CHANGED
@@ -1,5 +1,6 @@
1
  import onApprove from '../OnApproveHandler/onApproveForContinue.js';
2
  import {payerData} from "../Helper/PayerData";
 
3
 
4
  class CartActionHandler {
5
 
@@ -18,6 +19,8 @@ class CartActionHandler {
18
  body: JSON.stringify({
19
  nonce: this.config.ajax.create_order.nonce,
20
  purchase_units: [],
 
 
21
  bn_code:bnCode,
22
  payer,
23
  context:this.config.context
1
  import onApprove from '../OnApproveHandler/onApproveForContinue.js';
2
  import {payerData} from "../Helper/PayerData";
3
+ import {PaymentMethods} from "../Helper/CheckoutMethodState";
4
 
5
  class CartActionHandler {
6
 
19
  body: JSON.stringify({
20
  nonce: this.config.ajax.create_order.nonce,
21
  purchase_units: [],
22
+ payment_method: PaymentMethods.PAYPAL,
23
+ funding_source: window.ppcpFundingSource,
24
  bn_code:bnCode,
25
  payer,
26
  context:this.config.context
modules/ppcp-button/resources/js/modules/ActionHandler/CheckoutActionHandler.js CHANGED
@@ -1,5 +1,6 @@
1
  import onApprove from '../OnApproveHandler/onApproveForPayNow.js';
2
  import {payerData} from "../Helper/PayerData";
 
3
 
4
  class CheckoutActionHandler {
5
 
@@ -31,6 +32,8 @@ class CheckoutActionHandler {
31
  bn_code:bnCode,
32
  context:this.config.context,
33
  order_id:this.config.order_id,
 
 
34
  form:formValues,
35
  createaccount: createaccount
36
  })
1
  import onApprove from '../OnApproveHandler/onApproveForPayNow.js';
2
  import {payerData} from "../Helper/PayerData";
3
+ import {getCurrentPaymentMethod} from "../Helper/CheckoutMethodState";
4
 
5
  class CheckoutActionHandler {
6
 
32
  bn_code:bnCode,
33
  context:this.config.context,
34
  order_id:this.config.order_id,
35
+ payment_method: getCurrentPaymentMethod(),
36
+ funding_source: window.ppcpFundingSource,
37
  form:formValues,
38
  createaccount: createaccount
39
  })
modules/ppcp-button/resources/js/modules/ActionHandler/FreeTrialHandler.js ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {PaymentMethods} from "../Helper/CheckoutMethodState";
2
+ import errorHandler from "../ErrorHandler";
3
+
4
+ class FreeTrialHandler {
5
+ constructor(
6
+ config,
7
+ spinner,
8
+ errorHandler
9
+ ) {
10
+ this.config = config;
11
+ this.spinner = spinner;
12
+ this.errorHandler = errorHandler;
13
+ }
14
+
15
+ handle()
16
+ {
17
+ this.spinner.block();
18
+
19
+ fetch(this.config.ajax.vault_paypal.endpoint, {
20
+ method: 'POST',
21
+ body: JSON.stringify({
22
+ nonce: this.config.ajax.vault_paypal.nonce,
23
+ return_url: location.href
24
+ }),
25
+ }).then(res => {
26
+ return res.json();
27
+ }).then(data => {
28
+ if (!data.success) {
29
+ this.spinner.unblock();
30
+ console.error(data);
31
+ this.errorHandler.message(data.data.message);
32
+ throw Error(data.data.message);
33
+ }
34
+
35
+ location.href = data.data.approve_link;
36
+ }).catch(error => {
37
+ this.spinner.unblock();
38
+ console.error(error);
39
+ this.errorHandler.genericError();
40
+ });
41
+ }
42
+ }
43
+ export default FreeTrialHandler;
modules/ppcp-button/resources/js/modules/ActionHandler/SingleProductActionHandler.js CHANGED
@@ -2,6 +2,7 @@ import ButtonsToggleListener from '../Helper/ButtonsToggleListener';
2
  import Product from '../Entity/Product';
3
  import onApprove from '../OnApproveHandler/onApproveForContinue';
4
  import {payerData} from "../Helper/PayerData";
 
5
 
6
  class SingleProductActionHandler {
7
 
@@ -84,6 +85,8 @@ class SingleProductActionHandler {
84
  purchase_units,
85
  payer,
86
  bn_code:bnCode,
 
 
87
  context:this.config.context
88
  })
89
  }).then(function (res) {
2
  import Product from '../Entity/Product';
3
  import onApprove from '../OnApproveHandler/onApproveForContinue';
4
  import {payerData} from "../Helper/PayerData";
5
+ import {PaymentMethods} from "../Helper/CheckoutMethodState";
6
 
7
  class SingleProductActionHandler {
8
 
85
  purchase_units,
86
  payer,
87
  bn_code:bnCode,
88
+ payment_method: PaymentMethods.PAYPAL,
89
+ funding_source: window.ppcpFundingSource,
90
  context:this.config.context
91
  })
92
  }).then(function (res) {
modules/ppcp-button/resources/js/modules/ContextBootstrap/CheckoutBootstap.js CHANGED
@@ -86,13 +86,16 @@ class CheckoutBootstap {
86
  const isCard = currentPaymentMethod === PaymentMethods.CARDS;
87
  const isSavedCard = isCard && isSavedCardSelected();
88
  const isNotOurGateway = !isPaypal && !isCard;
 
 
89
 
90
- setVisible(this.standardOrderButtonSelector, isNotOurGateway || isSavedCard, true);
91
- setVisible(this.gateway.button.wrapper, isPaypal);
92
- setVisible(this.gateway.messages.wrapper, isPaypal);
 
93
  setVisible(this.gateway.hosted_fields.wrapper, isCard && !isSavedCard);
94
 
95
- if (isPaypal) {
96
  this.messages.render();
97
  }
98
 
86
  const isCard = currentPaymentMethod === PaymentMethods.CARDS;
87
  const isSavedCard = isCard && isSavedCardSelected();
88
  const isNotOurGateway = !isPaypal && !isCard;
89
+ const isFreeTrial = PayPalCommerceGateway.is_free_trial_cart;
90
+ const hasVaultedPaypal = PayPalCommerceGateway.vaulted_paypal_email !== '';
91
 
92
+ setVisible(this.standardOrderButtonSelector, (isPaypal && isFreeTrial && hasVaultedPaypal) || isNotOurGateway || isSavedCard, true);
93
+ setVisible('.ppcp-vaulted-paypal-details', isPaypal);
94
+ setVisible(this.gateway.button.wrapper, isPaypal && !(isFreeTrial && hasVaultedPaypal));
95
+ setVisible(this.gateway.messages.wrapper, isPaypal && !isFreeTrial);
96
  setVisible(this.gateway.hosted_fields.wrapper, isCard && !isSavedCard);
97
 
98
+ if (isPaypal && !isFreeTrial) {
99
  this.messages.render();
100
  }
101
 
modules/ppcp-button/resources/js/modules/Renderer/CreditCardRenderer.js CHANGED
@@ -1,4 +1,5 @@
1
  import dccInputFactory from "../Helper/DccInputFactory";
 
2
 
3
  class CreditCardRenderer {
4
 
@@ -32,6 +33,8 @@ class CreditCardRenderer {
32
  return;
33
  }
34
 
 
 
35
  if (this.currentHostedFieldsInstance) {
36
  this.currentHostedFieldsInstance.teardown()
37
  .catch(err => console.error(`Hosted fields teardown error: ${err}`));
@@ -121,8 +124,10 @@ class CreditCardRenderer {
121
 
122
  });
123
 
 
 
124
  if (document.querySelector(wrapper).getAttribute('data-ppcp-subscribed') !== true) {
125
- document.querySelector(wrapper + ' button').addEventListener(
126
  'click',
127
  event => {
128
  event.preventDefault();
1
  import dccInputFactory from "../Helper/DccInputFactory";
2
+ import {show} from "../Helper/Hiding";
3
 
4
  class CreditCardRenderer {
5
 
33
  return;
34
  }
35
 
36
+ const buttonSelector = wrapper + ' button';
37
+
38
  if (this.currentHostedFieldsInstance) {
39
  this.currentHostedFieldsInstance.teardown()
40
  .catch(err => console.error(`Hosted fields teardown error: ${err}`));
124
 
125
  });
126
 
127
+ show(buttonSelector);
128
+
129
  if (document.querySelector(wrapper).getAttribute('data-ppcp-subscribed') !== true) {
130
+ document.querySelector(buttonSelector).addEventListener(
131
  'click',
132
  event => {
133
  event.preventDefault();
modules/ppcp-button/services.php CHANGED
@@ -18,6 +18,7 @@ use WooCommerce\PayPalCommerce\Button\Endpoint\ChangeCartEndpoint;
18
  use WooCommerce\PayPalCommerce\Button\Endpoint\CreateOrderEndpoint;
19
  use WooCommerce\PayPalCommerce\Button\Endpoint\DataClientIdEndpoint;
20
  use WooCommerce\PayPalCommerce\Button\Endpoint\RequestData;
 
21
  use WooCommerce\PayPalCommerce\Button\Exception\RuntimeException;
22
  use WooCommerce\PayPalCommerce\Button\Helper\EarlyOrderHandler;
23
  use WooCommerce\PayPalCommerce\Button\Helper\MessagesApply;
@@ -85,7 +86,9 @@ return array(
85
  $environment,
86
  $payment_token_repository,
87
  $settings_status,
88
- $currency
 
 
89
  );
90
  },
91
  'button.url' => static function ( ContainerInterface $container ): string {
@@ -169,6 +172,13 @@ return array(
169
  $logger
170
  );
171
  },
 
 
 
 
 
 
 
172
  'button.helper.three-d-secure' => static function ( ContainerInterface $container ): ThreeDSecure {
173
  $logger = $container->get( 'woocommerce.logger.woocommerce' );
174
  return new ThreeDSecure( $logger );
18
  use WooCommerce\PayPalCommerce\Button\Endpoint\CreateOrderEndpoint;
19
  use WooCommerce\PayPalCommerce\Button\Endpoint\DataClientIdEndpoint;
20
  use WooCommerce\PayPalCommerce\Button\Endpoint\RequestData;
21
+ use WooCommerce\PayPalCommerce\Button\Endpoint\StartPayPalVaultingEndpoint;
22
  use WooCommerce\PayPalCommerce\Button\Exception\RuntimeException;
23
  use WooCommerce\PayPalCommerce\Button\Helper\EarlyOrderHandler;
24
  use WooCommerce\PayPalCommerce\Button\Helper\MessagesApply;
86
  $environment,
87
  $payment_token_repository,
88
  $settings_status,
89
+ $currency,
90
+ $container->get( 'wcgateway.all-funding-sources' ),
91
+ $container->get( 'woocommerce.logger.woocommerce' )
92
  );
93
  },
94
  'button.url' => static function ( ContainerInterface $container ): string {
172
  $logger
173
  );
174
  },
175
+ 'button.endpoint.vault-paypal' => static function( ContainerInterface $container ) : StartPayPalVaultingEndpoint {
176
+ return new StartPayPalVaultingEndpoint(
177
+ $container->get( 'button.request-data' ),
178
+ $container->get( 'api.endpoint.payment-token' ),
179
+ $container->get( 'woocommerce.logger.woocommerce' )
180
+ );
181
+ },
182
  'button.helper.three-d-secure' => static function ( ContainerInterface $container ): ThreeDSecure {
183
  $logger = $container->get( 'woocommerce.logger.woocommerce' );
184
  return new ThreeDSecure( $logger );
modules/ppcp-button/src/Assets/SmartButton.php CHANGED
@@ -9,6 +9,9 @@ declare(strict_types=1);
9
 
10
  namespace WooCommerce\PayPalCommerce\Button\Assets;
11
 
 
 
 
12
  use WooCommerce\PayPalCommerce\ApiClient\Factory\PayerFactory;
13
  use WooCommerce\PayPalCommerce\ApiClient\Helper\DccApplies;
14
  use WooCommerce\PayPalCommerce\Button\Endpoint\ApproveOrderEndpoint;
@@ -16,9 +19,11 @@ use WooCommerce\PayPalCommerce\Button\Endpoint\ChangeCartEndpoint;
16
  use WooCommerce\PayPalCommerce\Button\Endpoint\CreateOrderEndpoint;
17
  use WooCommerce\PayPalCommerce\Button\Endpoint\DataClientIdEndpoint;
18
  use WooCommerce\PayPalCommerce\Button\Endpoint\RequestData;
 
19
  use WooCommerce\PayPalCommerce\Button\Helper\MessagesApply;
20
  use WooCommerce\PayPalCommerce\Onboarding\Environment;
21
  use WooCommerce\PayPalCommerce\Session\SessionHandler;
 
22
  use WooCommerce\PayPalCommerce\Subscription\Helper\SubscriptionHelper;
23
  use WooCommerce\PayPalCommerce\Vaulting\PaymentTokenRepository;
24
  use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
@@ -30,6 +35,8 @@ use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
30
  */
31
  class SmartButton implements SmartButtonInterface {
32
 
 
 
33
  /**
34
  * The Settings status helper.
35
  *
@@ -128,6 +135,27 @@ class SmartButton implements SmartButtonInterface {
128
  */
129
  private $currency;
130
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  /**
132
  * SmartButton constructor.
133
  *
@@ -145,6 +173,8 @@ class SmartButton implements SmartButtonInterface {
145
  * @param PaymentTokenRepository $payment_token_repository The payment token repository.
146
  * @param SettingsStatus $settings_status The Settings status helper.
147
  * @param string $currency 3-letter currency code of the shop.
 
 
148
  */
149
  public function __construct(
150
  string $module_url,
@@ -160,7 +190,9 @@ class SmartButton implements SmartButtonInterface {
160
  Environment $environment,
161
  PaymentTokenRepository $payment_token_repository,
162
  SettingsStatus $settings_status,
163
- string $currency
 
 
164
  ) {
165
 
166
  $this->module_url = $module_url;
@@ -177,6 +209,8 @@ class SmartButton implements SmartButtonInterface {
177
  $this->payment_token_repository = $payment_token_repository;
178
  $this->settings_status = $settings_status;
179
  $this->currency = $currency;
 
 
180
  }
181
 
182
  /**
@@ -262,6 +296,38 @@ class SmartButton implements SmartButtonInterface {
262
  2
263
  );
264
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
265
  return true;
266
  }
267
 
@@ -341,6 +407,9 @@ class SmartButton implements SmartButtonInterface {
341
  if (
342
  ( is_product() || wc_post_content_has_shortcode( 'product_page' ) )
343
  && ! $not_enabled_on_product_page
 
 
 
344
  ) {
345
  add_action(
346
  $this->single_product_renderer_hook(),
@@ -358,11 +427,12 @@ class SmartButton implements SmartButtonInterface {
358
  ! $this->settings->get( 'button_mini_cart_enabled' );
359
  if (
360
  ! $not_enabled_on_minicart
 
361
  ) {
362
  add_action(
363
  $this->mini_cart_button_renderer_hook(),
364
  function () {
365
- if ( $this->is_cart_price_total_zero() ) {
366
  return;
367
  }
368
 
@@ -375,7 +445,7 @@ class SmartButton implements SmartButtonInterface {
375
  );
376
  }
377
 
378
- if ( $this->is_cart_price_total_zero() ) {
379
  return false;
380
  }
381
 
@@ -384,6 +454,7 @@ class SmartButton implements SmartButtonInterface {
384
  if (
385
  is_cart()
386
  && ! $not_enabled_on_cart
 
387
  ) {
388
  add_action(
389
  $this->proceed_to_checkout_button_renderer_hook(),
@@ -601,8 +672,10 @@ class SmartButton implements SmartButtonInterface {
601
 
602
  printf(
603
  '<div id="%1$s" style="display:none;">
604
- <button type="submit" class="button alt ppcp-dcc-order-button">%2$s</button>
605
- </div><div id="payments-sdk__contingency-lightbox"></div><style id="ppcp-hide-dcc">.payment_method_ppcp-credit-card-gateway {display:none;}</style>',
 
 
606
  esc_attr( $id ),
607
  esc_html( $label )
608
  );
@@ -671,6 +744,8 @@ class SmartButton implements SmartButtonInterface {
671
  private function localize_script(): array {
672
  global $wp;
673
 
 
 
674
  $this->request_data->enqueue_nonce_fix();
675
  $localize = array(
676
  'script_attributes' => $this->attributes(),
@@ -696,9 +771,15 @@ class SmartButton implements SmartButtonInterface {
696
  'endpoint' => \WC_AJAX::get_endpoint( ApproveOrderEndpoint::ENDPOINT ),
697
  'nonce' => wp_create_nonce( ApproveOrderEndpoint::nonce() ),
698
  ),
 
 
 
 
699
  ),
700
  'enforce_vault' => $this->has_subscriptions(),
701
  'can_save_vault_token' => $this->can_save_vault_token(),
 
 
702
  'bn_codes' => $this->bn_codes(),
703
  'payer' => $this->payerData(),
704
  'button' => array(
@@ -817,13 +898,24 @@ class SmartButton implements SmartButtonInterface {
817
  if ( ! is_checkout() ) {
818
  $disable_funding[] = 'card';
819
  }
820
- if ( is_checkout() && $this->settings->has( 'dcc_enabled' ) && $this->settings->get( 'dcc_enabled' ) ) {
 
 
 
821
  $key = array_search( 'card', $disable_funding, true );
822
  if ( false !== $key ) {
823
  unset( $disable_funding[ $key ] );
824
  }
825
  }
826
 
 
 
 
 
 
 
 
 
827
  if ( count( $disable_funding ) > 0 ) {
828
  $params['disable-funding'] = implode( ',', array_unique( $disable_funding ) );
829
  }
@@ -832,6 +924,11 @@ class SmartButton implements SmartButtonInterface {
832
  if ( $this->settings_status->pay_later_messaging_is_enabled() || ! in_array( 'credit', $disable_funding, true ) ) {
833
  $enable_funding[] = 'paylater';
834
  }
 
 
 
 
 
835
  if ( count( $enable_funding ) > 0 ) {
836
  $params['enable-funding'] = implode( ',', array_unique( $enable_funding ) );
837
  }
@@ -890,7 +987,10 @@ class SmartButton implements SmartButtonInterface {
890
  if ( $this->load_button_component() ) {
891
  $components[] = 'buttons';
892
  }
893
- if ( $this->messages_apply->for_country() ) {
 
 
 
894
  $components[] = 'messages';
895
  }
896
  if ( $this->dcc_is_enabled() ) {
@@ -1126,4 +1226,37 @@ class SmartButton implements SmartButtonInterface {
1126
  // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
1127
  return WC()->cart->get_cart_contents_total() == 0;
1128
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1129
  }
9
 
10
  namespace WooCommerce\PayPalCommerce\Button\Assets;
11
 
12
+ use Exception;
13
+ use Psr\Log\LoggerInterface;
14
+ use WooCommerce\PayPalCommerce\ApiClient\Entity\PaymentToken;
15
  use WooCommerce\PayPalCommerce\ApiClient\Factory\PayerFactory;
16
  use WooCommerce\PayPalCommerce\ApiClient\Helper\DccApplies;
17
  use WooCommerce\PayPalCommerce\Button\Endpoint\ApproveOrderEndpoint;
19
  use WooCommerce\PayPalCommerce\Button\Endpoint\CreateOrderEndpoint;
20
  use WooCommerce\PayPalCommerce\Button\Endpoint\DataClientIdEndpoint;
21
  use WooCommerce\PayPalCommerce\Button\Endpoint\RequestData;
22
+ use WooCommerce\PayPalCommerce\Button\Endpoint\StartPayPalVaultingEndpoint;
23
  use WooCommerce\PayPalCommerce\Button\Helper\MessagesApply;
24
  use WooCommerce\PayPalCommerce\Onboarding\Environment;
25
  use WooCommerce\PayPalCommerce\Session\SessionHandler;
26
+ use WooCommerce\PayPalCommerce\Subscription\FreeTrialHandlerTrait;
27
  use WooCommerce\PayPalCommerce\Subscription\Helper\SubscriptionHelper;
28
  use WooCommerce\PayPalCommerce\Vaulting\PaymentTokenRepository;
29
  use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
35
  */
36
  class SmartButton implements SmartButtonInterface {
37
 
38
+ use FreeTrialHandlerTrait;
39
+
40
  /**
41
  * The Settings status helper.
42
  *
135
  */
136
  private $currency;
137
 
138
+ /**
139
+ * All existing funding sources.
140
+ *
141
+ * @var array
142
+ */
143
+ private $all_funding_sources;
144
+
145
+ /**
146
+ * The logger.
147
+ *
148
+ * @var LoggerInterface
149
+ */
150
+ private $logger;
151
+
152
+ /**
153
+ * Cached payment tokens.
154
+ *
155
+ * @var PaymentToken[]|null
156
+ */
157
+ private $payment_tokens = null;
158
+
159
  /**
160
  * SmartButton constructor.
161
  *
173
  * @param PaymentTokenRepository $payment_token_repository The payment token repository.
174
  * @param SettingsStatus $settings_status The Settings status helper.
175
  * @param string $currency 3-letter currency code of the shop.
176
+ * @param array $all_funding_sources All existing funding sources.
177
+ * @param LoggerInterface $logger The logger.
178
  */
179
  public function __construct(
180
  string $module_url,
190
  Environment $environment,
191
  PaymentTokenRepository $payment_token_repository,
192
  SettingsStatus $settings_status,
193
+ string $currency,
194
+ array $all_funding_sources,
195
+ LoggerInterface $logger
196
  ) {
197
 
198
  $this->module_url = $module_url;
209
  $this->payment_token_repository = $payment_token_repository;
210
  $this->settings_status = $settings_status;
211
  $this->currency = $currency;
212
+ $this->all_funding_sources = $all_funding_sources;
213
+ $this->logger = $logger;
214
  }
215
 
216
  /**
296
  2
297
  );
298
  }
299
+
300
+ if ( $this->is_free_trial_cart() ) {
301
+ add_action(
302
+ 'woocommerce_review_order_after_submit',
303
+ function () {
304
+ $vaulted_email = $this->get_vaulted_paypal_email();
305
+ if ( ! $vaulted_email ) {
306
+ return;
307
+ }
308
+
309
+ ?>
310
+ <div class="ppcp-vaulted-paypal-details">
311
+ <?php
312
+ echo wp_kses_post(
313
+ sprintf(
314
+ // translators: %1$s - email, %2$s, %3$s - HTML tags for a link.
315
+ esc_html__(
316
+ 'Using %2$s%1$s%3$s PayPal.',
317
+ 'woocommerce-paypal-payments'
318
+ ),
319
+ $vaulted_email,
320
+ '<b>',
321
+ '</b>'
322
+ )
323
+ );
324
+ ?>
325
+ </div>
326
+ <?php
327
+ }
328
+ );
329
+ }
330
+
331
  return true;
332
  }
333
 
407
  if (
408
  ( is_product() || wc_post_content_has_shortcode( 'product_page' ) )
409
  && ! $not_enabled_on_product_page
410
+ // TODO: it seems like there is no easy way to properly handle vaulted PayPal free trial,
411
+ // so disable the buttons for now everywhere except checkout for free trial.
412
+ && ! $this->is_free_trial_product()
413
  ) {
414
  add_action(
415
  $this->single_product_renderer_hook(),
427
  ! $this->settings->get( 'button_mini_cart_enabled' );
428
  if (
429
  ! $not_enabled_on_minicart
430
+ && ! $this->is_free_trial_cart()
431
  ) {
432
  add_action(
433
  $this->mini_cart_button_renderer_hook(),
434
  function () {
435
+ if ( $this->is_cart_price_total_zero() || $this->is_free_trial_cart() ) {
436
  return;
437
  }
438
 
445
  );
446
  }
447
 
448
+ if ( $this->is_cart_price_total_zero() && ! $this->is_free_trial_cart() ) {
449
  return false;
450
  }
451
 
454
  if (
455
  is_cart()
456
  && ! $not_enabled_on_cart
457
+ && ! $this->is_free_trial_cart()
458
  ) {
459
  add_action(
460
  $this->proceed_to_checkout_button_renderer_hook(),
672
 
673
  printf(
674
  '<div id="%1$s" style="display:none;">
675
+ <button type="submit" class="button alt ppcp-dcc-order-button" style="display: none;">%2$s</button>
676
+ </div>
677
+ <div id="payments-sdk__contingency-lightbox"></div>
678
+ <style id="ppcp-hide-dcc">.payment_method_ppcp-credit-card-gateway {display:none;}</style>',
679
  esc_attr( $id ),
680
  esc_html( $label )
681
  );
744
  private function localize_script(): array {
745
  global $wp;
746
 
747
+ $is_free_trial_cart = $this->is_free_trial_cart();
748
+
749
  $this->request_data->enqueue_nonce_fix();
750
  $localize = array(
751
  'script_attributes' => $this->attributes(),
771
  'endpoint' => \WC_AJAX::get_endpoint( ApproveOrderEndpoint::ENDPOINT ),
772
  'nonce' => wp_create_nonce( ApproveOrderEndpoint::nonce() ),
773
  ),
774
+ 'vault_paypal' => array(
775
+ 'endpoint' => \WC_AJAX::get_endpoint( StartPayPalVaultingEndpoint::ENDPOINT ),
776
+ 'nonce' => wp_create_nonce( StartPayPalVaultingEndpoint::nonce() ),
777
+ ),
778
  ),
779
  'enforce_vault' => $this->has_subscriptions(),
780
  'can_save_vault_token' => $this->can_save_vault_token(),
781
+ 'is_free_trial_cart' => $is_free_trial_cart,
782
+ 'vaulted_paypal_email' => ( is_checkout() && $is_free_trial_cart ) ? $this->get_vaulted_paypal_email() : '',
783
  'bn_codes' => $this->bn_codes(),
784
  'payer' => $this->payerData(),
785
  'button' => array(
898
  if ( ! is_checkout() ) {
899
  $disable_funding[] = 'card';
900
  }
901
+
902
+ $is_dcc_enabled = $this->settings->has( 'dcc_enabled' ) && $this->settings->get( 'dcc_enabled' );
903
+
904
+ if ( is_checkout() && $is_dcc_enabled ) {
905
  $key = array_search( 'card', $disable_funding, true );
906
  if ( false !== $key ) {
907
  unset( $disable_funding[ $key ] );
908
  }
909
  }
910
 
911
+ if ( $this->is_free_trial_cart() ) {
912
+ $all_sources = $this->all_funding_sources;
913
+ if ( $is_dcc_enabled ) {
914
+ $all_sources = array_keys( array_diff_key( $all_sources, array( 'card' => '' ) ) );
915
+ }
916
+ $disable_funding = $all_sources;
917
+ }
918
+
919
  if ( count( $disable_funding ) > 0 ) {
920
  $params['disable-funding'] = implode( ',', array_unique( $disable_funding ) );
921
  }
924
  if ( $this->settings_status->pay_later_messaging_is_enabled() || ! in_array( 'credit', $disable_funding, true ) ) {
925
  $enable_funding[] = 'paylater';
926
  }
927
+
928
+ if ( $this->is_free_trial_cart() ) {
929
+ $enable_funding = array();
930
+ }
931
+
932
  if ( count( $enable_funding ) > 0 ) {
933
  $params['enable-funding'] = implode( ',', array_unique( $enable_funding ) );
934
  }
987
  if ( $this->load_button_component() ) {
988
  $components[] = 'buttons';
989
  }
990
+ if (
991
+ $this->messages_apply->for_country()
992
+ && ! $this->is_free_trial_cart()
993
+ ) {
994
  $components[] = 'messages';
995
  }
996
  if ( $this->dcc_is_enabled() ) {
1226
  // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
1227
  return WC()->cart->get_cart_contents_total() == 0;
1228
  }
1229
+
1230
+ /**
1231
+ * Retrieves all payment tokens for the user, via API or cached if already queried.
1232
+ *
1233
+ * @return PaymentToken[]
1234
+ */
1235
+ private function get_payment_tokens(): array {
1236
+ if ( null === $this->payment_tokens ) {
1237
+ $this->payment_tokens = $this->payment_token_repository->all_for_user_id( get_current_user_id() );
1238
+ }
1239
+
1240
+ return $this->payment_tokens;
1241
+ }
1242
+
1243
+ /**
1244
+ * Returns the vaulted PayPal email or empty string.
1245
+ *
1246
+ * @return string
1247
+ */
1248
+ private function get_vaulted_paypal_email(): string {
1249
+ try {
1250
+ $tokens = $this->get_payment_tokens();
1251
+
1252
+ foreach ( $tokens as $token ) {
1253
+ if ( isset( $token->source()->paypal ) ) {
1254
+ return $token->source()->paypal->payer->email_address;
1255
+ }
1256
+ }
1257
+ } catch ( Exception $exception ) {
1258
+ $this->logger->error( 'Failed to get PayPal vaulted email. ' . $exception->getMessage() );
1259
+ }
1260
+ return '';
1261
+ }
1262
  }
modules/ppcp-button/src/ButtonModule.php CHANGED
@@ -16,6 +16,7 @@ use WooCommerce\PayPalCommerce\Button\Endpoint\ApproveOrderEndpoint;
16
  use WooCommerce\PayPalCommerce\Button\Endpoint\ChangeCartEndpoint;
17
  use WooCommerce\PayPalCommerce\Button\Endpoint\CreateOrderEndpoint;
18
  use WooCommerce\PayPalCommerce\Button\Endpoint\DataClientIdEndpoint;
 
19
  use WooCommerce\PayPalCommerce\Button\Helper\EarlyOrderHandler;
20
  use Interop\Container\ServiceProviderInterface;
21
  use Psr\Container\ContainerInterface;
@@ -107,6 +108,15 @@ class ButtonModule implements ModuleInterface {
107
  $endpoint->handle_request();
108
  }
109
  );
 
 
 
 
 
 
 
 
 
110
 
111
  add_action(
112
  'wc_ajax_' . ChangeCartEndpoint::ENDPOINT,
16
  use WooCommerce\PayPalCommerce\Button\Endpoint\ChangeCartEndpoint;
17
  use WooCommerce\PayPalCommerce\Button\Endpoint\CreateOrderEndpoint;
18
  use WooCommerce\PayPalCommerce\Button\Endpoint\DataClientIdEndpoint;
19
+ use WooCommerce\PayPalCommerce\Button\Endpoint\StartPayPalVaultingEndpoint;
20
  use WooCommerce\PayPalCommerce\Button\Helper\EarlyOrderHandler;
21
  use Interop\Container\ServiceProviderInterface;
22
  use Psr\Container\ContainerInterface;
108
  $endpoint->handle_request();
109
  }
110
  );
111
+ add_action(
112
+ 'wc_ajax_' . StartPayPalVaultingEndpoint::ENDPOINT,
113
+ static function () use ( $container ) {
114
+ $endpoint = $container->get( 'button.endpoint.vault-paypal' );
115
+ assert( $endpoint instanceof StartPayPalVaultingEndpoint );
116
+
117
+ $endpoint->handle_request();
118
+ }
119
+ );
120
 
121
  add_action(
122
  'wc_ajax_' . ChangeCartEndpoint::ENDPOINT,
modules/ppcp-button/src/Endpoint/CreateOrderEndpoint.php CHANGED
@@ -12,10 +12,10 @@ namespace WooCommerce\PayPalCommerce\Button\Endpoint;
12
  use Exception;
13
  use Psr\Log\LoggerInterface;
14
  use WooCommerce\PayPalCommerce\ApiClient\Endpoint\OrderEndpoint;
15
- use WooCommerce\PayPalCommerce\ApiClient\Entity\Address;
 
16
  use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
17
  use WooCommerce\PayPalCommerce\ApiClient\Entity\Payer;
18
- use WooCommerce\PayPalCommerce\ApiClient\Entity\PayerName;
19
  use WooCommerce\PayPalCommerce\ApiClient\Entity\PaymentMethod;
20
  use WooCommerce\PayPalCommerce\ApiClient\Entity\PurchaseUnit;
21
  use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException;
@@ -25,7 +25,10 @@ use WooCommerce\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
25
  use WooCommerce\PayPalCommerce\ApiClient\Repository\CartRepository;
26
  use WooCommerce\PayPalCommerce\Button\Helper\EarlyOrderHandler;
27
  use WooCommerce\PayPalCommerce\Session\SessionHandler;
 
28
  use WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException;
 
 
29
  use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
30
 
31
  /**
@@ -33,6 +36,8 @@ use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
33
  */
34
  class CreateOrderEndpoint implements EndpointInterface {
35
 
 
 
36
  const ENDPOINT = 'ppc-create-order';
37
 
38
  /**
@@ -177,6 +182,8 @@ class CreateOrderEndpoint implements EndpointInterface {
177
  try {
178
  $data = $this->request_data->read_request( $this->nonce() );
179
  $this->parsed_request_data = $data;
 
 
180
  $wc_order = null;
181
  if ( 'pay-now' === $data['context'] ) {
182
  $wc_order = wc_get_order( (int) $data['order_id'] );
@@ -193,6 +200,21 @@ class CreateOrderEndpoint implements EndpointInterface {
193
  $this->purchase_units = array( $this->purchase_unit_factory->from_wc_order( $wc_order ) );
194
  } else {
195
  $this->purchase_units = $this->cart_repository->all();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  }
197
 
198
  $this->set_bn_code( $data );
12
  use Exception;
13
  use Psr\Log\LoggerInterface;
14
  use WooCommerce\PayPalCommerce\ApiClient\Endpoint\OrderEndpoint;
15
+ use WooCommerce\PayPalCommerce\ApiClient\Entity\Amount;
16
+ use WooCommerce\PayPalCommerce\ApiClient\Entity\Money;
17
  use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
18
  use WooCommerce\PayPalCommerce\ApiClient\Entity\Payer;
 
19
  use WooCommerce\PayPalCommerce\ApiClient\Entity\PaymentMethod;
20
  use WooCommerce\PayPalCommerce\ApiClient\Entity\PurchaseUnit;
21
  use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException;
25
  use WooCommerce\PayPalCommerce\ApiClient\Repository\CartRepository;
26
  use WooCommerce\PayPalCommerce\Button\Helper\EarlyOrderHandler;
27
  use WooCommerce\PayPalCommerce\Session\SessionHandler;
28
+ use WooCommerce\PayPalCommerce\Subscription\FreeTrialHandlerTrait;
29
  use WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException;
30
+ use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
31
+ use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
32
  use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
33
 
34
  /**
36
  */
37
  class CreateOrderEndpoint implements EndpointInterface {
38
 
39
+ use FreeTrialHandlerTrait;
40
+
41
  const ENDPOINT = 'ppc-create-order';
42
 
43
  /**
182
  try {
183
  $data = $this->request_data->read_request( $this->nonce() );
184
  $this->parsed_request_data = $data;
185
+ $payment_method = $data['payment_method'] ?? '';
186
+ $funding_source = $data['funding_source'] ?? '';
187
  $wc_order = null;
188
  if ( 'pay-now' === $data['context'] ) {
189
  $wc_order = wc_get_order( (int) $data['order_id'] );
200
  $this->purchase_units = array( $this->purchase_unit_factory->from_wc_order( $wc_order ) );
201
  } else {
202
  $this->purchase_units = $this->cart_repository->all();
203
+
204
+ // The cart does not have any info about payment method, so we must handle free trial here.
205
+ if ( (
206
+ CreditCardGateway::ID === $payment_method
207
+ || ( PayPalGateway::ID === $payment_method && 'card' === $funding_source )
208
+ )
209
+ && $this->is_free_trial_cart()
210
+ ) {
211
+ $this->purchase_units[0]->set_amount(
212
+ new Amount(
213
+ new Money( 1.0, $this->purchase_units[0]->amount()->currency_code() ),
214
+ $this->purchase_units[0]->amount()->breakdown()
215
+ )
216
+ );
217
+ }
218
  }
219
 
220
  $this->set_bn_code( $data );
modules/ppcp-button/src/Endpoint/StartPayPalVaultingEndpoint.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The endpoint for starting vaulting of PayPal account (for free trial).
4
+ *
5
+ * @package WooCommerce\PayPalCommerce\Button\Endpoint
6
+ */
7
+
8
+ declare(strict_types=1);
9
+
10
+ namespace WooCommerce\PayPalCommerce\Button\Endpoint;
11
+
12
+ use Exception;
13
+ use Psr\Log\LoggerInterface;
14
+ use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PaymentTokenEndpoint;
15
+ use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException;
16
+
17
+ /**
18
+ * Class StartPayPalVaultingEndpoint.
19
+ */
20
+ class StartPayPalVaultingEndpoint implements EndpointInterface {
21
+
22
+
23
+ const ENDPOINT = 'ppc-vault-paypal';
24
+
25
+ /**
26
+ * The Request Data Helper.
27
+ *
28
+ * @var RequestData
29
+ */
30
+ private $request_data;
31
+
32
+ /**
33
+ * The PaymentTokenEndpoint.
34
+ *
35
+ * @var PaymentTokenEndpoint
36
+ */
37
+ private $payment_token_endpoint;
38
+
39
+ /**
40
+ * The logger.
41
+ *
42
+ * @var LoggerInterface
43
+ */
44
+ private $logger;
45
+
46
+ /**
47
+ * StartPayPalVaultingEndpoint constructor.
48
+ *
49
+ * @param RequestData $request_data The Request Data Helper.
50
+ * @param PaymentTokenEndpoint $payment_token_endpoint The PaymentTokenEndpoint.
51
+ * @param LoggerInterface $logger The logger.
52
+ */
53
+ public function __construct(
54
+ RequestData $request_data,
55
+ PaymentTokenEndpoint $payment_token_endpoint,
56
+ LoggerInterface $logger
57
+ ) {
58
+ $this->request_data = $request_data;
59
+ $this->payment_token_endpoint = $payment_token_endpoint;
60
+ $this->logger = $logger;
61
+ }
62
+
63
+ /**
64
+ * Returns the nonce.
65
+ *
66
+ * @return string
67
+ */
68
+ public static function nonce(): string {
69
+ return self::ENDPOINT;
70
+ }
71
+
72
+ /**
73
+ * Handles the request.
74
+ *
75
+ * @return bool
76
+ */
77
+ public function handle_request(): bool {
78
+ try {
79
+ $data = $this->request_data->read_request( $this->nonce() );
80
+
81
+ $user_id = get_current_user_id();
82
+
83
+ $return_url = $data['return_url'];
84
+ $cancel_url = add_query_arg( array( 'ppcp_vault' => 'cancel' ), $return_url );
85
+
86
+ $links = $this->payment_token_endpoint->start_paypal_token_creation(
87
+ $user_id,
88
+ $return_url,
89
+ $cancel_url
90
+ );
91
+
92
+ wp_send_json_success(
93
+ array(
94
+ 'approve_link' => $links->approve_link(),
95
+ )
96
+ );
97
+
98
+ return true;
99
+ } catch ( Exception $error ) {
100
+ $this->logger->error( 'Failed to start PayPal vaulting: ' . $error->getMessage() );
101
+
102
+ wp_send_json_error(
103
+ array(
104
+ 'name' => is_a( $error, PayPalApiException::class ) ? $error->name() : '',
105
+ 'message' => $error->getMessage(),
106
+ )
107
+ );
108
+ return false;
109
+ }
110
+ }
111
+ }
modules/ppcp-onboarding/assets/js/settings.js CHANGED
@@ -171,6 +171,16 @@ document.addEventListener(
171
  return;
172
  }
173
  const allOptions = Array.from(document.querySelectorAll('select[name="ppcp[disable_cards][]"] option'));
 
 
 
 
 
 
 
 
 
 
174
  const replace = () => {
175
  const validOptions = allOptions.filter(
176
  (option) => {
@@ -181,13 +191,35 @@ document.addEventListener(
181
  const selectedValidOptions = validOptions.map(
182
  (option) => {
183
  option = option.cloneNode(true);
184
- option.selected = target.querySelector('option[value="' + option.value + '"]') && target.querySelector('option[value="' + option.value + '"]').selected;
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  return option;
186
  }
187
  );
 
188
  target.innerHTML = '';
189
  selectedValidOptions.forEach(
190
  (option) => {
 
 
 
 
 
 
 
 
191
  target.append(option);
192
  }
193
  );
171
  return;
172
  }
173
  const allOptions = Array.from(document.querySelectorAll('select[name="ppcp[disable_cards][]"] option'));
174
+ const iconVersions = {
175
+ 'visa': {
176
+ 'light': {'label': 'Visa (light)'},
177
+ 'dark' : {'label': 'Visa (dark)', 'value': 'visa-dark'}
178
+ },
179
+ 'mastercard': {
180
+ 'light': {'label': 'Mastercard (light)'},
181
+ 'dark' : {'label': 'Mastercard (dark)', 'value': 'mastercard-dark'}
182
+ }
183
+ }
184
  const replace = () => {
185
  const validOptions = allOptions.filter(
186
  (option) => {
191
  const selectedValidOptions = validOptions.map(
192
  (option) => {
193
  option = option.cloneNode(true);
194
+ let value = option.value;
195
+ option.selected = target.querySelector('option[value="' + value + '"]') && target.querySelector('option[value="' + value + '"]').selected;
196
+ if(value === 'visa' || value === 'mastercard') {
197
+ let darkOption = option.cloneNode(true);
198
+ let currentVersion = iconVersions[value];
199
+ let darkValue = iconVersions[value].dark.value;
200
+
201
+ option.text = currentVersion.light.label;
202
+ darkOption.text = currentVersion.dark.label;
203
+ darkOption.value = darkValue;
204
+ darkOption.selected = target.querySelector('option[value="' + darkValue + '"]') && target.querySelector('option[value="' + darkValue + '"]').selected;
205
+
206
+ return [option, darkOption];
207
+ }
208
  return option;
209
  }
210
  );
211
+
212
  target.innerHTML = '';
213
  selectedValidOptions.forEach(
214
  (option) => {
215
+ if(Array.isArray(option)){
216
+ option.forEach(
217
+ (option) => {
218
+ target.append(option);
219
+ }
220
+ )
221
+ }
222
+
223
  target.append(option);
224
  }
225
  );
modules/ppcp-onboarding/src/OnboardingRESTController.php CHANGED
@@ -10,6 +10,7 @@ declare(strict_types=1);
10
  namespace WooCommerce\PayPalCommerce\Onboarding;
11
 
12
  use Psr\Container\ContainerInterface;
 
13
  use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
14
 
15
  /**
@@ -206,7 +207,7 @@ class OnboardingRESTController {
206
  }
207
 
208
  foreach ( WC()->payment_gateways->payment_gateways() as $gateway ) {
209
- if ( PayPalGateway::ID === $gateway->id ) {
210
  $gateway->update_option( 'enabled', 'yes' );
211
  break;
212
  }
10
  namespace WooCommerce\PayPalCommerce\Onboarding;
11
 
12
  use Psr\Container\ContainerInterface;
13
+ use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
14
  use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
15
 
16
  /**
207
  }
208
 
209
  foreach ( WC()->payment_gateways->payment_gateways() as $gateway ) {
210
+ if ( PayPalGateway::ID === $gateway->id || CreditCardGateway::ID === $gateway->id ) {
211
  $gateway->update_option( 'enabled', 'yes' );
212
  break;
213
  }
modules/ppcp-onboarding/src/Render/OnboardingRenderer.php CHANGED
@@ -107,9 +107,11 @@ class OnboardingRenderer {
107
  $is_production ? 'production' : 'sandbox'
108
  );
109
  } catch ( RuntimeException $exception ) {
110
- esc_html_e(
111
- 'We could not properly connect to PayPal. Please reload the page to continue',
112
- 'woocommerce-paypal-payments'
 
 
113
  );
114
  }
115
  }
107
  $is_production ? 'production' : 'sandbox'
108
  );
109
  } catch ( RuntimeException $exception ) {
110
+ echo esc_html(
111
+ __(
112
+ 'We could not properly connect to PayPal. Try reloading the page.',
113
+ 'woocommerce-paypal-payments'
114
+ ) . " {$exception->getMessage()} {$exception->getFile()}:{$exception->getLine()}"
115
  );
116
  }
117
  }
modules/ppcp-subscription/src/FreeTrialHandlerTrait.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Helper trait for the subscriptions handling.
4
+ *
5
+ * @package WooCommerce\PayPalCommerce\Subscription
6
+ */
7
+
8
+ declare(strict_types=1);
9
+
10
+ namespace WooCommerce\PayPalCommerce\Subscription;
11
+
12
+ use WC_Order;
13
+ use WC_Product;
14
+ use WC_Subscription;
15
+ use WC_Subscriptions_Product;
16
+
17
+ /**
18
+ * Class FreeTrialHandlerTrait
19
+ */
20
+ trait FreeTrialHandlerTrait {
21
+ use SubscriptionsHandlerTrait;
22
+
23
+ /**
24
+ * Checks if the cart contains only free trial.
25
+ *
26
+ * @return bool
27
+ */
28
+ protected function is_free_trial_cart(): bool {
29
+ if ( ! $this->is_wcs_plugin_active() ) {
30
+ return false;
31
+ }
32
+
33
+ $cart = WC()->cart;
34
+ if ( ! $cart || $cart->is_empty() || (float) $cart->get_total( 'numeric' ) > 0 ) {
35
+ return false;
36
+ }
37
+
38
+ foreach ( $cart->get_cart() as $item ) {
39
+ $product = $item['data'] ?? null;
40
+ if ( ! $product instanceof WC_Product ) {
41
+ continue;
42
+ }
43
+ if ( WC_Subscriptions_Product::get_trial_length( $product ) > 0 ) {
44
+ return true;
45
+ }
46
+ }
47
+
48
+ return false;
49
+ }
50
+
51
+ /**
52
+ * Checks if the current product contains free trial.
53
+ *
54
+ * @return bool
55
+ */
56
+ protected function is_free_trial_product(): bool {
57
+ if ( ! $this->is_wcs_plugin_active() ) {
58
+ return false;
59
+ }
60
+
61
+ $product = wc_get_product();
62
+
63
+ return $product
64
+ && WC_Subscriptions_Product::is_subscription( $product )
65
+ && WC_Subscriptions_Product::get_trial_length( $product ) > 0;
66
+ }
67
+
68
+ /**
69
+ * Checks if the given order contains only free trial.
70
+ *
71
+ * @param WC_Order $wc_order The WooCommerce order.
72
+ * @return bool
73
+ */
74
+ protected function is_free_trial_order( WC_Order $wc_order ): bool {
75
+ if ( ! $this->is_wcs_plugin_active() ) {
76
+ return false;
77
+ }
78
+
79
+ if ( (float) $wc_order->get_total( 'numeric' ) > 0 ) {
80
+ return false;
81
+ }
82
+
83
+ $subs = wcs_get_subscriptions_for_order( $wc_order );
84
+
85
+ return ! empty(
86
+ array_filter(
87
+ $subs,
88
+ function ( WC_Subscription $sub ): bool {
89
+ return (float) $sub->get_total_initial_payment() <= 0;
90
+ }
91
+ )
92
+ );
93
+ }
94
+ }
modules/ppcp-subscription/src/Helper/SubscriptionHelper.php CHANGED
@@ -11,6 +11,9 @@ declare(strict_types=1);
11
 
12
  namespace WooCommerce\PayPalCommerce\Subscription\Helper;
13
 
 
 
 
14
  /**
15
  * Class SubscriptionHelper
16
  */
@@ -26,7 +29,7 @@ class SubscriptionHelper {
26
  return false;
27
  }
28
  $product = wc_get_product();
29
- return is_a( $product, \WC_Product::class ) && $product->is_type( 'subscription' );
30
  }
31
 
32
  /**
@@ -44,7 +47,7 @@ class SubscriptionHelper {
44
  }
45
 
46
  foreach ( $cart->get_cart() as $item ) {
47
- if ( ! isset( $item['data'] ) || ! is_a( $item['data'], \WC_Product::class ) ) {
48
  continue;
49
  }
50
  if ( $item['data']->is_type( 'subscription' ) || $item['data']->is_type( 'subscription_variation' ) ) {
@@ -71,24 +74,7 @@ class SubscriptionHelper {
71
  return false;
72
  }
73
 
74
- $order = wc_get_order( $order_id );
75
- if ( is_a( $order, \WC_Order::class ) ) {
76
- foreach ( $order->get_items() as $item ) {
77
- if ( is_a( $item, \WC_Order_Item_Product::class ) ) {
78
- $product = wc_get_product( $item->get_product_id() );
79
- /**
80
- * Class already exist in subscriptions plugin.
81
- *
82
- * @psalm-suppress UndefinedClass
83
- */
84
- if ( is_a( $product, \WC_Product_Subscription::class ) ) {
85
- return true;
86
- }
87
- }
88
- }
89
- }
90
-
91
- return false;
92
  }
93
 
94
  /**
@@ -101,12 +87,10 @@ class SubscriptionHelper {
101
  if ( ! $this->plugin_is_active() ) {
102
  return false;
103
  }
104
- $accept_manual_renewals = ( 'no' !== get_option(
105
- //phpcs:disable Inpsyde.CodeQuality.VariablesName.SnakeCaseVar
106
  \WC_Subscriptions_Admin::$option_prefix . '_accept_manual_renewals',
107
- //phpcs:enable Inpsyde.CodeQuality.VariablesName.SnakeCaseVar
108
  'no'
109
- ) ) ? true : false;
110
  return ! $accept_manual_renewals;
111
  }
112
 
11
 
12
  namespace WooCommerce\PayPalCommerce\Subscription\Helper;
13
 
14
+ use WC_Product;
15
+ use WC_Subscriptions_Product;
16
+
17
  /**
18
  * Class SubscriptionHelper
19
  */
29
  return false;
30
  }
31
  $product = wc_get_product();
32
+ return $product && WC_Subscriptions_Product::is_subscription( $product );
33
  }
34
 
35
  /**
47
  }
48
 
49
  foreach ( $cart->get_cart() as $item ) {
50
+ if ( ! isset( $item['data'] ) || ! is_a( $item['data'], WC_Product::class ) ) {
51
  continue;
52
  }
53
  if ( $item['data']->is_type( 'subscription' ) || $item['data']->is_type( 'subscription_variation' ) ) {
74
  return false;
75
  }
76
 
77
+ return $this->has_subscription( $order_id );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  }
79
 
80
  /**
87
  if ( ! $this->plugin_is_active() ) {
88
  return false;
89
  }
90
+ $accept_manual_renewals = 'no' !== get_option(
 
91
  \WC_Subscriptions_Admin::$option_prefix . '_accept_manual_renewals',
 
92
  'no'
93
+ );
94
  return ! $accept_manual_renewals;
95
  }
96
 
modules/ppcp-subscription/src/SubscriptionsHandlerTrait.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Helper trait for the free trial subscriptions handling.
4
+ *
5
+ * @package WooCommerce\PayPalCommerce\Subscription
6
+ */
7
+
8
+ declare(strict_types=1);
9
+
10
+ namespace WooCommerce\PayPalCommerce\Subscription;
11
+
12
+ use WC_Subscriptions;
13
+
14
+ /**
15
+ * Class SubscriptionsHandlerTrait
16
+ */
17
+ trait SubscriptionsHandlerTrait {
18
+ /**
19
+ * Whether the subscription plugin is active or not.
20
+ *
21
+ * @return bool
22
+ */
23
+ protected function is_wcs_plugin_active(): bool {
24
+ return class_exists( WC_Subscriptions::class );
25
+ }
26
+ }
modules/ppcp-vaulting/services.php CHANGED
@@ -14,41 +14,47 @@ use WooCommerce\PayPalCommerce\Vaulting\Assets\MyAccountPaymentsAssets;
14
  use WooCommerce\PayPalCommerce\Vaulting\Endpoint\DeletePaymentTokenEndpoint;
15
 
16
  return array(
17
- 'vaulting.module-url' => static function ( ContainerInterface $container ): string {
18
  return plugins_url(
19
  '/modules/ppcp-vaulting/',
20
  dirname( realpath( __FILE__ ), 3 ) . '/woocommerce-paypal-payments.php'
21
  );
22
  },
23
- 'vaulting.assets.myaccount-payments' => function( ContainerInterface $container ) : MyAccountPaymentsAssets {
24
  return new MyAccountPaymentsAssets(
25
  $container->get( 'vaulting.module-url' ),
26
  $container->get( 'ppcp.asset-version' )
27
  );
28
  },
29
- 'vaulting.payment-tokens-renderer' => static function (): PaymentTokensRenderer {
30
  return new PaymentTokensRenderer();
31
  },
32
- 'vaulting.repository.payment-token' => static function ( ContainerInterface $container ): PaymentTokenRepository {
33
  $factory = $container->get( 'api.factory.payment-token' );
34
  $endpoint = $container->get( 'api.endpoint.payment-token' );
35
  return new PaymentTokenRepository( $factory, $endpoint );
36
  },
37
- 'vaulting.endpoint.delete' => function( ContainerInterface $container ) : DeletePaymentTokenEndpoint {
38
  return new DeletePaymentTokenEndpoint(
39
  $container->get( 'vaulting.repository.payment-token' ),
40
  $container->get( 'button.request-data' ),
41
  $container->get( 'woocommerce.logger.woocommerce' )
42
  );
43
  },
44
- 'vaulting.payment-token-checker' => function( ContainerInterface $container ) : PaymentTokenChecker {
45
  return new PaymentTokenChecker(
46
  $container->get( 'vaulting.repository.payment-token' ),
 
47
  $container->get( 'wcgateway.settings' ),
48
  $container->get( 'wcgateway.processor.authorized-payments' ),
49
- $container->get( 'api.endpoint.order' ),
50
  $container->get( 'api.endpoint.payments' ),
51
  $container->get( 'woocommerce.logger.woocommerce' )
52
  );
53
  },
 
 
 
 
 
 
54
  );
14
  use WooCommerce\PayPalCommerce\Vaulting\Endpoint\DeletePaymentTokenEndpoint;
15
 
16
  return array(
17
+ 'vaulting.module-url' => static function ( ContainerInterface $container ): string {
18
  return plugins_url(
19
  '/modules/ppcp-vaulting/',
20
  dirname( realpath( __FILE__ ), 3 ) . '/woocommerce-paypal-payments.php'
21
  );
22
  },
23
+ 'vaulting.assets.myaccount-payments' => function( ContainerInterface $container ) : MyAccountPaymentsAssets {
24
  return new MyAccountPaymentsAssets(
25
  $container->get( 'vaulting.module-url' ),
26
  $container->get( 'ppcp.asset-version' )
27
  );
28
  },
29
+ 'vaulting.payment-tokens-renderer' => static function (): PaymentTokensRenderer {
30
  return new PaymentTokensRenderer();
31
  },
32
+ 'vaulting.repository.payment-token' => static function ( ContainerInterface $container ): PaymentTokenRepository {
33
  $factory = $container->get( 'api.factory.payment-token' );
34
  $endpoint = $container->get( 'api.endpoint.payment-token' );
35
  return new PaymentTokenRepository( $factory, $endpoint );
36
  },
37
+ 'vaulting.endpoint.delete' => function( ContainerInterface $container ) : DeletePaymentTokenEndpoint {
38
  return new DeletePaymentTokenEndpoint(
39
  $container->get( 'vaulting.repository.payment-token' ),
40
  $container->get( 'button.request-data' ),
41
  $container->get( 'woocommerce.logger.woocommerce' )
42
  );
43
  },
44
+ 'vaulting.payment-token-checker' => function( ContainerInterface $container ) : PaymentTokenChecker {
45
  return new PaymentTokenChecker(
46
  $container->get( 'vaulting.repository.payment-token' ),
47
+ $container->get( 'api.repository.order' ),
48
  $container->get( 'wcgateway.settings' ),
49
  $container->get( 'wcgateway.processor.authorized-payments' ),
 
50
  $container->get( 'api.endpoint.payments' ),
51
  $container->get( 'woocommerce.logger.woocommerce' )
52
  );
53
  },
54
+ 'vaulting.customer-approval-listener' => function( ContainerInterface $container ) : CustomerApprovalListener {
55
+ return new CustomerApprovalListener(
56
+ $container->get( 'api.endpoint.payment-token' ),
57
+ $container->get( 'woocommerce.logger.woocommerce' )
58
+ );
59
+ },
60
  );
modules/ppcp-vaulting/src/CustomerApprovalListener.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Confirm approval token after the PayPal vaulting approval by customer (v2/vault/payment-tokens with CUSTOMER_ACTION_REQUIRED response).
4
+ *
5
+ * @package WooCommerce\PayPalCommerce\Vaulting
6
+ */
7
+
8
+ declare(strict_types=1);
9
+
10
+ namespace WooCommerce\PayPalCommerce\Vaulting;
11
+
12
+ use Exception;
13
+ use Psr\Log\LoggerInterface;
14
+ use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PaymentTokenEndpoint;
15
+ use WooCommerce\PayPalCommerce\ApiClient\Exception\AlreadyVaultedException;
16
+ use WooCommerce\PayPalCommerce\Subscription\FreeTrialHandlerTrait;
17
+
18
+ /**
19
+ * Class CustomerApprovalListener
20
+ */
21
+ class CustomerApprovalListener {
22
+
23
+ use FreeTrialHandlerTrait;
24
+
25
+ /**
26
+ * The PaymentTokenEndpoint.
27
+ *
28
+ * @var PaymentTokenEndpoint
29
+ */
30
+ private $payment_token_endpoint;
31
+
32
+ /**
33
+ * The logger.
34
+ *
35
+ * @var LoggerInterface
36
+ */
37
+ private $logger;
38
+
39
+ /**
40
+ * CustomerApprovalListener constructor.
41
+ *
42
+ * @param PaymentTokenEndpoint $payment_token_endpoint The PaymentTokenEndpoint.
43
+ * @param LoggerInterface $logger The logger.
44
+ */
45
+ public function __construct( PaymentTokenEndpoint $payment_token_endpoint, LoggerInterface $logger ) {
46
+ $this->payment_token_endpoint = $payment_token_endpoint;
47
+ $this->logger = $logger;
48
+ }
49
+
50
+ /**
51
+ * Listens for redirects after the PayPal vaulting approval by customer.
52
+ *
53
+ * @return void
54
+ */
55
+ public function listen(): void {
56
+ $token = filter_input( INPUT_GET, 'approval_token_id', FILTER_SANITIZE_STRING );
57
+ if ( ! is_string( $token ) ) {
58
+ return;
59
+ }
60
+
61
+ $url = (string) filter_input( INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_URL );
62
+
63
+ $query = wp_parse_url( $url, PHP_URL_QUERY );
64
+ if ( $query && str_contains( $query, 'ppcp_vault=cancel' ) ) {
65
+ $this->redirect( $url );
66
+ return;
67
+ }
68
+
69
+ try {
70
+ $this->payment_token_endpoint->create_from_approval_token( $token, get_current_user_id() );
71
+
72
+ $this->redirect( $url );
73
+ } catch ( AlreadyVaultedException $exception ) {
74
+ $this->logger->error( 'Failed to create payment token. ' . $exception->getMessage() );
75
+ $this->add_wc_error_notice(
76
+ __(
77
+ 'This PayPal account is already saved on this site. Please check that you are logged in correctly.',
78
+ 'woocommerce-paypal-payments'
79
+ )
80
+ );
81
+ } catch ( Exception $exception ) {
82
+ $this->logger->error( 'Failed to create payment token. ' . $exception->getMessage() );
83
+ $this->add_wc_error_notice( $exception->getMessage() );
84
+ }
85
+ }
86
+
87
+ /**
88
+ * Makes the message to be added on the WC init event.
89
+ *
90
+ * @param string $message The message text.
91
+ */
92
+ private function add_wc_error_notice( string $message ): void {
93
+ add_action(
94
+ 'woocommerce_init',
95
+ function () use ( $message ): void {
96
+ wc_add_notice( $message, 'error' );
97
+ }
98
+ );
99
+ }
100
+
101
+ /**
102
+ * Redirects removing the vaulting arguments.
103
+ *
104
+ * @param string $current_url The current request URL.
105
+ */
106
+ private function redirect( string $current_url ): void {
107
+ wp_safe_redirect( remove_query_arg( array( 'ppcp_vault', 'approval_token_id', 'approval_session_id' ), $current_url ) );
108
+ exit();
109
+ }
110
+ }
modules/ppcp-vaulting/src/PaymentTokenChecker.php CHANGED
@@ -13,10 +13,10 @@ use Exception;
13
  use Psr\Log\LoggerInterface;
14
  use RuntimeException;
15
  use WC_Order;
16
- use WooCommerce\PayPalCommerce\ApiClient\Endpoint\OrderEndpoint;
17
  use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PaymentsEndpoint;
18
- use WooCommerce\PayPalCommerce\ApiClient\Entity\Authorization;
19
- use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
 
20
  use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
21
  use WooCommerce\PayPalCommerce\WcGateway\Processor\AuthorizedPaymentsProcessor;
22
  use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
@@ -26,6 +26,8 @@ use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
26
  */
27
  class PaymentTokenChecker {
28
 
 
 
29
  /**
30
  * The payment token repository.
31
  *
@@ -33,6 +35,13 @@ class PaymentTokenChecker {
33
  */
34
  protected $payment_token_repository;
35
 
 
 
 
 
 
 
 
36
  /**
37
  * The settings.
38
  *
@@ -47,13 +56,6 @@ class PaymentTokenChecker {
47
  */
48
  protected $authorized_payments_processor;
49
 
50
- /**
51
- * The order endpoint.
52
- *
53
- * @var OrderEndpoint
54
- */
55
- protected $order_endpoint;
56
-
57
  /**
58
  * The payments endpoint.
59
  *
@@ -72,24 +74,24 @@ class PaymentTokenChecker {
72
  * PaymentTokenChecker constructor.
73
  *
74
  * @param PaymentTokenRepository $payment_token_repository The payment token repository.
 
75
  * @param Settings $settings The settings.
76
  * @param AuthorizedPaymentsProcessor $authorized_payments_processor The authorized payments processor.
77
- * @param OrderEndpoint $order_endpoint The order endpoint.
78
  * @param PaymentsEndpoint $payments_endpoint The payments endpoint.
79
  * @param LoggerInterface $logger The logger.
80
  */
81
  public function __construct(
82
  PaymentTokenRepository $payment_token_repository,
 
83
  Settings $settings,
84
  AuthorizedPaymentsProcessor $authorized_payments_processor,
85
- OrderEndpoint $order_endpoint,
86
  PaymentsEndpoint $payments_endpoint,
87
  LoggerInterface $logger
88
  ) {
89
  $this->payment_token_repository = $payment_token_repository;
 
90
  $this->settings = $settings;
91
  $this->authorized_payments_processor = $authorized_payments_processor;
92
- $this->order_endpoint = $order_endpoint;
93
  $this->payments_endpoint = $payments_endpoint;
94
  $this->logger = $logger;
95
  }
@@ -115,6 +117,18 @@ class PaymentTokenChecker {
115
  $tokens = $this->payment_token_repository->all_for_user_id( $customer_id );
116
  if ( $tokens ) {
117
  try {
 
 
 
 
 
 
 
 
 
 
 
 
118
  $this->capture_authorized_payment( $wc_order );
119
  } catch ( Exception $exception ) {
120
  $this->logger->error( $exception->getMessage() );
@@ -126,8 +140,8 @@ class PaymentTokenChecker {
126
  $this->logger->error( "Payment for subscription parent order #{$order_id} was not saved on PayPal." );
127
 
128
  try {
129
- $order = $this->get_order( $wc_order );
130
- $this->void_authorizations( $order );
131
  } catch ( RuntimeException $exception ) {
132
  $this->logger->warning( $exception->getMessage() );
133
  }
@@ -149,55 +163,6 @@ class PaymentTokenChecker {
149
  }
150
  }
151
 
152
- /**
153
- * Voids authorizations for the given PayPal order.
154
- *
155
- * @param Order $order The PayPal order.
156
- * @return void
157
- * @throws RuntimeException When there is a problem voiding authorizations.
158
- */
159
- private function void_authorizations( Order $order ): void {
160
- $purchase_units = $order->purchase_units();
161
- if ( ! $purchase_units ) {
162
- throw new RuntimeException( 'No purchase units.' );
163
- }
164
-
165
- $payments = $purchase_units[0]->payments();
166
- if ( ! $payments ) {
167
- throw new RuntimeException( 'No payments.' );
168
- }
169
-
170
- $voidable_authorizations = array_filter(
171
- $payments->authorizations(),
172
- function ( Authorization $authorization ): bool {
173
- return $authorization->is_voidable();
174
- }
175
- );
176
- if ( ! $voidable_authorizations ) {
177
- throw new RuntimeException( 'No voidable authorizations.' );
178
- }
179
-
180
- foreach ( $voidable_authorizations as $authorization ) {
181
- $this->payments_endpoint->void( $authorization );
182
- }
183
- }
184
-
185
- /**
186
- * Gets a PayPal order from the given WooCommerce order.
187
- *
188
- * @param WC_Order $wc_order The WooCommerce order.
189
- * @return Order The PayPal order.
190
- * @throws RuntimeException When there is a problem getting the PayPal order.
191
- */
192
- private function get_order( WC_Order $wc_order ): Order {
193
- $paypal_order_id = $wc_order->get_meta( PayPalGateway::ORDER_ID_META_KEY );
194
- if ( ! $paypal_order_id ) {
195
- throw new RuntimeException( 'PayPal order ID not found in meta.' );
196
- }
197
-
198
- return $this->order_endpoint->order( $paypal_order_id );
199
- }
200
-
201
  /**
202
  * Updates WC order and subscription status to failed and canceled respectively.
203
  *
13
  use Psr\Log\LoggerInterface;
14
  use RuntimeException;
15
  use WC_Order;
 
16
  use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PaymentsEndpoint;
17
+ use WooCommerce\PayPalCommerce\ApiClient\Repository\OrderRepository;
18
+ use WooCommerce\PayPalCommerce\Subscription\FreeTrialHandlerTrait;
19
+ use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
20
  use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
21
  use WooCommerce\PayPalCommerce\WcGateway\Processor\AuthorizedPaymentsProcessor;
22
  use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
26
  */
27
  class PaymentTokenChecker {
28
 
29
+ use FreeTrialHandlerTrait;
30
+
31
  /**
32
  * The payment token repository.
33
  *
35
  */
36
  protected $payment_token_repository;
37
 
38
+ /**
39
+ * The order repository.
40
+ *
41
+ * @var OrderRepository
42
+ */
43
+ protected $order_repository;
44
+
45
  /**
46
  * The settings.
47
  *
56
  */
57
  protected $authorized_payments_processor;
58
 
 
 
 
 
 
 
 
59
  /**
60
  * The payments endpoint.
61
  *
74
  * PaymentTokenChecker constructor.
75
  *
76
  * @param PaymentTokenRepository $payment_token_repository The payment token repository.
77
+ * @param OrderRepository $order_repository The order repository.
78
  * @param Settings $settings The settings.
79
  * @param AuthorizedPaymentsProcessor $authorized_payments_processor The authorized payments processor.
 
80
  * @param PaymentsEndpoint $payments_endpoint The payments endpoint.
81
  * @param LoggerInterface $logger The logger.
82
  */
83
  public function __construct(
84
  PaymentTokenRepository $payment_token_repository,
85
+ OrderRepository $order_repository,
86
  Settings $settings,
87
  AuthorizedPaymentsProcessor $authorized_payments_processor,
 
88
  PaymentsEndpoint $payments_endpoint,
89
  LoggerInterface $logger
90
  ) {
91
  $this->payment_token_repository = $payment_token_repository;
92
+ $this->order_repository = $order_repository;
93
  $this->settings = $settings;
94
  $this->authorized_payments_processor = $authorized_payments_processor;
 
95
  $this->payments_endpoint = $payments_endpoint;
96
  $this->logger = $logger;
97
  }
117
  $tokens = $this->payment_token_repository->all_for_user_id( $customer_id );
118
  if ( $tokens ) {
119
  try {
120
+ if ( $this->is_free_trial_order( $wc_order ) ) {
121
+ if ( CreditCardGateway::ID === $wc_order->get_payment_method()
122
+ || ( PayPalGateway::ID === $wc_order->get_payment_method() && 'card' === $wc_order->get_meta( PayPalGateway::ORDER_PAYMENT_SOURCE ) )
123
+ ) {
124
+ $order = $this->order_repository->for_wc_order( $wc_order );
125
+ $this->authorized_payments_processor->void_authorizations( $order );
126
+ $wc_order->payment_complete();
127
+ }
128
+
129
+ return;
130
+ }
131
+
132
  $this->capture_authorized_payment( $wc_order );
133
  } catch ( Exception $exception ) {
134
  $this->logger->error( $exception->getMessage() );
140
  $this->logger->error( "Payment for subscription parent order #{$order_id} was not saved on PayPal." );
141
 
142
  try {
143
+ $order = $this->order_repository->for_wc_order( $wc_order );
144
+ $this->authorized_payments_processor->void_authorizations( $order );
145
  } catch ( RuntimeException $exception ) {
146
  $this->logger->warning( $exception->getMessage() );
147
  }
163
  }
164
  }
165
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
  /**
167
  * Updates WC order and subscription status to failed and canceled respectively.
168
  *
modules/ppcp-vaulting/src/VaultingModule.php CHANGED
@@ -43,6 +43,11 @@ class VaultingModule implements ModuleInterface {
43
  return;
44
  }
45
 
 
 
 
 
 
46
  add_filter(
47
  'woocommerce_account_menu_items',
48
  function( $menu_links ) {
43
  return;
44
  }
45
 
46
+ $listener = $container->get( 'vaulting.customer-approval-listener' );
47
+ assert( $listener instanceof CustomerApprovalListener );
48
+
49
+ $listener->listen();
50
+
51
  add_filter(
52
  'woocommerce_account_menu_items',
53
  function( $menu_links ) {
modules/ppcp-vaulting/yarn.lock CHANGED
@@ -1722,9 +1722,9 @@ mimic-fn@^2.1.0:
1722
  integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==
1723
 
1724
  minimist@^1.2.0, minimist@^1.2.5:
1725
- version "1.2.5"
1726
- resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
1727
- integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
1728
 
1729
  ms@2.1.2:
1730
  version "2.1.2"
1722
  integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==
1723
 
1724
  minimist@^1.2.0, minimist@^1.2.5:
1725
+ version "1.2.6"
1726
+ resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
1727
+ integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
1728
 
1729
  ms@2.1.2:
1730
  version "2.1.2"
modules/ppcp-wc-gateway/extensions.php CHANGED
@@ -88,8 +88,7 @@ return array(
88
  );
89
  },
90
  'woocommerce.logger.woocommerce' => function ( ContainerInterface $container ): LoggerInterface {
91
- $settings = $container->get( 'wcgateway.settings' );
92
- if ( ! function_exists( 'wc_get_logger' ) || ! $settings->has( 'logging_enabled' ) || ! $settings->get( 'logging_enabled' ) ) {
93
  return new NullLogger();
94
  }
95
 
88
  );
89
  },
90
  'woocommerce.logger.woocommerce' => function ( ContainerInterface $container ): LoggerInterface {
91
+ if ( ! function_exists( 'wc_get_logger' ) || ! $container->get( 'wcgateway.logging.is-enabled' ) ) {
 
92
  return new NullLogger();
93
  }
94
 
modules/ppcp-wc-gateway/services.php CHANGED
@@ -771,21 +771,7 @@ return array(
771
  >',
772
  '</a>'
773
  ),
774
- 'options' => array(
775
- 'card' => _x( 'Credit or debit cards', 'Name of payment method', 'woocommerce-paypal-payments' ),
776
- 'credit' => _x( 'Pay Later', 'Name of payment method', 'woocommerce-paypal-payments' ),
777
- 'sepa' => _x( 'SEPA-Lastschrift', 'Name of payment method', 'woocommerce-paypal-payments' ),
778
- 'bancontact' => _x( 'Bancontact', 'Name of payment method', 'woocommerce-paypal-payments' ),
779
- 'blik' => _x( 'BLIK', 'Name of payment method', 'woocommerce-paypal-payments' ),
780
- 'eps' => _x( 'eps', 'Name of payment method', 'woocommerce-paypal-payments' ),
781
- 'giropay' => _x( 'giropay', 'Name of payment method', 'woocommerce-paypal-payments' ),
782
- 'ideal' => _x( 'iDEAL', 'Name of payment method', 'woocommerce-paypal-payments' ),
783
- 'mercadopago' => _x( 'Mercado Pago', 'Name of payment method', 'woocommerce-paypal-payments' ),
784
- 'mybank' => _x( 'MyBank', 'Name of payment method', 'woocommerce-paypal-payments' ),
785
- 'p24' => _x( 'Przelewy24', 'Name of payment method', 'woocommerce-paypal-payments' ),
786
- 'sofort' => _x( 'Sofort', 'Name of payment method', 'woocommerce-paypal-payments' ),
787
- 'venmo' => _x( 'Venmo', 'Name of payment method', 'woocommerce-paypal-payments' ),
788
- ),
789
  'screens' => array(
790
  State::STATE_START,
791
  State::STATE_ONBOARDED,
@@ -1959,13 +1945,15 @@ return array(
1959
  'woocommerce-paypal-payments'
1960
  ),
1961
  'options' => array(
1962
- 'visa' => _x( 'Visa', 'Name of credit card', 'woocommerce-paypal-payments' ),
1963
- 'mastercard' => _x( 'Mastercard', 'Name of credit card', 'woocommerce-paypal-payments' ),
1964
- 'amex' => _x( 'American Express', 'Name of credit card', 'woocommerce-paypal-payments' ),
1965
- 'discover' => _x( 'Discover', 'Name of credit card', 'woocommerce-paypal-payments' ),
1966
- 'jcb' => _x( 'JCB', 'Name of credit card', 'woocommerce-paypal-payments' ),
1967
- 'elo' => _x( 'Elo', 'Name of credit card', 'woocommerce-paypal-payments' ),
1968
- 'hiper' => _x( 'Hiper', 'Name of credit card', 'woocommerce-paypal-payments' ),
 
 
1969
  ),
1970
  'screens' => array(
1971
  State::STATE_ONBOARDED,
@@ -2041,14 +2029,23 @@ return array(
2041
  * Here, we filter them out.
2042
  */
2043
  $card_options = $fields['disable_cards']['options'];
 
 
2044
  foreach ( $card_options as $card => $label ) {
2045
  if ( $dcc_applies->can_process_card( $card ) ) {
 
 
 
 
 
 
2046
  continue;
2047
  }
2048
  unset( $card_options[ $card ] );
2049
  }
 
2050
  $fields['disable_cards']['options'] = $card_options;
2051
- $fields['card_icons']['options'] = $card_options;
2052
 
2053
  /**
2054
  * Display vault message on Pay Later label if vault is enabled.
@@ -2064,6 +2061,24 @@ return array(
2064
  return $fields;
2065
  },
2066
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2067
  'wcgateway.checkout.address-preset' => static function( ContainerInterface $container ): CheckoutPayPalAddressPreset {
2068
 
2069
  return new CheckoutPayPalAddressPreset(
@@ -2129,4 +2144,16 @@ return array(
2129
  $container->get( 'wcgateway.settings' )
2130
  );
2131
  },
 
 
 
 
 
 
 
 
 
 
 
 
2132
  );
771
  >',
772
  '</a>'
773
  ),
774
+ 'options' => $container->get( 'wcgateway.all-funding-sources' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
775
  'screens' => array(
776
  State::STATE_START,
777
  State::STATE_ONBOARDED,
1945
  'woocommerce-paypal-payments'
1946
  ),
1947
  'options' => array(
1948
+ 'visa' => _x( 'Visa (light)', 'Name of credit card', 'woocommerce-paypal-payments' ),
1949
+ 'visa-dark' => _x( 'Visa (dark)', 'Name of credit card', 'woocommerce-paypal-payments' ),
1950
+ 'mastercard' => _x( 'Mastercard (light)', 'Name of credit card', 'woocommerce-paypal-payments' ),
1951
+ 'mastercard-dark' => _x( 'Mastercard (dark)', 'Name of credit card', 'woocommerce-paypal-payments' ),
1952
+ 'amex' => _x( 'American Express', 'Name of credit card', 'woocommerce-paypal-payments' ),
1953
+ 'discover' => _x( 'Discover', 'Name of credit card', 'woocommerce-paypal-payments' ),
1954
+ 'jcb' => _x( 'JCB', 'Name of credit card', 'woocommerce-paypal-payments' ),
1955
+ 'elo' => _x( 'Elo', 'Name of credit card', 'woocommerce-paypal-payments' ),
1956
+ 'hiper' => _x( 'Hiper', 'Name of credit card', 'woocommerce-paypal-payments' ),
1957
  ),
1958
  'screens' => array(
1959
  State::STATE_ONBOARDED,
2029
  * Here, we filter them out.
2030
  */
2031
  $card_options = $fields['disable_cards']['options'];
2032
+ $card_icons = $fields['card_icons']['options'];
2033
+ $dark_versions = array();
2034
  foreach ( $card_options as $card => $label ) {
2035
  if ( $dcc_applies->can_process_card( $card ) ) {
2036
+ if ( 'visa' === $card || 'mastercard' === $card ) {
2037
+ $dark_versions = array(
2038
+ 'visa-dark' => $card_icons['visa-dark'],
2039
+ 'mastercard-dark' => $card_icons['mastercard-dark'],
2040
+ );
2041
+ }
2042
  continue;
2043
  }
2044
  unset( $card_options[ $card ] );
2045
  }
2046
+
2047
  $fields['disable_cards']['options'] = $card_options;
2048
+ $fields['card_icons']['options'] = array_merge( $dark_versions, $card_options );
2049
 
2050
  /**
2051
  * Display vault message on Pay Later label if vault is enabled.
2061
  return $fields;
2062
  },
2063
 
2064
+ 'wcgateway.all-funding-sources' => static function( ContainerInterface $container ): array {
2065
+ return array(
2066
+ 'card' => _x( 'Credit or debit cards', 'Name of payment method', 'woocommerce-paypal-payments' ),
2067
+ 'credit' => _x( 'Pay Later', 'Name of payment method', 'woocommerce-paypal-payments' ),
2068
+ 'sepa' => _x( 'SEPA-Lastschrift', 'Name of payment method', 'woocommerce-paypal-payments' ),
2069
+ 'bancontact' => _x( 'Bancontact', 'Name of payment method', 'woocommerce-paypal-payments' ),
2070
+ 'blik' => _x( 'BLIK', 'Name of payment method', 'woocommerce-paypal-payments' ),
2071
+ 'eps' => _x( 'eps', 'Name of payment method', 'woocommerce-paypal-payments' ),
2072
+ 'giropay' => _x( 'giropay', 'Name of payment method', 'woocommerce-paypal-payments' ),
2073
+ 'ideal' => _x( 'iDEAL', 'Name of payment method', 'woocommerce-paypal-payments' ),
2074
+ 'mercadopago' => _x( 'Mercado Pago', 'Name of payment method', 'woocommerce-paypal-payments' ),
2075
+ 'mybank' => _x( 'MyBank', 'Name of payment method', 'woocommerce-paypal-payments' ),
2076
+ 'p24' => _x( 'Przelewy24', 'Name of payment method', 'woocommerce-paypal-payments' ),
2077
+ 'sofort' => _x( 'Sofort', 'Name of payment method', 'woocommerce-paypal-payments' ),
2078
+ 'venmo' => _x( 'Venmo', 'Name of payment method', 'woocommerce-paypal-payments' ),
2079
+ );
2080
+ },
2081
+
2082
  'wcgateway.checkout.address-preset' => static function( ContainerInterface $container ): CheckoutPayPalAddressPreset {
2083
 
2084
  return new CheckoutPayPalAddressPreset(
2144
  $container->get( 'wcgateway.settings' )
2145
  );
2146
  },
2147
+
2148
+ 'wcgateway.logging.is-enabled' => function ( ContainerInterface $container ) : bool {
2149
+ $settings = $container->get( 'wcgateway.settings' );
2150
+
2151
+ /**
2152
+ * Whether the logging of the plugin errors/events is enabled.
2153
+ */
2154
+ return apply_filters(
2155
+ 'woocommerce_paypal_payments_is_logging_enabled',
2156
+ $settings->has( 'logging_enabled' ) && $settings->get( 'logging_enabled' )
2157
+ );
2158
+ },
2159
  );
modules/ppcp-wc-gateway/src/Gateway/CreditCardGateway.php CHANGED
@@ -331,8 +331,9 @@ class CreditCardGateway extends \WC_Payment_Gateway_CC {
331
  $title_options = $this->card_labels();
332
  $images = array_map(
333
  function ( string $type ) use ( $title_options ): string {
 
334
  return '<img
335
- title="' . esc_attr( $title_options[ $type ] ) . '"
336
  src="' . esc_url( $this->module_url ) . 'assets/images/' . esc_attr( $type ) . '.svg"
337
  class="ppcp-card-icon"
338
  > ';
@@ -439,7 +440,7 @@ class CreditCardGateway extends \WC_Payment_Gateway_CC {
439
  parent::init_settings();
440
 
441
  // looks like in some cases WC uses this field instead of get_option.
442
- $this->enabled = $this->is_enabled();
443
  }
444
 
445
  /**
@@ -468,6 +469,7 @@ class CreditCardGateway extends \WC_Payment_Gateway_CC {
468
  $ret = parent::update_option( $key, $value );
469
 
470
  if ( 'enabled' === $key ) {
 
471
  $this->config->set( 'dcc_enabled', 'yes' === $value );
472
  $this->config->persist();
473
 
331
  $title_options = $this->card_labels();
332
  $images = array_map(
333
  function ( string $type ) use ( $title_options ): string {
334
+ $striped_dark = str_replace( '-dark', '', $type );
335
  return '<img
336
+ title="' . esc_attr( $title_options[ $striped_dark ] ) . '"
337
  src="' . esc_url( $this->module_url ) . 'assets/images/' . esc_attr( $type ) . '.svg"
338
  class="ppcp-card-icon"
339
  > ';
440
  parent::init_settings();
441
 
442
  // looks like in some cases WC uses this field instead of get_option.
443
+ $this->enabled = $this->is_enabled() ? 'yes' : '';
444
  }
445
 
446
  /**
469
  $ret = parent::update_option( $key, $value );
470
 
471
  if ( 'enabled' === $key ) {
472
+
473
  $this->config->set( 'dcc_enabled', 'yes' === $value );
474
  $this->config->persist();
475
 
modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php CHANGED
@@ -37,6 +37,7 @@ class PayPalGateway extends \WC_Payment_Gateway {
37
  const INTENT_META_KEY = '_ppcp_paypal_intent';
38
  const ORDER_ID_META_KEY = '_ppcp_paypal_order_id';
39
  const ORDER_PAYMENT_MODE_META_KEY = '_ppcp_paypal_payment_mode';
 
40
  const FEES_META_KEY = '_ppcp_paypal_fees';
41
 
42
  /**
37
  const INTENT_META_KEY = '_ppcp_paypal_intent';
38
  const ORDER_ID_META_KEY = '_ppcp_paypal_order_id';
39
  const ORDER_PAYMENT_MODE_META_KEY = '_ppcp_paypal_payment_mode';
40
+ const ORDER_PAYMENT_SOURCE = '_ppcp_paypal_payment_source';
41
  const FEES_META_KEY = '_ppcp_paypal_fees';
42
 
43
  /**
modules/ppcp-wc-gateway/src/Gateway/ProcessPaymentTrait.php CHANGED
@@ -11,9 +11,11 @@ namespace WooCommerce\PayPalCommerce\WcGateway\Gateway;
11
 
12
  use Exception;
13
  use WooCommerce\PayPalCommerce\ApiClient\Entity\OrderStatus;
 
14
  use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException;
15
  use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
16
  use WooCommerce\PayPalCommerce\Onboarding\Environment;
 
17
  use WooCommerce\PayPalCommerce\WcGateway\Processor\AuthorizedPaymentsProcessor;
18
  use WooCommerce\PayPalCommerce\WcGateway\Processor\OrderMetaTrait;
19
  use WooCommerce\PayPalCommerce\WcGateway\Processor\PaymentsStatusHandlingTrait;
@@ -24,7 +26,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Processor\TransactionIdHandlingTrait;
24
  */
25
  trait ProcessPaymentTrait {
26
 
27
- use OrderMetaTrait, PaymentsStatusHandlingTrait, TransactionIdHandlingTrait;
28
 
29
  /**
30
  * Process a payment for an WooCommerce order.
@@ -53,6 +55,7 @@ trait ProcessPaymentTrait {
53
  }
54
 
55
  $payment_method = filter_input( INPUT_POST, 'payment_method', FILTER_SANITIZE_STRING );
 
56
 
57
  /**
58
  * If customer has chosen a saved credit card payment.
@@ -115,7 +118,10 @@ trait ProcessPaymentTrait {
115
 
116
  $this->handle_new_order_status( $order, $wc_order );
117
 
118
- if ( $this->config->has( 'intent' ) && strtoupper( (string) $this->config->get( 'intent' ) ) === 'CAPTURE' ) {
 
 
 
119
  $this->authorized_payments_processor->capture_authorized_payment( $wc_order );
120
  }
121
 
@@ -130,6 +136,28 @@ trait ProcessPaymentTrait {
130
  }
131
  }
132
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  /**
134
  * If customer has chosen change Subscription payment.
135
  */
11
 
12
  use Exception;
13
  use WooCommerce\PayPalCommerce\ApiClient\Entity\OrderStatus;
14
+ use WooCommerce\PayPalCommerce\ApiClient\Entity\PaymentToken;
15
  use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException;
16
  use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
17
  use WooCommerce\PayPalCommerce\Onboarding\Environment;
18
+ use WooCommerce\PayPalCommerce\Subscription\FreeTrialHandlerTrait;
19
  use WooCommerce\PayPalCommerce\WcGateway\Processor\AuthorizedPaymentsProcessor;
20
  use WooCommerce\PayPalCommerce\WcGateway\Processor\OrderMetaTrait;
21
  use WooCommerce\PayPalCommerce\WcGateway\Processor\PaymentsStatusHandlingTrait;
26
  */
27
  trait ProcessPaymentTrait {
28
 
29
+ use OrderMetaTrait, PaymentsStatusHandlingTrait, TransactionIdHandlingTrait, FreeTrialHandlerTrait;
30
 
31
  /**
32
  * Process a payment for an WooCommerce order.
55
  }
56
 
57
  $payment_method = filter_input( INPUT_POST, 'payment_method', FILTER_SANITIZE_STRING );
58
+ $funding_source = filter_input( INPUT_POST, 'ppcp-funding-source', FILTER_SANITIZE_STRING );
59
 
60
  /**
61
  * If customer has chosen a saved credit card payment.
118
 
119
  $this->handle_new_order_status( $order, $wc_order );
120
 
121
+ if ( $this->is_free_trial_order( $wc_order ) ) {
122
+ $this->authorized_payments_processor->void_authorizations( $order );
123
+ $wc_order->payment_complete();
124
+ } elseif ( $this->config->has( 'intent' ) && strtoupper( (string) $this->config->get( 'intent' ) ) === 'CAPTURE' ) {
125
  $this->authorized_payments_processor->capture_authorized_payment( $wc_order );
126
  }
127
 
136
  }
137
  }
138
 
139
+ if ( PayPalGateway::ID === $payment_method && 'card' !== $funding_source && $this->is_free_trial_order( $wc_order ) ) {
140
+ $user_id = (int) $wc_order->get_customer_id();
141
+ $tokens = $this->payment_token_repository->all_for_user_id( $user_id );
142
+ if ( ! array_filter(
143
+ $tokens,
144
+ function ( PaymentToken $token ): bool {
145
+ return isset( $token->source()->paypal );
146
+ }
147
+ ) ) {
148
+ $this->handle_failure( $wc_order, new Exception( 'No saved PayPal account.' ) );
149
+ return null;
150
+ }
151
+
152
+ $wc_order->payment_complete();
153
+
154
+ $this->session_handler->destroy_session_data();
155
+ return array(
156
+ 'result' => 'success',
157
+ 'redirect' => $this->get_return_url( $wc_order ),
158
+ );
159
+ }
160
+
161
  /**
162
  * If customer has chosen change Subscription payment.
163
  */
modules/ppcp-wc-gateway/src/Processor/AuthorizedPaymentsProcessor.php CHANGED
@@ -21,6 +21,7 @@ use WooCommerce\PayPalCommerce\ApiClient\Entity\Capture;
21
  use WooCommerce\PayPalCommerce\ApiClient\Entity\CaptureStatus;
22
  use WooCommerce\PayPalCommerce\ApiClient\Entity\Money;
23
  use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
 
24
  use WooCommerce\PayPalCommerce\Subscription\Helper\SubscriptionHelper;
25
  use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
26
  use WooCommerce\PayPalCommerce\WcGateway\Notice\AuthorizeOrderActionNotice;
@@ -244,6 +245,39 @@ class AuthorizedPaymentsProcessor {
244
  }
245
  }
246
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  /**
248
  * Displays the notice for a status.
249
  *
21
  use WooCommerce\PayPalCommerce\ApiClient\Entity\CaptureStatus;
22
  use WooCommerce\PayPalCommerce\ApiClient\Entity\Money;
23
  use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
24
+ use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
25
  use WooCommerce\PayPalCommerce\Subscription\Helper\SubscriptionHelper;
26
  use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
27
  use WooCommerce\PayPalCommerce\WcGateway\Notice\AuthorizeOrderActionNotice;
245
  }
246
  }
247
 
248
+ /**
249
+ * Voids authorizations for the given PayPal order.
250
+ *
251
+ * @param Order $order The PayPal order.
252
+ * @return void
253
+ * @throws RuntimeException When there is a problem voiding authorizations.
254
+ */
255
+ public function void_authorizations( Order $order ): void {
256
+ $purchase_units = $order->purchase_units();
257
+ if ( ! $purchase_units ) {
258
+ throw new RuntimeException( 'No purchase units.' );
259
+ }
260
+
261
+ $payments = $purchase_units[0]->payments();
262
+ if ( ! $payments ) {
263
+ throw new RuntimeException( 'No payments.' );
264
+ }
265
+
266
+ $voidable_authorizations = array_filter(
267
+ $payments->authorizations(),
268
+ function ( Authorization $authorization ): bool {
269
+ return $authorization->is_voidable();
270
+ }
271
+ );
272
+ if ( ! $voidable_authorizations ) {
273
+ throw new RuntimeException( 'No voidable authorizations.' );
274
+ }
275
+
276
+ foreach ( $voidable_authorizations as $authorization ) {
277
+ $this->payments_endpoint->void( $authorization );
278
+ }
279
+ }
280
+
281
  /**
282
  * Displays the notice for a status.
283
  *
modules/ppcp-wc-gateway/src/Processor/OrderMetaTrait.php CHANGED
@@ -37,5 +37,29 @@ trait OrderMetaTrait {
37
  PayPalGateway::ORDER_PAYMENT_MODE_META_KEY,
38
  $environment->current_environment_is( Environment::SANDBOX ) ? 'sandbox' : 'live'
39
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  }
41
  }
37
  PayPalGateway::ORDER_PAYMENT_MODE_META_KEY,
38
  $environment->current_environment_is( Environment::SANDBOX ) ? 'sandbox' : 'live'
39
  );
40
+ $payment_source = $this->get_payment_source( $order );
41
+ if ( $payment_source ) {
42
+ $wc_order->update_meta_data( PayPalGateway::ORDER_PAYMENT_SOURCE, $payment_source );
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Returns the payment source type or null,
48
+ *
49
+ * @param Order $order The PayPal order.
50
+ * @return string|null
51
+ */
52
+ private function get_payment_source( Order $order ): ?string {
53
+ $source = $order->payment_source();
54
+ if ( $source ) {
55
+ if ( $source->card() ) {
56
+ return 'card';
57
+ }
58
+ if ( $source->wallet() ) {
59
+ return 'wallet';
60
+ }
61
+ }
62
+
63
+ return null;
64
  }
65
  }
modules/ppcp-wc-gateway/yarn.lock CHANGED
@@ -1639,9 +1639,9 @@ mimic-fn@^2.1.0:
1639
  integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==
1640
 
1641
  minimist@^1.2.0, minimist@^1.2.5:
1642
- version "1.2.5"
1643
- resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
1644
- integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
1645
 
1646
  ms@2.1.2:
1647
  version "2.1.2"
1639
  integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==
1640
 
1641
  minimist@^1.2.0, minimist@^1.2.5:
1642
+ version "1.2.6"
1643
+ resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
1644
+ integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
1645
 
1646
  ms@2.1.2:
1647
  version "2.1.2"
modules/ppcp-webhooks/yarn.lock CHANGED
@@ -1722,9 +1722,9 @@ mimic-fn@^2.1.0:
1722
  integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==
1723
 
1724
  minimist@^1.2.0, minimist@^1.2.5:
1725
- version "1.2.5"
1726
- resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
1727
- integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
1728
 
1729
  ms@2.1.2:
1730
  version "2.1.2"
1722
  integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==
1723
 
1724
  minimist@^1.2.0, minimist@^1.2.5:
1725
+ version "1.2.6"
1726
+ resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
1727
+ integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
1728
 
1729
  ms@2.1.2:
1730
  version "2.1.2"
psalm-baseline.xml CHANGED
@@ -1,5 +1,5 @@
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <files psalm-version="4.20.0@f82a70e7edfc6cf2705e9374c8a0b6a974a779ed">
3
  <file src="modules/ppcp-api-client/services.php">
4
  <UndefinedConstant occurrences="2">
5
  <code>PAYPAL_API_URL</code>
@@ -206,25 +206,12 @@
206
  <RedundantCast occurrences="1">
207
  <code>(float) $item_total</code>
208
  </RedundantCast>
209
- <RedundantCastGivenDocblockType occurrences="6">
210
- <code>(float) $cart-&gt;get_discount_total()</code>
211
- <code>(float) $cart-&gt;get_shipping_total()</code>
212
- <code>(float) $cart-&gt;get_total( 'numeric' )</code>
213
- <code>(float) $order-&gt;get_total()</code>
214
- <code>(float) $order-&gt;get_total_discount( false )</code>
215
- <code>(float) $order-&gt;get_total_discount( false )</code>
216
- </RedundantCastGivenDocblockType>
217
  </file>
218
  <file src="modules/ppcp-api-client/src/Factory/ItemFactory.php">
219
  <ArgumentTypeCoercion occurrences="1"/>
220
  <PossiblyInvalidArgument occurrences="1">
221
  <code>$fees_from_session</code>
222
  </PossiblyInvalidArgument>
223
- <RedundantCastGivenDocblockType occurrences="3">
224
- <code>(float) $order-&gt;get_item_subtotal( $item, false )</code>
225
- <code>(float) $order-&gt;get_item_subtotal( $item, true )</code>
226
- <code>(int) $item-&gt;get_quantity()</code>
227
- </RedundantCastGivenDocblockType>
228
  </file>
229
  <file src="modules/ppcp-api-client/src/Factory/PayerFactory.php">
230
  <PossiblyNullArgument occurrences="2">
@@ -261,18 +248,11 @@
261
  <MissingReturnType occurrences="1">
262
  <code>delete</code>
263
  </MissingReturnType>
264
- <RedundantCastGivenDocblockType occurrences="1">
265
- <code>(bool) set_transient( $this-&gt;prefix . $key, $value )</code>
266
- </RedundantCastGivenDocblockType>
267
  </file>
268
  <file src="modules/ppcp-api-client/src/Repository/ApplicationContextRepository.php">
269
  <PossiblyFalseArgument occurrences="1">
270
  <code>strrpos( $locale, '-' )</code>
271
  </PossiblyFalseArgument>
272
- <RedundantCastGivenDocblockType occurrences="2">
273
- <code>(string) home_url( \WC_AJAX::get_endpoint( ReturnUrlEndpoint::ENDPOINT ) )</code>
274
- <code>(string) wc_get_checkout_url()</code>
275
- </RedundantCastGivenDocblockType>
276
  </file>
277
  <file src="modules/ppcp-api-client/src/Repository/PayPalRequestIdRepository.php">
278
  <UndefinedConstant occurrences="1">
@@ -289,9 +269,6 @@
289
  </UndefinedConstant>
290
  </file>
291
  <file src="modules/ppcp-button/src/Assets/SmartButton.php">
292
- <InvalidScalarArgument occurrences="1">
293
- <code>1</code>
294
- </InvalidScalarArgument>
295
  <MissingClosureParamType occurrences="1">
296
  <code>$id</code>
297
  </MissingClosureParamType>
@@ -419,13 +396,6 @@
419
  <PossiblyUndefinedMethod occurrences="1">
420
  <code>get_payment_method</code>
421
  </PossiblyUndefinedMethod>
422
- <UndefinedFunction occurrences="5">
423
- <code>wcs_get_subscription( absint( $_GET['subscription_id'] ) )</code>
424
- <code>wcs_get_subscription( absint( get_query_var( 'order-pay' ) ) )</code>
425
- <code>wcs_get_subscription( absint( get_query_var( 'view-subscription' ) ) )</code>
426
- <code>wcs_is_view_subscription_page()</code>
427
- <code>wcs_order_contains_renewal( $order )</code>
428
- </UndefinedFunction>
429
  </file>
430
  <file src="modules/ppcp-onboarding/services.php">
431
  <MissingClosureParamType occurrences="1">
@@ -447,13 +417,6 @@
447
  <code>PAYPAL_SANDBOX_API_URL</code>
448
  </UndefinedConstant>
449
  </file>
450
- <file src="modules/ppcp-onboarding/src/Assets/OnboardingAssets.php">
451
- <InvalidScalarArgument occurrences="3">
452
- <code>1</code>
453
- <code>1</code>
454
- <code>1</code>
455
- </InvalidScalarArgument>
456
- </file>
457
  <file src="modules/ppcp-onboarding/src/OnboardingModule.php">
458
  <MissingClosureParamType occurrences="3">
459
  <code>$config</code>
@@ -517,11 +480,6 @@
517
  <code>getKey</code>
518
  </MissingReturnType>
519
  </file>
520
- <file src="modules/ppcp-subscription/src/Helper/SubscriptionHelper.php">
521
- <UndefinedClass occurrences="1">
522
- <code>\WC_Subscriptions_Admin</code>
523
- </UndefinedClass>
524
- </file>
525
  <file src="modules/ppcp-subscription/src/RenewalHandler.php">
526
  <FalsableReturnStatement occurrences="1">
527
  <code>current( $tokens )</code>
@@ -530,10 +488,6 @@
530
  <code>process_order</code>
531
  <code>renew</code>
532
  </MissingReturnType>
533
- <RedundantCastGivenDocblockType occurrences="2">
534
- <code>(int) $customer-&gt;get_id()</code>
535
- <code>(int) $wc_order-&gt;get_customer_id()</code>
536
- </RedundantCastGivenDocblockType>
537
  <TooManyArguments occurrences="1">
538
  <code>apply_filters( 'woocommerce_paypal_payments_subscriptions_get_token_for_customer', null, $customer, $wc_order )</code>
539
  </TooManyArguments>
@@ -556,9 +510,6 @@
556
  <PossiblyNullReference occurrences="1">
557
  <code>get</code>
558
  </PossiblyNullReference>
559
- <UndefinedClass occurrences="1">
560
- <code>\WC_Subscription</code>
561
- </UndefinedClass>
562
  </file>
563
  <file src="modules/ppcp-vaulting/services.php">
564
  <PossiblyFalseArgument occurrences="1">
@@ -688,9 +639,6 @@
688
  </PossiblyUndefinedVariable>
689
  </file>
690
  <file src="modules/ppcp-wc-gateway/src/Processor/AuthorizedPaymentsProcessor.php">
691
- <MissingReturnType occurrences="1">
692
- <code>capture_authorizations</code>
693
- </MissingReturnType>
694
  <PossiblyNullReference occurrences="1">
695
  <code>authorizations</code>
696
  </PossiblyNullReference>
@@ -902,9 +850,6 @@
902
  <code>$request['resource']['custom_id']</code>
903
  <code>$request['resource']['id']</code>
904
  </PossiblyNullArrayAccess>
905
- <RedundantCastGivenDocblockType occurrences="1">
906
- <code>(bool) $wc_order-&gt;update_status( 'cancelled' )</code>
907
- </RedundantCastGivenDocblockType>
908
  </file>
909
  <file src="modules/ppcp-webhooks/src/IncomingWebhookEndpoint.php">
910
  <InvalidReturnStatement occurrences="2">
@@ -919,7 +864,6 @@
919
  <PossiblyNullArgument occurrences="1">
920
  <code>$request['event_type']</code>
921
  </PossiblyNullArgument>
922
- <RedundantCastGivenDocblockType occurrences="1"/>
923
  </file>
924
  <file src="src/services.php">
925
  <PossiblyFalseArgument occurrences="1">
1
  <?xml version="1.0" encoding="UTF-8"?>
2
+ <files psalm-version="4.22.0@fc2c6ab4d5fa5d644d8617089f012f3bb84b8703">
3
  <file src="modules/ppcp-api-client/services.php">
4
  <UndefinedConstant occurrences="2">
5
  <code>PAYPAL_API_URL</code>
206
  <RedundantCast occurrences="1">
207
  <code>(float) $item_total</code>
208
  </RedundantCast>
 
 
 
 
 
 
 
 
209
  </file>
210
  <file src="modules/ppcp-api-client/src/Factory/ItemFactory.php">
211
  <ArgumentTypeCoercion occurrences="1"/>
212
  <PossiblyInvalidArgument occurrences="1">
213
  <code>$fees_from_session</code>
214
  </PossiblyInvalidArgument>
 
 
 
 
 
215
  </file>
216
  <file src="modules/ppcp-api-client/src/Factory/PayerFactory.php">
217
  <PossiblyNullArgument occurrences="2">
248
  <MissingReturnType occurrences="1">
249
  <code>delete</code>
250
  </MissingReturnType>
 
 
 
251
  </file>
252
  <file src="modules/ppcp-api-client/src/Repository/ApplicationContextRepository.php">
253
  <PossiblyFalseArgument occurrences="1">
254
  <code>strrpos( $locale, '-' )</code>
255
  </PossiblyFalseArgument>
 
 
 
 
256
  </file>
257
  <file src="modules/ppcp-api-client/src/Repository/PayPalRequestIdRepository.php">
258
  <UndefinedConstant occurrences="1">
269
  </UndefinedConstant>
270
  </file>
271
  <file src="modules/ppcp-button/src/Assets/SmartButton.php">
 
 
 
272
  <MissingClosureParamType occurrences="1">
273
  <code>$id</code>
274
  </MissingClosureParamType>
396
  <PossiblyUndefinedMethod occurrences="1">
397
  <code>get_payment_method</code>
398
  </PossiblyUndefinedMethod>
 
 
 
 
 
 
 
399
  </file>
400
  <file src="modules/ppcp-onboarding/services.php">
401
  <MissingClosureParamType occurrences="1">
417
  <code>PAYPAL_SANDBOX_API_URL</code>
418
  </UndefinedConstant>
419
  </file>
 
 
 
 
 
 
 
420
  <file src="modules/ppcp-onboarding/src/OnboardingModule.php">
421
  <MissingClosureParamType occurrences="3">
422
  <code>$config</code>
480
  <code>getKey</code>
481
  </MissingReturnType>
482
  </file>
 
 
 
 
 
483
  <file src="modules/ppcp-subscription/src/RenewalHandler.php">
484
  <FalsableReturnStatement occurrences="1">
485
  <code>current( $tokens )</code>
488
  <code>process_order</code>
489
  <code>renew</code>
490
  </MissingReturnType>
 
 
 
 
491
  <TooManyArguments occurrences="1">
492
  <code>apply_filters( 'woocommerce_paypal_payments_subscriptions_get_token_for_customer', null, $customer, $wc_order )</code>
493
  </TooManyArguments>
510
  <PossiblyNullReference occurrences="1">
511
  <code>get</code>
512
  </PossiblyNullReference>
 
 
 
513
  </file>
514
  <file src="modules/ppcp-vaulting/services.php">
515
  <PossiblyFalseArgument occurrences="1">
639
  </PossiblyUndefinedVariable>
640
  </file>
641
  <file src="modules/ppcp-wc-gateway/src/Processor/AuthorizedPaymentsProcessor.php">
 
 
 
642
  <PossiblyNullReference occurrences="1">
643
  <code>authorizations</code>
644
  </PossiblyNullReference>
850
  <code>$request['resource']['custom_id']</code>
851
  <code>$request['resource']['id']</code>
852
  </PossiblyNullArrayAccess>
 
 
 
853
  </file>
854
  <file src="modules/ppcp-webhooks/src/IncomingWebhookEndpoint.php">
855
  <InvalidReturnStatement occurrences="2">
864
  <PossiblyNullArgument occurrences="1">
865
  <code>$request['event_type']</code>
866
  </PossiblyNullArgument>
 
867
  </file>
868
  <file src="src/services.php">
869
  <PossiblyFalseArgument occurrences="1">
psalm.xml.dist CHANGED
@@ -29,6 +29,7 @@
29
 
30
  <stubs>
31
  <file name=".psalm/stubs.php"/>
 
32
  <file name="vendor/php-stubs/wordpress-stubs/wordpress-stubs.php"/>
33
  <file name="vendor/php-stubs/woocommerce-stubs/woocommerce-stubs.php"/>
34
  </stubs>
29
 
30
  <stubs>
31
  <file name=".psalm/stubs.php"/>
32
+ <file name=".psalm/wcs.php"/>
33
  <file name="vendor/php-stubs/wordpress-stubs/wordpress-stubs.php"/>
34
  <file name="vendor/php-stubs/woocommerce-stubs/woocommerce-stubs.php"/>
35
  </stubs>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: woocommerce, paypal, payments, ecommerce, e-commerce, store, sales, sell,
4
  Requires at least: 5.3
5
  Tested up to: 5.9
6
  Requires PHP: 7.1
7
- Stable tag: 1.7.1
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -81,6 +81,17 @@ Follow the steps below to connect the plugin to your PayPal account:
81
 
82
  == Changelog ==
83
 
 
 
 
 
 
 
 
 
 
 
 
84
  = 1.7.1 =
85
  * Fix - Hide smart buttons for free products and zero-sum carts #499
86
  * Fix - Unprocessable Entity when paying with AMEX card #516
4
  Requires at least: 5.3
5
  Tested up to: 5.9
6
  Requires PHP: 7.1
7
+ Stable tag: 1.8.0
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
81
 
82
  == Changelog ==
83
 
84
+ = 1.8.0 =
85
+ * Add - Allow free trial subscriptions #580
86
+ * Fix - The Card Processing does not appear as an available payment method when manually creating an order #562
87
+ * Fix - Express buttons & Pay Later visible on variable Subscription products /w disabled vaulting #281
88
+ * Fix - Pay for order (guest) failing when no email address available #535
89
+ * Fix - Emoji in product description causing INVALID_STRING_LENGTH error #491
90
+ * Enhancement - Change cart total amount that is sent to PayPal gateway #486
91
+ * Enhancement - Include dark Visa and Mastercard gateway icon list for PayPal Card Processing #566
92
+ * Enhancement - Onboarding errors improvements #558
93
+ * Enhancement - "Place order" button visible during gateway load time when DCC gateway is selected as the default #560
94
+
95
  = 1.7.1 =
96
  * Fix - Hide smart buttons for free products and zero-sum carts #499
97
  * Fix - Unprocessable Entity when paying with AMEX card #516
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitd9d5a07d2a80f7ccbdaae9d6cdd2640f::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit16558e4f2223b33dd8a9ed3fc3028843::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitd9d5a07d2a80f7ccbdaae9d6cdd2640f
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInitd9d5a07d2a80f7ccbdaae9d6cdd2640f
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInitd9d5a07d2a80f7ccbdaae9d6cdd2640f', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
- spl_autoload_unregister(array('ComposerAutoloaderInitd9d5a07d2a80f7ccbdaae9d6cdd2640f', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
- call_user_func(\Composer\Autoload\ComposerStaticInitd9d5a07d2a80f7ccbdaae9d6cdd2640f::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
@@ -51,19 +51,19 @@ class ComposerAutoloaderInitd9d5a07d2a80f7ccbdaae9d6cdd2640f
51
  $loader->register(true);
52
 
53
  if ($useStaticLoader) {
54
- $includeFiles = Composer\Autoload\ComposerStaticInitd9d5a07d2a80f7ccbdaae9d6cdd2640f::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
- composerRequired9d5a07d2a80f7ccbdaae9d6cdd2640f($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
- function composerRequired9d5a07d2a80f7ccbdaae9d6cdd2640f($fileIdentifier, $file)
67
  {
68
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
69
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit16558e4f2223b33dd8a9ed3fc3028843
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInit16558e4f2223b33dd8a9ed3fc3028843', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit16558e4f2223b33dd8a9ed3fc3028843', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
+ call_user_func(\Composer\Autoload\ComposerStaticInit16558e4f2223b33dd8a9ed3fc3028843::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
51
  $loader->register(true);
52
 
53
  if ($useStaticLoader) {
54
+ $includeFiles = Composer\Autoload\ComposerStaticInit16558e4f2223b33dd8a9ed3fc3028843::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
+ composerRequire16558e4f2223b33dd8a9ed3fc3028843($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
+ function composerRequire16558e4f2223b33dd8a9ed3fc3028843($fileIdentifier, $file)
67
  {
68
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
69
  require $file;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInitd9d5a07d2a80f7ccbdaae9d6cdd2640f
8
  {
9
  public static $files = array (
10
  'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
@@ -172,9 +172,9 @@ class ComposerStaticInitd9d5a07d2a80f7ccbdaae9d6cdd2640f
172
  public static function getInitializer(ClassLoader $loader)
173
  {
174
  return \Closure::bind(function () use ($loader) {
175
- $loader->prefixLengthsPsr4 = ComposerStaticInitd9d5a07d2a80f7ccbdaae9d6cdd2640f::$prefixLengthsPsr4;
176
- $loader->prefixDirsPsr4 = ComposerStaticInitd9d5a07d2a80f7ccbdaae9d6cdd2640f::$prefixDirsPsr4;
177
- $loader->classMap = ComposerStaticInitd9d5a07d2a80f7ccbdaae9d6cdd2640f::$classMap;
178
 
179
  }, null, ClassLoader::class);
180
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit16558e4f2223b33dd8a9ed3fc3028843
8
  {
9
  public static $files = array (
10
  'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
172
  public static function getInitializer(ClassLoader $loader)
173
  {
174
  return \Closure::bind(function () use ($loader) {
175
+ $loader->prefixLengthsPsr4 = ComposerStaticInit16558e4f2223b33dd8a9ed3fc3028843::$prefixLengthsPsr4;
176
+ $loader->prefixDirsPsr4 = ComposerStaticInit16558e4f2223b33dd8a9ed3fc3028843::$prefixDirsPsr4;
177
+ $loader->classMap = ComposerStaticInit16558e4f2223b33dd8a9ed3fc3028843::$classMap;
178
 
179
  }, null, ClassLoader::class);
180
  }
woocommerce-paypal-payments.php CHANGED
@@ -3,13 +3,13 @@
3
  * Plugin Name: WooCommerce PayPal Payments
4
  * Plugin URI: https://woocommerce.com/products/woocommerce-paypal-payments/
5
  * Description: PayPal's latest complete payments processing solution. Accept PayPal, Pay Later, 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.
6
- * Version: 1.7.1
7
  * Author: WooCommerce
8
  * Author URI: https://woocommerce.com/
9
  * License: GPL-2.0
10
  * Requires PHP: 7.1
11
  * WC requires at least: 3.9
12
- * WC tested up to: 6.3
13
  * Text Domain: woocommerce-paypal-payments
14
  *
15
  * @package WooCommerce\PayPalCommerce
@@ -21,7 +21,7 @@ namespace WooCommerce\PayPalCommerce;
21
 
22
  define( 'PAYPAL_API_URL', 'https://api.paypal.com' );
23
  define( 'PAYPAL_SANDBOX_API_URL', 'https://api.sandbox.paypal.com' );
24
- define( 'PAYPAL_INTEGRATION_DATE', '2021-09-17' );
25
 
26
  define( 'PPCP_FLAG_SUBSCRIPTION', true );
27
 
3
  * Plugin Name: WooCommerce PayPal Payments
4
  * Plugin URI: https://woocommerce.com/products/woocommerce-paypal-payments/
5
  * Description: PayPal's latest complete payments processing solution. Accept PayPal, Pay Later, 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.
6
+ * Version: 1.8.0
7
  * Author: WooCommerce
8
  * Author URI: https://woocommerce.com/
9
  * License: GPL-2.0
10
  * Requires PHP: 7.1
11
  * WC requires at least: 3.9
12
+ * WC tested up to: 6.4
13
  * Text Domain: woocommerce-paypal-payments
14
  *
15
  * @package WooCommerce\PayPalCommerce
21
 
22
  define( 'PAYPAL_API_URL', 'https://api.paypal.com' );
23
  define( 'PAYPAL_SANDBOX_API_URL', 'https://api.sandbox.paypal.com' );
24
+ define( 'PAYPAL_INTEGRATION_DATE', '2022-04-13' );
25
 
26
  define( 'PPCP_FLAG_SUBSCRIPTION', true );
27