Skip to content

Commit 001500c

Browse files
checkout v4 dev param renamed and tweaks
1 parent e660799 commit 001500c

File tree

5 files changed

+25
-9
lines changed

5 files changed

+25
-9
lines changed

plugin/aplazame.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ class WC_Aplazame {
2929
const METHOD_ID = 'aplazame';
3030
const METHOD_TITLE = 'Aplazame';
3131

32+
/**
33+
* @var mixed
34+
*/
35+
private $private_api_key;
36+
3237
public static function _m_or_a( $obj, $method, $attribute ) {
3338
if ( method_exists( $obj, $method ) ) {
3439
return $obj->$method();
@@ -342,7 +347,7 @@ class WC_Aplazame_Install {
342347
'cart_downpayment_info' => 'yes',
343348
'product_widget_max_desired' => 'no',
344349
'cart_widget_max_desired' => 'no',
345-
'v4' => 'no',
350+
'checkout_v4' => 'no',
346351
);
347352

348353
public static function upgrade() {

plugin/classes/sdk/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ public function refund( $order_id, $amount ) {
7878
* @throws Aplazame_Sdk_Api_ApiClientException if an I/O error occurs.
7979
* @throws Aplazame_Sdk_Api_ApiServerException if request is invalid.
8080
*/
81-
public function create_checkout( $payload, $v4 ) {
81+
public function create_checkout( $payload, $checkout_v4 ) {
8282
return $this->request(
8383
'POST',
8484
'/checkout',
8585
$payload,
86-
$v4 === 'yes' ? 4 : 3
86+
$checkout_v4 === 'yes' ? 4 : 3
8787
);
8888
}
8989

plugin/classes/wc-aplazame-gateway.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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, $aplazame->settings['v4'] );
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,12 +464,14 @@ 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
458469
'dev_section' => array(
459470
'title' => __( 'Developer Settings (WARNING: DO NOT TOUCH IF NOT NECESSARY)', 'aplazame' ),
460471
'type' => 'title',
461472
'description' => '',
462473
),
463-
'v4' => array(
474+
'checkout_v4' => array(
464475
'type' => 'checkbox',
465476
'title' => __( 'Checkout v4', 'aplazame' ),
466477
'description' => __( 'Use v4 checkout API', 'aplazame' ),

plugin/lib/Aplazame/Aplazame/autoload.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
$baseDir = dirname( __FILE__ );
3+
$baseDir = __DIR__;
44

55
require $baseDir . '/Api/BusinessModel/Article.php';
66
require $baseDir . '/Api/BusinessModel/HistoricalOrder.php';

plugin/lib/Aplazame/Sdk/autoload.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
$baseDir = dirname( __FILE__ );
3+
$baseDir = __DIR__;
44

55
require $baseDir . '/Http/ClientInterface.php';
66
require $baseDir . '/Http/RequestInterface.php';

0 commit comments

Comments
 (0)