Skip to content

Commit

Permalink
feat(LED-33): update LCO settings (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
perjo927 authored Feb 1, 2023
1 parent 523200d commit 16605a9
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 16 deletions.
3 changes: 3 additions & 0 deletions changelog.readme
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.4.0
Feature: Allow custom shipping address contact details in settings

## 1.3.1
* Fix: Testmode patch and separate test token

Expand Down
8 changes: 8 additions & 0 deletions classes/class-ledyer-fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ public static function fields() {
'default' => 'no',
'desc_tip' => true,
),
'show_shipping_address_contact' => array(
'title' => __( 'Show custom shipping address contact details', 'ledyer-checkout-for-woocommerce' ),
'label' => __( 'Allow customer to enter a different shipping address order recipient', 'ledyer-checkout-for-woocommerce' ),
'type' => 'checkbox',
'description' => __( 'If checked, the customer will be able to enter different shipping address recipient details in the checkout iframe.', 'ledyer-checkout-for-woocommerce' ),
'default' => 'no',
'desc_tip' => true,
),
'customer_show_name_fields' => array(
'title' => __( 'Show name fields', 'ledyer-checkout-for-woocommerce' ),
'label' => __( 'Allow customer to enter name', 'ledyer-checkout-for-woocommerce' ),
Expand Down
2 changes: 1 addition & 1 deletion classes/class-ledyer-main.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Ledyer_Checkout_For_WooCommerce {
*/
public $checkout;

const VERSION = '1.3.1';
const VERSION = '1.4.0';
const SLUG = 'ledyer-checkout-for-woocommerce';
const SETTINGS = 'ledyer_checkout_for_woocommerce_settings';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ private static function set_order_settings( $full = true ) {
'customer' => array(
'showNameFields' => 'yes' === ledyer()->get_setting('customer_show_name_fields'),
'allowShippingAddress' => 'yes' === ledyer()->get_setting('allow_custom_shipping'),
'showShippingAddressContact' => 'yes' === ledyer()->get_setting('show_shipping_address_contact'),
),
'urls' => array(
'terms' => $merchant_urls['terms'],
Expand Down
28 changes: 16 additions & 12 deletions includes/lco-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function lco_create_or_update_order() {

if ( WC()->session->get( 'lco_wc_order_id' )
&& $old_ledyer_settings['allow_custom_shipping'] === ledyer()->get_setting( 'allow_custom_shipping' )
&& $old_ledyer_settings['show_shipping_address_contact'] === ledyer()->get_setting( 'show_shipping_address_contact' )
&& $old_ledyer_settings['customer_show_name_fields'] === ledyer()->get_setting( 'customer_show_name_fields' )
&& $old_ledyer_settings['terms_url'] === ledyer()->get_setting( 'terms_url' )
&& $old_ledyer_settings['privacy_url'] === ledyer()->get_setting( 'privacy_url' ) ) {
Expand Down Expand Up @@ -50,10 +51,11 @@ function lco_create_or_update_order() {
WC()->session->set( 'lco_wc_session_id', $ledyer_order['sessionId'] );
WC()->session->set( 'lco_wc_order_id', $ledyer_order['orderId'] );
WC()->session->set( 'lco_wc_settings', array(
'allow_custom_shipping' => ledyer()->get_setting( 'allow_custom_shipping' ),
'customer_show_name_fields' => ledyer()->get_setting( 'customer_show_name_fields' ),
'terms_url' => ledyer()->get_setting( 'terms_url' ),
'privacy_url' => ledyer()->get_setting( 'privacy_url' ),
'allow_custom_shipping' => ledyer()->get_setting( 'allow_custom_shipping' ),
'show_shipping_address_contact' => ledyer()->get_setting( 'show_shipping_address_contact' ),
'customer_show_name_fields' => ledyer()->get_setting( 'customer_show_name_fields' ),
'terms_url' => ledyer()->get_setting( 'terms_url' ),
'privacy_url' => ledyer()->get_setting( 'privacy_url' ),
) );

return $ledyer_order;
Expand All @@ -63,10 +65,11 @@ function lco_create_or_update_order() {
WC()->session->set( 'lco_wc_session_id', $ledyer_order['sessionId'] );
WC()->session->set( 'lco_wc_order_id', $ledyer_order['orderId'] );
WC()->session->set( 'lco_wc_settings', array(
'allow_custom_shipping' => ledyer()->get_setting( 'allow_custom_shipping' ),
'customer_show_name_fields' => ledyer()->get_setting( 'customer_show_name_fields' ),
'terms_url' => ledyer()->get_setting( 'terms_url' ),
'privacy_url' => ledyer()->get_setting( 'privacy_url' ),
'allow_custom_shipping' => ledyer()->get_setting( 'allow_custom_shipping' ),
'show_shipping_address_contact' => ledyer()->get_setting( 'show_shipping_address_contact' ),
'customer_show_name_fields' => ledyer()->get_setting( 'customer_show_name_fields' ),
'terms_url' => ledyer()->get_setting( 'terms_url' ),
'privacy_url' => ledyer()->get_setting( 'privacy_url' ),
) );
}
}
Expand All @@ -90,10 +93,11 @@ function lco_create_or_update_order() {
WC()->session->set( 'lco_wc_session_id', $ledyer_order['sessionId'] );
WC()->session->set( 'lco_wc_order_id', $ledyer_order['orderId'] );
WC()->session->set( 'lco_wc_settings', array(
'allow_custom_shipping' => ledyer()->get_setting( 'allow_custom_shipping' ),
'customer_show_name_fields' => ledyer()->get_setting( 'customer_show_name_fields' ),
'terms_url' => ledyer()->get_setting( 'terms_url' ),
'privacy_url' => ledyer()->get_setting( 'privacy_url' ),
'allow_custom_shipping' => ledyer()->get_setting( 'allow_custom_shipping' ),
'show_shipping_address_contact' => ledyer()->get_setting( 'show_shipping_address_contact' ),
'customer_show_name_fields' => ledyer()->get_setting( 'customer_show_name_fields' ),
'terms_url' => ledyer()->get_setting( 'terms_url' ),
'privacy_url' => ledyer()->get_setting( 'privacy_url' ),
) );

return $ledyer_order;
Expand Down
2 changes: 1 addition & 1 deletion languages/ledyer-checkout-for-woocommerce.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is distributed under the same license as the Ledyer Checkout for WooCommerce plugin.
msgid ""
msgstr ""
"Project-Id-Version: Ledyer Checkout for WooCommerce 1.2.1\n"
"Project-Id-Version: Ledyer Checkout for WooCommerce 1.4.0\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/ledyer-checkout-for-woocommerce\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion ledyer-checkout-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Ledyer Checkout payment gateway for WooCommerce.
* Author: Maksimer/Ledyer
* Author URI: https://www.maksimer.com/
* Version: 1.3.1
* Version: 1.4.0
* Text Domain: ledyer-checkout-for-woocommerce
* Domain Path: /languages
*
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ Tested up to: 8.1.11
Requires PHP: 7.0
WC requires at least: 4.0.0
WC tested up to: 6.9.3
Stable tag: 1.3.1
Stable tag: 1.4.0
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html

0 comments on commit 16605a9

Please sign in to comment.