Skip to content

Commit af8c283

Browse files
committed
fix(api): remove refund support
1 parent 5518701 commit af8c283

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

admin/kkiapay-settings.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@
8585
'desc_tip' => true,
8686
'description' => __('When Kkiapay payment form is displayed directly on your site, you can choose the widget color (eg: red) according to your website colors. ', 'kkiapay-woocommerce')
8787
),
88-
'refund' => array(
89-
'title' => __('Refund', 'kkiapay-woocommerce'),
90-
'label' => __('Enable/Disable refund', 'kkiapay-woocommerce'),
91-
'default' => 'false',
92-
'type' => 'checkbox',
93-
'desc_tip' => true,
94-
'description' => __('Kkiapay does not support multiple refunds. This means that a refund for one order will refund the full amount to the customer.', 'kkiapay-woocommerce')
95-
)
88+
// 'refund' => array(
89+
// 'title' => __('Refund', 'kkiapay-woocommerce'),
90+
// 'label' => __('Enable/Disable refund', 'kkiapay-woocommerce'),
91+
// 'default' => 'false',
92+
// 'type' => 'checkbox',
93+
// 'desc_tip' => true,
94+
// 'description' => __('Kkiapay does not support multiple refunds. This means that a refund for one order will refund the full amount to the customer.', 'kkiapay-woocommerce')
95+
// )
9696

9797
);

includes/class-wc-kkiapay-gateway.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ class WC_Kkiapay_Gateway extends WC_Payment_Gateway
5050
*/
5151
public $msg;
5252

53-
/**
54-
* Is refund active?
55-
*
56-
* @var bool
57-
*/
58-
public $refund;
53+
// /**
54+
// * Is refund active?
55+
// *
56+
// * @var bool
57+
// */
58+
// public $refund;
5959

6060
/**
6161
* Protected constructor to prevent creating a new instance of the
@@ -78,7 +78,7 @@ public function __construct()
7878
'products',
7979
);
8080

81-
if ($this->refund === "yes") $this->supports[] = "refunds";
81+
// if ($this->refund === "yes") $this->supports[] = "refunds";
8282

8383
$this->init_form_fields();
8484

@@ -373,6 +373,7 @@ function on_kkiapay_webhook()
373373
$json = file_get_contents('php://input');
374374
$payload = json_decode($json);
375375

376+
376377
if (!$payload->stateData || !$payload->stateData->order_id || $payload->stateData->sdk !== "woocommerce") {
377378
return;
378379
}
@@ -382,13 +383,13 @@ function on_kkiapay_webhook()
382383
return;
383384
}
384385

385-
$stateData = $payload->stateData;
386-
$status = strtoupper(explode(".", $payload->event)[1]);
387-
388-
389386
require_once __DIR__ . '/class-kkiapay-gateway.php';
387+
$kkiapay = new KkiapayGateway($this->public_key, $this->private_key, $this->secret, $this->testmode);
388+
$response = $kkiapay->verifyTransaction($payload->transactionId);
389+
$status = $response->status;
390+
390391

391-
if ($status == STATUS::SUCCESS && $payload->amount >= $order->get_total()) {
392+
if ($status == STATUS::SUCCESS && $response->amount >= $order->get_total()) {
392393
$order->update_status('completed');
393394
$order->add_order_note(__('Payment was successful on Kkiapay', 'kkiapay-woocommerce'));
394395
$order->add_order_note('Kkiapay transaction Id: ' . $payload->transactionId);

kkiapay-woocomerce_v2.4.0.zip

-873 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)