Jake Vanderwerf
2026-06-29 4089ba01e0881c89a72332e13bc3a80b6bddec2a
inc/integrations/Square.php
@@ -1941,6 +1941,7 @@
    */
   public function enqueueScripts(): void
   {
      jvbInlineStyles('forms');
      $this->loadCredentials();
      $sdk_url = $this->environment === 'production'
         ? 'https://web.squarecdn.com/v1/square.js'
@@ -1958,8 +1959,8 @@
      wp_register_script(
         'jvb-checkout',
         JVB_URL . 'assets/js/min/checkout.min.js',
         ['jvb-utility', 'jvb-queue', 'jvb-a11y', 'jvb-cache', 'jvb-tabs', 'jvb-popup'],
         '1.1.31',
         ['jvb-utility', 'jvb-queue', 'jvb-a11y', 'jvb-cache', 'jvb-tabs', 'jvb-popup', 'jvb-login'],
         '1.1.32',
         ['strategy' => 'defer', 'in_footer' => true]
      );
@@ -1968,7 +1969,7 @@
         'jvb-square-checkout',
         JVB_URL . 'assets/js/min/square.min.js',
         ['jvb-checkout', 'square-payments-sdk'],
         '1.1.31',
         '1.1.32',
         ['strategy' => 'defer', 'in_footer' => true]
      );
@@ -1979,8 +1980,6 @@
         'application_id' => $this->credentials['client_id'] ?? '',
         'location_id'    => $this->locationId,
         'environment'    => $this->environment,
         'api_url'        => rest_url('jvb/v1/square/'),
         'nonce'          => wp_create_nonce('wp_rest'),
         'currency'       => get_option(BASE . 'currency', 'CAD'),
         'is_logged_in'   => is_user_logged_in(),
         'user_email'     => is_user_logged_in() ? wp_get_current_user()->user_email : '',
@@ -2729,6 +2728,9 @@
      ];
   }
   public function getAdditionalFields(?string $content_type = null):array {
      if ($content_type === 'customer') {
         return $this->getCustomerFields();
      }
      if ($content_type && array_key_exists($content_type, $this->contentTypes)){
         $array = $this->contentTypes[$content_type];
         return array_combine(
@@ -2745,6 +2747,52 @@
            $array
        );
   }
   protected function getCustomerFields():array
   {
      return [
         'customer_id'  => [
            'type'   => 'text',
            'label'  => 'Square Customer ID',
            'hidden'=> true,
         ],
         'address_line_1'  => [
            'type'   => 'text',
            'label'  => 'Address Line 1',
            'hint'   => 'ex: 6551 111 St NW',
            'required'  => true,
            'section'   => 'about'
         ],
         'address_line_2'  => [
            'type'   => 'text',
            'label'  => 'Address Line 2',
            'hint'   => 'ex: Unit 2',
            'section'   => 'about'
         ],
         'city'   => [
            'type'   => 'text',
            'label'=> 'City',
            'section'   => 'about',
            'required'  => true,
         ],
         'state' => [
            'type'   => 'text',
            'label' => 'Province',
            'hint' => 'The two-character code, example: AB',
            'default'=> 'AB',
            'section'   => 'about',
            'required'  => true,
         ],
         'countryCode'  => [
            'type'   => 'text',
            'label'  => 'Country Code',
            'hint'   => 'The tw-character country code, example: CA',
            'default'   => 'CA',
            'section'   => 'about',
            'required'  => true,
         ]
      ];
   }
   protected function setBaseFields():array
   {
      return [