Skip to content

Commit 45422ef

Browse files
Release v3.8.4
* [ADD] Developer options for checkout v4 API tests.
2 parents 404906d + 9f20e2a commit 45422ef

File tree

14 files changed

+295
-199
lines changed

14 files changed

+295
-199
lines changed

CODEOWNERS

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This is a comment.
2+
# Each line is a file pattern followed by one or more owners.
3+
4+
# These owners will be the default owners for everything in
5+
# the repo. Unless a later match takes precedence,
6+
# review when someone opens a pull request.
7+
# owner(s) will be requested for a review.
8+
Jenkinsfile @aplazame/squad_devops-reviewers
9+
DockerFile @aplazame/squad_devops-reviewers
10+
CODEOWNERS @aplazame/squad_devops-reviewers
11+
jenkins/ @aplazame/squad_devops-reviewers
12+
docker/DockerFile @aplazame/squad_devops-reviewers
13+
Makefile @aplazame/squad_devops-reviewers
14+
makefile @aplazame/squad_devops-reviewers
15+
node.yaml @aplazame/squad_devops-reviewers
16+
deploy.yaml @aplazame/squad_devops-reviewers
17+
build_dependencies.yaml @aplazame/squad_devops-reviewers
18+
build.yaml @aplazame/squad_devops-reviewers
19+
Dockerfile @aplazame/squad_devops-reviewers

HISTORY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## Change Log
22

3+
#### [v3.8.4](https://github.com/aplazame/woocommerce/tree/v3.8.4) (2023-12-05)
4+
5+
* [ADD] Developer options for checkout v4 API tests.
6+
37
#### [v3.8.3](https://github.com/aplazame/woocommerce/tree/v3.8.3) (2023-08-11)
48

59
* API improvements.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
plugin_path ?= plugin
22
i18n_path ?= i18n/languages
33
i18n_name ?= aplazame-es_ES
4-
version ?= v3.8.3
4+
version ?= v3.8.4
55
errors = $(shell find . -type f -name "*.php" -exec php -l "{}" \;| grep "Errors parsing ";)
66

77
clean:

composer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
"php": ">=5.2"
2424
},
2525
"require-dev": {
26-
"wp-coding-standards/wpcs": "dev-master"
26+
"wp-coding-standards/wpcs": "dev-main"
27+
},
28+
"config": {
29+
"allow-plugins": {
30+
"dealerdirect/phpcodesniffer-composer-installer": true
31+
}
2732
}
2833
}

phpcs.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<?xml version="1.0"?>
22
<ruleset name="Aplazame">
33
<file>plugin</file>
4-
5-
<config name="installed_paths" value="vendor/wp-coding-standards/wpcs"/>
6-
74
<rule ref="WordPress"/>
85
</ruleset>

plugin/README.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Tags: aplazame,woocommerce,ecommerce,payment,checkout,credit,aplazar,financiar,f
44
Requires at least: 4.0.1
55
Tested up to: 6.2.2
66
Requires PHP: 5.3.0
7-
Stable tag: 3.8.3
7+
Stable tag: 3.8.4
88
License: BSD-3-Clause
99
License URI: https://github.com/aplazame/woocommerce/blob/master/LICENSE
1010

@@ -77,6 +77,10 @@ Of course, simply select an *"Aplazame refund"* in the product detail.
7777

7878
== Changelog ==
7979

80+
#### [v3.8.4](https://github.com/aplazame/woocommerce/tree/v3.8.4) (2023-12-05)
81+
82+
* [ADD] Developer options for checkout v4 API tests.
83+
8084
#### [v3.8.3](https://github.com/aplazame/woocommerce/tree/v3.8.3) (2023-08-11)
8185

8286
* API improvements.

plugin/aplazame.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
* Plugin Name: Aplazame
44
* Plugin URI: https://github.com/aplazame/woocommerce
5-
* Version: 3.8.3
5+
* Version: 3.8.4
66
* Description: Aplazame offers a payment method to receive funding for the purchases.
77
* Author: Aplazame
88
* Author URI: https://aplazame.com
@@ -25,10 +25,15 @@
2525
require_once 'lib/Aplazame/Aplazame/autoload.php';
2626

2727
class WC_Aplazame {
28-
const VERSION = '3.8.3';
28+
const VERSION = '3.8.4';
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,6 +347,7 @@ class WC_Aplazame_Install {
342347
'cart_downpayment_info' => 'yes',
343348
'product_widget_max_desired' => 'no',
344349
'cart_widget_max_desired' => 'no',
350+
'checkout_v4' => 'no',
345351
);
346352

347353
public static function upgrade() {

plugin/classes/sdk/Client.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,13 @@ 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 ) {
82-
return $this->request( 'POST', '/checkout', $payload, 3 );
81+
public function create_checkout( $payload, $checkout_v4 ) {
82+
return $this->request(
83+
'POST',
84+
'/checkout',
85+
$payload,
86+
$checkout_v4 === 'yes' ? 4 : 3
87+
);
8388
}
8489

8590
/**

plugin/classes/wc-aplazame-gateway.php

Lines changed: 25 additions & 3 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 );
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

-41 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)