Plugin Directory

Changeset 2723212


Ignore:
Timestamp:
05/13/2022 08:25:48 AM (4 years ago)
Author:
kinguin
Message:

Fixed incorrect response code for API webhooks and changed order of settings fields

Location:
kinguin/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • kinguin/trunk/README.txt

    r2720754 r2723212  
    55Requires at least: 5.0
    66Tested up to: 6.0
    7 Stable tag: 1.0.2
     7Stable tag: 1.0.3
    88Requires PHP: 7.0
    99License: GPLv2
     
    5353== Changelog ==
    5454
     55= 1.0.3 =
     56* Fixed incorrect response code for webhooks.
     57* Changed order of setting fields to match order in API client area.
     58
    5559= 1.0.2 =
    5660* Added the necessary stylesheets and scripts.
  • kinguin/trunk/kinguin.php

    r2720754 r2723212  
    44    Description: Import over 70,000 digital products to your online store, including video games, software, gift cards and in-game content.
    55    Product: Kinguin
    6     Version: 1.0.2
     6    Version: 1.0.3
    77    Author: iLabs.dev
    88    Author URI: https://ilabs.dev/
     
    3434
    3535/* THESE TWO VARIABLES CAN BE CHANGED AUTOMATICALLY */
    36 $plugin_version     = '1.0.2';
     36$plugin_version     = '1.0.3';
    3737
    3838$plugin_name        = 'Kinguin';
  • kinguin/trunk/src/Plugin/Admin/SettingsPage.php

    r2712632 r2723212  
    107107        );
    108108
     109        register_setting( 'kinguin_settings', 'kinguin_products_webhook_secret' );
     110
     111        add_settings_field(
     112            'kinguin_products_webhook_secret',
     113            __( 'Products Webhook', 'kinguin' ),
     114            function() {
     115                ?>
     116                <div style="margin-bottom: 5px;">
     117                    <input id="kinguin_products_webhook_url" class="regular-text" type="text" value="<?php echo esc_attr( get_rest_url( null, '/kinguin/v1/products/update' ) ) ?>" readonly>
     118                </div>
     119                <label for="kinguin_products_webhook_url">
     120                    <?php esc_html_e( 'Webhook Url', 'kinguin' ); ?>
     121                </label>
     122                <p class="description" style="margin-bottom: 15px;">
     123                    <?php esc_html_e( 'Copy Webhook Url into Product Update webhook url field within your Kinguin store configuration.', 'kinguin' ); ?>
     124                </p>
     125                <div style="margin-bottom: 5px;">
     126                    <input class="regular-text" id="kinguin_products_webhook_secret" name="kinguin_products_webhook_secret" type="text" value="<?php echo esc_attr( $this->get_products_webhook_secret() ); ?>">
     127                </div>
     128                <label for="kinguin_products_webhook_secret">
     129                    <?php esc_html_e( 'Secret', 'kinguin' ); ?>
     130                </label>
     131                <p class="description">
     132                    <?php esc_html_e( 'Copy Webhook Secret into Product Update secret field within your Kinguin store configuration.', 'kinguin' ); ?>
     133                </p>
     134                <?php
     135            },
     136            'kinguin_settings',
     137            'kinguin_settings'
     138        );
     139
    109140        register_setting( 'kinguin_settings', 'kinguin_orders_webhook_secret' );
    110141
     
    138169        );
    139170
    140         register_setting( 'kinguin_settings', 'kinguin_products_webhook_secret' );
    141 
    142         add_settings_field(
    143             'kinguin_products_webhook_secret',
    144             __( 'Products Webhook', 'kinguin' ),
    145             function() {
    146                 ?>
    147                 <div style="margin-bottom: 5px;">
    148                     <input id="kinguin_products_webhook_url" class="regular-text" type="text" value="<?php echo esc_attr( get_rest_url( null, '/kinguin/v1/products/update' ) ) ?>" readonly>
    149                 </div>
    150                 <label for="kinguin_products_webhook_url">
    151                     <?php esc_html_e( 'Webhook Url', 'kinguin' ); ?>
    152                 </label>
    153                 <p class="description" style="margin-bottom: 15px;">
    154                     <?php esc_html_e( 'Copy Webhook Url into Product Update webhook url field within your Kinguin store configuration.', 'kinguin' ); ?>
    155                 </p>
    156                 <div style="margin-bottom: 5px;">
    157                     <input class="regular-text" id="kinguin_products_webhook_secret" name="kinguin_products_webhook_secret" type="text" value="<?php echo esc_attr( $this->get_products_webhook_secret() ); ?>">
    158                 </div>
    159                 <label for="kinguin_products_webhook_secret">
    160                     <?php esc_html_e( 'Secret', 'kinguin' ); ?>
    161                 </label>
    162                 <p class="description">
    163                     <?php esc_html_e( 'Copy Webhook Secret into Product Update secret field within your Kinguin store configuration.', 'kinguin' ); ?>
    164                 </p>
    165                 <?php
    166             },
    167             'kinguin_settings',
    168             'kinguin_settings'
    169         );
    170171
    171172        register_setting( 'kinguin_settings', 'kinguin_email_message' );
  • kinguin/trunk/src/Plugin/Common/OrderWebHook.php

    r2712632 r2723212  
    7171        }
    7272
    73         return new \WP_REST_Response( $response );
     73        return new \WP_REST_Response( $response ? $response : null, 204 );
    7474    }
    7575
  • kinguin/trunk/src/Plugin/Common/ProductWebHook.php

    r2712632 r2723212  
    6969        }
    7070
    71         return new \WP_REST_Response( $response );
     71        return new \WP_REST_Response( $response ? $response : null, 204 );
    7272    }
    7373
Note: See TracChangeset for help on using the changeset viewer.