@@ -53,8 +53,8 @@ public function get_icon() {
5353
5454 public function is_available () {
5555 if ( ( $ this ->enabled === 'no ' ) ||
56- ( ! $ this ->settings ['public_api_key ' ] ) ||
57- ( ! $ this ->settings ['private_api_key ' ] )
56+ ( ! $ this ->settings ['public_api_key ' ] ) ||
57+ ( ! $ this ->settings ['private_api_key ' ] )
5858 ) {
5959 return false ;
6060 }
@@ -101,7 +101,7 @@ public function checkout( $order_id ) {
101101
102102 $ client = $ aplazame ->get_client ();
103103 try {
104- $ aplazame_payload = $ client ->create_checkout ( $ payload );
104+ $ aplazame_payload = $ client ->create_checkout ( $ payload, $ aplazame -> settings [ ' checkout_v4 ' ] );
105105 } catch ( Aplazame_Sdk_Api_AplazameExceptionInterface $ e ) {
106106 $ message = $ e ->getMessage ();
107107 $ aOrder = $ client ->fetch ( $ payload ->order ->id );
@@ -193,8 +193,11 @@ public function checks() {
193193 }
194194 }
195195
196+ // Settings form
196197 public function init_form_fields () {
197198 $ this ->form_fields = array (
199+
200+ // Base settings
198201 'enabled ' => array (
199202 'type ' => 'checkbox ' ,
200203 'title ' => __ ( 'Enable/Disable ' , 'aplazame ' ),
@@ -252,6 +255,8 @@ public function init_form_fields() {
252255 'required ' => '' ,
253256 ),
254257 ),
258+
259+ // Product widget settings
255260 'product_widget_section ' => array (
256261 'title ' => __ ( 'Product widget ' , 'woocommerce ' ),
257262 'type ' => 'title ' ,
@@ -358,6 +363,8 @@ public function init_form_fields() {
358363 'required ' => '' ,
359364 ),
360365 ),
366+
367+ // Cart widget settings
361368 'cart_widget_section ' => array (
362369 'title ' => __ ( 'Cart widget ' , 'woocommerce ' ),
363370 'type ' => 'title ' ,
@@ -435,6 +442,8 @@ public function init_form_fields() {
435442 ),
436443 'default ' => WC_Aplazame_Install::$ defaultSettings ['cart_widget_align ' ],
437444 ),
445+
446+ // Button settings
438447 'button_section ' => array (
439448 'title ' => __ ( 'Button ' , 'aplazame ' ),
440449 'type ' => 'title ' ,
@@ -455,6 +464,19 @@ public function init_form_fields() {
455464 'description ' => __ ( 'Aplazame Button Image that you want to show ' , 'aplazame ' ),
456465 'placeholder ' => WC_Aplazame_Install::$ defaultSettings ['button_image ' ],
457466 ),
467+
468+ // Developer settings
469+ 'dev_section ' => array (
470+ 'title ' => __ ( 'Developer Settings (WARNING: DO NOT TOUCH IF NOT NECESSARY) ' , 'aplazame ' ),
471+ 'type ' => 'title ' ,
472+ 'description ' => '' ,
473+ ),
474+ 'checkout_v4 ' => array (
475+ 'type ' => 'checkbox ' ,
476+ 'title ' => __ ( 'Checkout v4 ' , 'aplazame ' ),
477+ 'description ' => __ ( 'Use v4 checkout API ' , 'aplazame ' ),
478+ 'label ' => __ ( 'Turn on v4 checkout API ' , 'aplazame ' ),
479+ ),
458480 );
459481 }
460482
0 commit comments