diff --git a/woo-doku-jokul/Block/DokuCheckoutBlock.php b/woo-doku-jokul/Block/DokuCheckoutBlock.php index 53b08a4..e085045 100644 --- a/woo-doku-jokul/Block/DokuCheckoutBlock.php +++ b/woo-doku-jokul/Block/DokuCheckoutBlock.php @@ -5,11 +5,11 @@ final class Doku_Checkout_Blocks extends AbstractPaymentMethodType { private $gateway; - protected $name = 'jokul_checkout'; + protected $name = 'doku_checkout'; public function initialize() { - $this->settings = get_option('woocommerce_jokul_gateway_settings'); - $this->gateway = new JokulCheckoutModule(); + $this->settings = get_option('woocommerce_doku_gateway_settings'); + $this->gateway = new DokuCheckoutModule(); } public function is_active() { diff --git a/woo-doku-jokul/Common/JokulConfig.php b/woo-doku-jokul/Common/JokulConfig.php index 6ca75d1..ddb8f2d 100644 --- a/woo-doku-jokul/Common/JokulConfig.php +++ b/woo-doku-jokul/Common/JokulConfig.php @@ -2,7 +2,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; -class JokulConfig { +class DokuConfig { const SANDBOX_BASE_URL = 'https://api-sandbox.doku.com'; const PRODUCTION_BASE_URL = 'https://api.doku.com'; @@ -12,7 +12,7 @@ class JokulConfig { */ public function getBaseUrl($state) { - return $state ? JokulConfig::PRODUCTION_BASE_URL : JokulConfig::SANDBOX_BASE_URL; + return $state ? DokuConfig::PRODUCTION_BASE_URL : DokuConfig::SANDBOX_BASE_URL; } } diff --git a/woo-doku-jokul/Common/JokulDb.php b/woo-doku-jokul/Common/JokulDb.php index 6c5afbe..6b228bd 100644 --- a/woo-doku-jokul/Common/JokulDb.php +++ b/woo-doku-jokul/Common/JokulDb.php @@ -2,7 +2,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; -class JokulDb { +class DokuDB { function addData($datainsert) { global $wpdb; diff --git a/woo-doku-jokul/Common/JokulUtils.php b/woo-doku-jokul/Common/JokulUtils.php index b77ea32..456c1cf 100644 --- a/woo-doku-jokul/Common/JokulUtils.php +++ b/woo-doku-jokul/Common/JokulUtils.php @@ -4,7 +4,7 @@ define("DOKU_PAYMENT_HTML_EMAIL_HEADERS", array('Content-Type: text/html; charset=UTF-8')); -class JokulUtils +class DokuUtils { public function generateSignatureCheckStatus($headers, $secret) { diff --git a/woo-doku-jokul/Form/JokulAlfaO2OSetting.php b/woo-doku-jokul/Form/JokulAlfaO2OSetting.php deleted file mode 100644 index 73768c8..0000000 --- a/woo-doku-jokul/Form/JokulAlfaO2OSetting.php +++ /dev/null @@ -1,28 +0,0 @@ - array( - 'title' => __('Payment Channel Display Name', 'doku-payment'), - 'type' => 'text', - 'description' => __('Default : Alfamart', 'doku-payment'), - 'placeholder' => 'Alfamart', - ), - 'payment_description' => array( - 'title' => __('Payment Description', 'doku-payment'), - 'type' => 'textarea', - 'css' => 'width: 400px;', - 'description' => __('Change your payment description for payment using Alfamart', 'doku-payment'), - 'placeholder' => 'Bayar pesanan dengan transfer melalui Alfamart', - ), - 'footer_message' => array( - 'title' => __('Footer Message', 'doku-payment'), - 'type' => 'text', - 'description' => __('Change your footer message for payment using Alfamart', 'doku-payment'), - 'placeholder' => 'ex: Call Center 021 555-0525', - ) - ) -); diff --git a/woo-doku-jokul/Form/JokulBcaVaSetting.php b/woo-doku-jokul/Form/JokulBcaVaSetting.php deleted file mode 100644 index dfe8520..0000000 --- a/woo-doku-jokul/Form/JokulBcaVaSetting.php +++ /dev/null @@ -1,22 +0,0 @@ - array( - 'title' => __('Payment Channel Display Name', 'doku-payment'), - 'type' => 'text', - 'description' => __('Default : BCA VA', 'doku-payment'), - 'placeholder' => 'BCA VA', - ), - 'payment_description' => array( - 'title' => __('Payment Description', 'doku-payment'), - 'type' => 'textarea', - 'css' => 'width: 400px;', - 'description' => __('Change your payment description for BCA VA', 'doku-payment'), - 'placeholder' => 'Bayar pesanan dengan transfer dari BCA', - ) - ) -); diff --git a/woo-doku-jokul/Form/JokulBriVaSetting.php b/woo-doku-jokul/Form/JokulBriVaSetting.php deleted file mode 100644 index c100ea6..0000000 --- a/woo-doku-jokul/Form/JokulBriVaSetting.php +++ /dev/null @@ -1,22 +0,0 @@ - array( - 'title' => __('Payment Channel Display Name', 'doku-payment'), - 'type' => 'text', - 'description' => __('Default : Bank Rakyat Indonesia VA', 'doku-payment'), - 'placeholder' => 'Bank Rakyat Indonesia VA', - ), - 'payment_description' => array( - 'title' => __('Payment Description', 'doku-payment'), - 'type' => 'textarea', - 'css' => 'width: 400px;', - 'description' => __('Change your payment description for Bank Rakyat Indonesia VA', 'doku-payment'), - 'placeholder' => 'Bayar pesanan dengan transfer Bank Rakyat Indonesia VA', - ) - ) -); diff --git a/woo-doku-jokul/Form/JokulBsmVaSetting.php b/woo-doku-jokul/Form/JokulBsmVaSetting.php deleted file mode 100644 index be7858a..0000000 --- a/woo-doku-jokul/Form/JokulBsmVaSetting.php +++ /dev/null @@ -1,22 +0,0 @@ - array( - 'title' => __('Payment Channel Display Name', 'doku-payment'), - 'type' => 'text', - 'description' => __('Default : Bank Syariah Indonesia VA', 'doku-payment'), - 'placeholder' => 'Bank Syariah Indonesia VA', - ), - 'payment_description' => array( - 'title' => __('Payment Description', 'doku-payment'), - 'type' => 'textarea', - 'css' => 'width: 400px;', - 'description' => __('Change your payment description for Bank Syariah Indonesia VA', 'doku-payment'), - 'placeholder' => 'Bayar pesanan dengan transfer Bank Syariah Indonesia VA', - ) - ) -); diff --git a/woo-doku-jokul/Form/JokulCheckoutSetting.php b/woo-doku-jokul/Form/JokulCheckoutSetting.php index eb3ace6..2b1ba25 100644 --- a/woo-doku-jokul/Form/JokulCheckoutSetting.php +++ b/woo-doku-jokul/Form/JokulCheckoutSetting.php @@ -3,7 +3,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; return apply_filters( - 'jokul_checkout_settings', + 'doku_checkout_settings', array( 'channel_name' => array( 'title' => __('Payment Channel Display Name', 'doku-payment'), diff --git a/woo-doku-jokul/Form/JokulCreditCardSetting.php b/woo-doku-jokul/Form/JokulCreditCardSetting.php index 19eed63..aeb3d53 100644 --- a/woo-doku-jokul/Form/JokulCreditCardSetting.php +++ b/woo-doku-jokul/Form/JokulCreditCardSetting.php @@ -3,7 +3,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; return apply_filters( - 'jokul_credit_card_settings', + 'doku_credit_card_settings', array( 'channel_name' => array( 'title' => __('Payment Channel Display Name', 'doku-payment'), diff --git a/woo-doku-jokul/Form/JokulDokuVaSetting.php b/woo-doku-jokul/Form/JokulDokuVaSetting.php deleted file mode 100644 index a7b22bf..0000000 --- a/woo-doku-jokul/Form/JokulDokuVaSetting.php +++ /dev/null @@ -1,23 +0,0 @@ - array( - 'title' => __('Payment Channel Display Name', 'doku-payment'), - 'type' => 'text', - 'description' => __('Default : Other Banks (VA by DOKU)', 'doku-payment'), - 'placeholder' => 'Other Banks (VA by DOKU)', - ), - 'payment_description' => array( - 'title' => __('Payment Description', 'doku-payment'), - 'type' => 'textarea', - 'css' => 'width: 400px;', - 'description' => __('Change your payment description for DOKU VA', 'doku-payment'), - 'placeholder' => 'Bayar pesanan dengan transfer dari bank lain', - ) - ) -); - diff --git a/woo-doku-jokul/Form/JokulMandiriVaSetting.php b/woo-doku-jokul/Form/JokulMandiriVaSetting.php deleted file mode 100644 index 02656b9..0000000 --- a/woo-doku-jokul/Form/JokulMandiriVaSetting.php +++ /dev/null @@ -1,22 +0,0 @@ - array( - 'title' => __('Payment Channel Display Name', 'doku-payment'), - 'type' => 'text', - 'description' => __('Default : Bank Mandiri VA', 'doku-payment'), - 'placeholder' => 'Bank Mandiri VA', - ), - 'payment_description' => array( - 'title' => __('Payment Description', 'doku-payment'), - 'type' => 'textarea', - 'css' => 'width: 400px;', - 'description' => __('Change your payment description for Bank Mandiri VA', 'doku-payment'), - 'placeholder' => 'Bayar pesanan dengan transfer dari Bank Mandiri', - ) - ) -); diff --git a/woo-doku-jokul/Form/JokulPermataVaSetting.php b/woo-doku-jokul/Form/JokulPermataVaSetting.php deleted file mode 100644 index 30ed7ca..0000000 --- a/woo-doku-jokul/Form/JokulPermataVaSetting.php +++ /dev/null @@ -1,22 +0,0 @@ - array( - 'title' => __('Payment Channel Display Name', 'doku-payment'), - 'type' => 'text', - 'description' => __('Default : Bank Permata VA', 'doku-payment'), - 'placeholder' => 'Bank Permata VA', - ), - 'payment_description' => array( - 'title' => __('Payment Description', 'doku-payment'), - 'type' => 'textarea', - 'css' => 'width: 400px;', - 'description' => __('Change your payment description for Bank Permata VA', 'doku-payment'), - 'placeholder' => 'Bayar pesanan dengan transfer dari Bank Permata', - ) - ) -); diff --git a/woo-doku-jokul/Form/JokulPgSetting.php b/woo-doku-jokul/Form/JokulPgSetting.php index 0c01c53..508872f 100644 --- a/woo-doku-jokul/Form/JokulPgSetting.php +++ b/woo-doku-jokul/Form/JokulPgSetting.php @@ -3,7 +3,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; return apply_filters( - 'jokul_payment_gateway_settings', + 'doku_gateway_settings', array( 'enabled' => array( 'title' => __('Enable :', 'doku-payment'), diff --git a/woo-doku-jokul/Js/checkout.js b/woo-doku-jokul/Js/checkout.js index e6f7d66..d3fb087 100644 --- a/woo-doku-jokul/Js/checkout.js +++ b/woo-doku-jokul/Js/checkout.js @@ -1,10 +1,10 @@ -const settings = window.wc.wcSettings.getSetting( 'jokul_checkout_data', {} ); -const label = window.wp.htmlEntities.decodeEntities( settings.title ) || window.wp.i18n.__( 'DOKU', 'jokul_checkout' ); +const settings = window.wc.wcSettings.getSetting( 'doku_checkout_data', {} ); +const label = window.wp.htmlEntities.decodeEntities( settings.title ) || window.wp.i18n.__( 'DOKU', 'doku_checkout' ); const Content = () => { - return window.wp.htmlEntities.decodeEntities( settings.description || window.wp.i18n.__( 'Bayar Pesanan Dengan DOKU Checkout', 'jokul_checkout' ) ); + return window.wp.htmlEntities.decodeEntities( settings.description || window.wp.i18n.__( 'Bayar Pesanan Dengan DOKU Checkout', 'doku_checkout' ) ); }; const Block_Gateway = { - name: 'jokul_checkout', + name: 'doku_checkout', label: label, content: Object( window.wp.element.createElement )( Content, null ), edit: Object( window.wp.element.createElement )( Content, null ), diff --git a/woo-doku-jokul/Module/JokulCheckoutModule.php b/woo-doku-jokul/Module/JokulCheckoutModule.php index d0b17ec..3f77ca0 100644 --- a/woo-doku-jokul/Module/JokulCheckoutModule.php +++ b/woo-doku-jokul/Module/JokulCheckoutModule.php @@ -7,12 +7,12 @@ require_once(DOKU_PAYMENT_PLUGIN_PATH . '/Common/JokulDb.php'); require_once(DOKU_PAYMENT_PLUGIN_PATH . '/Common/JokulUtils.php'); -class JokulCheckoutModule extends WC_Payment_Gateway +class DokuCheckoutModule extends WC_Payment_Gateway { public function __construct() { $this->init_form_fields(); - $this->id = 'jokul_checkout'; + $this->id = 'doku_checkout'; $this->has_fields = true; $this->method_name = 'DOKU Checkout'; $this->method_code = 'JOKUL_CHECKOUT'; @@ -22,7 +22,7 @@ public function __construct() $this->checkout_msg = 'This your payment on DOKU Checkout : '; $this->init_settings(); - $mainSettings = get_option('woocommerce_jokul_gateway_settings'); + $mainSettings = get_option('woocommerce_doku_gateway_settings'); $this->environmentPaymentJokul = $mainSettings['environment_payment_jokul']; $this->sandboxClientId = $mainSettings['sandbox_client_id']; $this->sandboxSharedKey = $mainSettings['sandbox_shared_key']; @@ -52,7 +52,7 @@ public function __construct() $queryArray = explode("&", sanitize_text_field($_SERVER['QUERY_STRING'])); if (WC()->session != null) { $chosen_payment_method = WC()->session->get('chosen_payment_method'); - if ($this->id == 'jokul_checkout') { + if ($this->id == 'doku_checkout') { if (in_array("jokul=show", $queryArray)) { add_filter('the_title', array($this, 'woo_title_order_pending')); add_action('woocommerce_thankyou_' . $this->id, array($this, 'thank_you_page_pending'), 1, 10); @@ -185,8 +185,8 @@ public function process_payment($order_id) $amount = $order->order_total; $order_data = $order->get_data(); - $this->jokulUtils = new JokulUtils(); - $formattedPhoneNumber = $this->jokulUtils->formatPhoneNumber($order->billing_phone); + $this->dokuUtils = new DokuUtils(); + $formattedPhoneNumber = $this->dokuUtils->formatPhoneNumber($order->billing_phone); $params = array( 'customerId' => 0 !== $order->get_customer_id() ? $order->get_customer_id() : null, @@ -237,12 +237,12 @@ public function process_payment($order_id) update_post_meta($order_id, 'checkoutParams', $params); update_post_meta($order_id, 'checkoutConfig', $config); - $this->jokulCheckoutService = new JokulCheckoutService(); - $response = $this->jokulCheckoutService->generated($config, $params); + $this->dokuCheckoutService = new DokuCheckoutService(); + $response = $this->dokuCheckoutService->generated($config, $params); if (!is_wp_error($response)) { if ($response['message'][0] == "SUCCESS" && isset($response['response']['payment']['url'])) { update_post_meta($order_id, 'checkoutUrl', $response['response']['payment']['url']); - JokulCheckoutModule::addDb($response, $amount); + DokuCheckoutModule::addDb($response, $amount); $this->orderId = $order_id; return array( 'result' => 'success', @@ -291,8 +291,6 @@ public function process_admin_options() public function admin_options() { - parent::admin_options(); - wp_enqueue_script( 'admin-options-module', plugin_dir_url(__FILE__) . '../Js/admin-options-module.js', @@ -323,25 +321,24 @@ public function payment_fields() public function addDb($response, $amount) { - - $this->jokulUtils = new JokulUtils(); - $getIp = $this->jokulUtils->getIpaddress(); + $this->dokuUtils = new DokuUtils(); + $getIp = $this->dokuUtils->getIpaddress(); $trx = array(); $trx['invoice_number'] = $response['response']['order']['invoice_number']; - $trx['result_msg'] = null; + $trx['result_msg'] = $response['message'][0]; $trx['process_type'] = 'PAYMENT_PENDING'; $trx['raw_post_data'] = json_encode($response); $trx['ip_address'] = $getIp; $trx['amount'] = $amount; $trx['payment_channel'] = $this->method_code; - $trx['payment_code'] = null; + $trx['payment_code'] = ""; $trx['doku_payment_datetime'] = gmdate("Y-m-d H:i:s"); $trx['process_datetime'] = gmdate("Y-m-d H:i:s"); $trx['message'] = "Payment Pending message come from Jokul. Success : completed"; - $this->jokulDb = new JokulDb(); - $this->jokulDb->addData($trx); + $this->dokuDB = new DokuDB(); + $this->dokuDB->addData($trx); } public function thank_you_page_pending($order_id) @@ -352,7 +349,7 @@ public function thank_you_page_pending($order_id) } wp_register_script( - 'jokul-thank-you-redirect', + 'doku-payment-thank-you-redirect', '', [], '1.0.0', @@ -366,8 +363,8 @@ public function thank_you_page_pending($order_id) })(); "; - wp_add_inline_script('jokul-thank-you-redirect', $inline_script); - wp_enqueue_script('jokul-thank-you-redirect'); + wp_add_inline_script('doku-payment-thank-you-redirect', $inline_script); + wp_enqueue_script('doku-payment-thank-you-redirect'); } function woo_title_order_pending($title) @@ -394,25 +391,25 @@ function woo_title_order_received($title) $paramsValue = get_post_meta($order->get_id(), 'checkoutParams', true); $configValue = get_post_meta($order->get_id(), 'checkoutConfig', true); - $this->jokulCheckStatusService = new JokulCheckStatusService(); - $response = $this->jokulCheckStatusService->generated($configValue, $paramsValue); + $this->dokuCheckStatusService = new DokuCheckStatusService(); + $response = $this->dokuCheckStatusService->generated($configValue, $paramsValue); if (!is_wp_error($response)) { if (strtolower($response['acquirer']['id']) == strtolower('OVO')) { - $jokulUtils = new JokulUtils(); - $jokulDb = new JokulDb(); - $jokulUtils->doku_log($jokulUtils, 'Jokul Acquirer : ' . $response['acquirer']['id'], $paramsValue['invoiceNumber']); + $dokuUtils = new DokuUtils(); + $dokuDB = new DokuDB(); + $dokuUtils->doku_log($dokuUtils, 'Jokul Acquirer : ' . $response['acquirer']['id'], $paramsValue['invoiceNumber']); if (strtolower($response['transaction']['status']) == strtolower('SUCCESS')) { - $jokulDb->updateData($paramsValue['invoiceNumber'], $response['transaction']['status']); + $dokuDB->updateData($paramsValue['invoiceNumber'], $response['transaction']['status']); $order = wc_get_order($paramsValue['invoiceNumber']); $order->update_status('processing'); $order->payment_complete(); - $jokulUtils->doku_log($jokulUtils, 'DOKU Check Status Update Status : ' . 'processing', $paramsValue['invoiceNumber']); + $dokuUtils->doku_log($dokuUtils, 'DOKU Check Status Update Status : ' . 'processing', $paramsValue['invoiceNumber']); } else { - $jokulDb->updateData($paramsValue['invoiceNumber'], $response['transaction']['status']); + $dokuDB->updateData($paramsValue['invoiceNumber'], $response['transaction']['status']); $order = wc_get_order($paramsValue['invoiceNumber']); $order->update_status('failed'); - $jokulUtils->doku_log($jokulUtils, 'DOKU Check Status Update Status : ' . 'failed', $paramsValue['invoiceNumber']); + $dokuUtils->doku_log($dokuUtils, 'DOKU Check Status Update Status : ' . 'failed', $paramsValue['invoiceNumber']); } } } diff --git a/woo-doku-jokul/Module/JokulMainModule.php b/woo-doku-jokul/Module/JokulMainModule.php index 1fbb8de..bb3c68c 100644 --- a/woo-doku-jokul/Module/JokulMainModule.php +++ b/woo-doku-jokul/Module/JokulMainModule.php @@ -2,13 +2,13 @@ if ( ! defined( 'ABSPATH' ) ) exit; -class JokulMainModule extends WC_Payment_Gateway +class DokuMainModule extends WC_Payment_Gateway { public function __construct() { $this->init_form_fields(); - $this->id = 'jokul_gateway'; + $this->id = 'doku_gateway'; $this->has_fields = true; $this->method_name = 'General Configuration'; $this->title = !empty($this->get_option('channel_name')) ? $this->get_option('channel_name') : $this->method_name; @@ -69,7 +69,7 @@ public function process_admin_options() public function check_gateway_status($gateways) { - if ($this->id == 'jokul_gateway') { + if ($this->id == 'doku_gateway') { unset($gateways[$this->id]); return $gateways; } diff --git a/woo-doku-jokul/Service/JokulCheckStatusService.php b/woo-doku-jokul/Service/JokulCheckStatusService.php index 4b7d6f5..7c89144 100644 --- a/woo-doku-jokul/Service/JokulCheckStatusService.php +++ b/woo-doku-jokul/Service/JokulCheckStatusService.php @@ -5,20 +5,20 @@ require_once(DOKU_PAYMENT_PLUGIN_PATH . '/Common/JokulConfig.php'); require_once(DOKU_PAYMENT_PLUGIN_PATH . '/Common/JokulUtils.php'); -class JokulCheckStatusService { +class DokuCheckStatusService { public function generated($config, $params) { $header = array(); - $this->jokulUtils = new JokulUtils(); + $this->dokuUtils = new DokuUtils(); - $requestId = $this->jokulUtils->guidv4(); + $requestId = $this->dokuUtils->guidv4(); $targetPath = "/orders/v1/status/" . $params['invoiceNumber']; $dateTimeFinal = gmdate("Y-m-d\TH:i:s\Z"); - $this->jokulConfig = new JokulConfig(); + $this->dokuConfig = new DokuConfig(); $valueEnv = $config['environment'] === 'true' ? true : false; - $getUrl = $this->jokulConfig->getBaseUrl($valueEnv); + $getUrl = $this->dokuConfig->getBaseUrl($valueEnv); $url = $getUrl . $targetPath; $header['Client-Id'] = $config['client_id']; @@ -26,7 +26,7 @@ public function generated($config, $params) $header['Request-Timestamp'] = $dateTimeFinal; $header['Request-Target'] = $targetPath; - $signature = $this->jokulUtils->generateSignatureCheckStatus($header, $config['shared_key']); + $signature = $this->dokuUtils->generateSignatureCheckStatus($header, $config['shared_key']); $args = array( 'headers' => array( @@ -44,14 +44,14 @@ public function generated($config, $params) if (is_wp_error($response)) { $error_message = $response->get_error_message(); - $this->jokulUtils->doku_log($this, 'Jokul Check Status ERROR: ' . $error_message, $params['invoiceNumber']); + $this->dokuUtils->doku_log($this, 'Jokul Check Status ERROR: ' . $error_message, $params['invoiceNumber']); return null; } $responseBody = wp_remote_retrieve_body($response); - $this->jokulUtils->doku_log($this, 'Jokul Check Status REQUEST URL: ' . $url, $params['invoiceNumber']); - $this->jokulUtils->doku_log($this, 'Jokul Check Status RESPONSE: ' . json_encode($responseBody, JSON_PRETTY_PRINT), $params['invoiceNumber']); + $this->dokuUtils->doku_log($this, 'Jokul Check Status REQUEST URL: ' . $url, $params['invoiceNumber']); + $this->dokuUtils->doku_log($this, 'Jokul Check Status RESPONSE: ' . json_encode($responseBody, JSON_PRETTY_PRINT), $params['invoiceNumber']); return json_decode($responseBody, true); } diff --git a/woo-doku-jokul/Service/JokulCheckoutService.php b/woo-doku-jokul/Service/JokulCheckoutService.php index 35d7349..327b4dc 100644 --- a/woo-doku-jokul/Service/JokulCheckoutService.php +++ b/woo-doku-jokul/Service/JokulCheckoutService.php @@ -5,15 +5,15 @@ require_once(DOKU_PAYMENT_PLUGIN_PATH . '/Common/JokulConfig.php'); require_once(DOKU_PAYMENT_PLUGIN_PATH . '/Common/JokulUtils.php'); -class JokulCheckoutService { +class DokuCheckoutService { public function generated($config, $params) { $header = array(); - $this->jokulUtils = new JokulUtils(); + $this->dokuUtils = new DokuUtils(); - $requestId = $this->jokulUtils->guidv4(); - $formattedPhoneNumber = $this->jokulUtils->formatPhoneNumber($params['phone']); + $requestId = $this->dokuUtils->guidv4(); + $formattedPhoneNumber = $this->dokuUtils->formatPhoneNumber($params['phone']); $targetPath= "/checkout/v1/payment"; $dateTime = gmdate(DATE_ISO8601); $dateTimeFinal = substr($dateTime, 0, 19) . "Z"; @@ -143,9 +143,9 @@ public function generated($config, $params) ) ); - $this->jokulConfig = new JokulConfig(); + $this->dokuConfig = new DokuConfig(); $valueEnv = $config['environment'] === 'true'? true: false; - $getUrl = $this->jokulConfig -> getBaseUrl($valueEnv); + $getUrl = $this->dokuConfig -> getBaseUrl($valueEnv); $url = $getUrl.$targetPath; $header['Client-Id'] = $config['client_id']; @@ -154,7 +154,7 @@ public function generated($config, $params) $header['Request-Target'] = $targetPath; $header['Content-Type'] = "application/json"; - $signature = $this->jokulUtils->generateSignature($header, json_encode($data), $config['shared_key']); + $signature = $this->dokuUtils->generateSignature($header, json_encode($data), $config['shared_key']); $header['Signature'] = $signature; $body = json_encode($data); @@ -167,11 +167,11 @@ public function generated($config, $params) ); $response = wp_remote_post($url, $args); $response_body = wp_remote_retrieve_body($response); - $this->jokulUtils->doku_log($this, 'Jokul Checkout REQUEST : ' . json_encode($data), $params['invoiceNumber']); - $this->jokulUtils->doku_log($this, 'Jokul Checkout REQUEST Header: ' . json_encode($header), $params['invoiceNumber']); - $this->jokulUtils->doku_log($this, 'Jokul Checkout REQUEST URL : ' . $url, $params['invoiceNumber']); - $this->jokulUtils->doku_log($this, 'Jokul Checkout RESPONSE : ' . json_encode($response, JSON_PRETTY_PRINT), $params['invoiceNumber']); - $this->jokulUtils->doku_log($this, 'Jokul Checkout RESPONSE Body: ' . json_encode($response_body, JSON_PRETTY_PRINT), $params['invoiceNumber']); + $this->dokuUtils->doku_log($this, 'Jokul Checkout REQUEST : ' . json_encode($data), $params['invoiceNumber']); + $this->dokuUtils->doku_log($this, 'Jokul Checkout REQUEST Header: ' . json_encode($header), $params['invoiceNumber']); + $this->dokuUtils->doku_log($this, 'Jokul Checkout REQUEST URL : ' . $url, $params['invoiceNumber']); + $this->dokuUtils->doku_log($this, 'Jokul Checkout RESPONSE : ' . json_encode($response, JSON_PRETTY_PRINT), $params['invoiceNumber']); + $this->dokuUtils->doku_log($this, 'Jokul Checkout RESPONSE Body: ' . json_encode($response_body, JSON_PRETTY_PRINT), $params['invoiceNumber']); return json_decode($response_body, true); diff --git a/woo-doku-jokul/Service/JokulNotificationService.php b/woo-doku-jokul/Service/JokulNotificationService.php index dcee361..f33d31d 100644 --- a/woo-doku-jokul/Service/JokulNotificationService.php +++ b/woo-doku-jokul/Service/JokulNotificationService.php @@ -6,7 +6,7 @@ require_once(DOKU_PAYMENT_PLUGIN_PATH . '/Common/JokulUtils.php'); require_once(DOKU_PAYMENT_PLUGIN_PATH . '/Common/JokulDb.php'); -class JokulNotificationService +class DokuNotificationService { private function sanitize_array($array) @@ -29,15 +29,15 @@ private function sanitize_array($array) public function getNotification($path,$request) { - $jokulUtils = new JokulUtils(); + $dokuUtils = new DokuUtils(); $raw_input = $request->get_json_params(); - $jokulUtils->doku_log($jokulUtils, 'raw input notif : ' . json_encode($raw_input, JSON_PRETTY_PRINT)); + $dokuUtils->doku_log($dokuUtils, 'raw input notif : ' . json_encode($raw_input, JSON_PRETTY_PRINT)); $raw_notification = $raw_input; - $mainSettings = get_option('woocommerce_jokul_gateway_settings'); + $mainSettings = get_option('woocommerce_doku_gateway_settings'); $headerData = $request->get_headers(); if (json_last_error() !== JSON_ERROR_NONE) { - $jokulUtils->doku_log($jokulUtils, 'INVALID JSON INPUT: ' . json_last_error_msg(), null); + $dokuUtils->doku_log($dokuUtils, 'INVALID JSON INPUT: ' . json_last_error_msg(), null); http_response_code(400); echo esc_html(http_response_code()); return new WP_REST_Response('Invalid JSON input', 400); @@ -45,8 +45,8 @@ public function getNotification($path,$request) $raw_notification = $this->sanitize_array($raw_notification); - $jokulUtils->doku_log($jokulUtils, 'NOTIFICATION : ' . json_encode($raw_notification, JSON_PRETTY_PRINT), $raw_notification['order']['invoice_number']); - $jokulUtils->doku_log($jokulUtils, 'NOTIFICATION HEADER : ' . json_encode($headerData, JSON_PRETTY_PRINT), $raw_notification['order']['invoice_number']); + $dokuUtils->doku_log($dokuUtils, 'NOTIFICATION : ' . json_encode($raw_notification, JSON_PRETTY_PRINT), $raw_notification['order']['invoice_number']); + $dokuUtils->doku_log($dokuUtils, 'NOTIFICATION HEADER : ' . json_encode($headerData, JSON_PRETTY_PRINT), $raw_notification['order']['invoice_number']); if ($mainSettings['environment_payment_jokul'] == 'false') { $sharedKey = $mainSettings['sandbox_shared_key']; @@ -54,7 +54,7 @@ public function getNotification($path,$request) $sharedKey = $mainSettings['prod_shared_key']; } - $jokulDb = new JokulDb(); + $dokuDB = new DokuDB(); $serviceType = $raw_notification['service']['id']; $invoiceNumber = $raw_notification['order']['invoice_number']; $amount = $raw_notification['order']['amount']; @@ -69,18 +69,18 @@ public function getNotification($path,$request) $paymentDate = $raw_notification['virtual_account_payment']['date']; } - $transaction = $jokulDb->checkTrx($invoiceNumber, $amount, $paymentCode); + $transaction = $dokuDB->checkTrx($invoiceNumber, $amount, $paymentCode); if (!empty($transaction)){ - $signature = $jokulUtils->generateSignatureNotification($headerData, $request->get_body(), $sharedKey, $requestTarget); + $signature = $dokuUtils->generateSignatureNotification($headerData, $request->get_body(), $sharedKey, $requestTarget); error_log("Signature From DOKU: " . $headerData['signature'][0]); error_log("Signature From MERCHANT: " . $signature); if ($signature == $headerData['signature'][0]) { - $jokulUtils->doku_log($jokulUtils, 'TRANSACTION SIGNATURE VALID', $raw_notification['order']['invoice_number']); + $dokuUtils->doku_log($dokuUtils, 'TRANSACTION SIGNATURE VALID', $raw_notification['order']['invoice_number']); if (strtolower($raw_notification['transaction']['status']) == strtolower('SUCCESS')) { - $checkTrxStatus = $jokulDb->checkStatusTrx($invoiceNumber, $amount, $paymentCode == "" ? "" : $paymentCode, 'PAYMENT_COMPLETED'); + $checkTrxStatus = $dokuDB->checkStatusTrx($invoiceNumber, $amount, $paymentCode == "" ? "" : $paymentCode, 'PAYMENT_COMPLETED'); if ($checkTrxStatus == '') { $this->addDb($invoiceNumber, $amount, $paymentCode, $paymentDate, $paymentChannel, $transactionStatus,$raw_notification); @@ -90,7 +90,7 @@ public function getNotification($path,$request) $order->update_status('processing'); $order->payment_complete(); } else if (strtolower($raw_notification['transaction']['status']) == strtolower('FAILED')) { - $checkTrxStatus = $jokulDb->checkStatusTrx($invoiceNumber, $amount, $paymentCode == "" ? "" : $paymentCode, 'PAYMENT_COMPLETED'); + $checkTrxStatus = $dokuDB->checkStatusTrx($invoiceNumber, $amount, $paymentCode == "" ? "" : $paymentCode, 'PAYMENT_COMPLETED'); if ($checkTrxStatus == '') { $this->addDb($invoiceNumber, $amount, $paymentCode, $paymentDate, $paymentChannel, $transactionStatus,$raw_notification); @@ -100,7 +100,7 @@ public function getNotification($path,$request) $order->update_status('failed'); } } else { - $jokulUtils->doku_log($jokulUtils, 'SIGNATURE NOT MATCH!', $raw_notification['order']['invoice_number']); + $dokuUtils->doku_log($dokuUtils, 'SIGNATURE NOT MATCH!', $raw_notification['order']['invoice_number']); http_response_code(400); echo esc_html(http_response_code()); return new WP_REST_Response(null, 400); @@ -114,12 +114,12 @@ public function getNotification($path,$request) function addDb($invoiceNumber, $amount, $paymentCode, $paymentDate, $channel, $transactionStatus,$raw_notification) { - $jokulUtils = new JokulUtils(); - $getIp = $jokulUtils->getIpaddress(); + $dokuUtils = new DokuUtils(); + $getIp = $dokuUtils->getIpaddress(); $trx = array(); $trx['invoice_number'] = $invoiceNumber; - $trx['result_msg'] = null; + $trx['result_msg'] = "SUCCESS"; $trx['process_type'] = 'PAYMENT_COMPLETED'; $trx['raw_post_data'] = sanitize_text_field(json_encode($raw_notification, JSON_PRETTY_PRINT)); $trx['ip_address'] = $getIp; @@ -130,7 +130,7 @@ function addDb($invoiceNumber, $amount, $paymentCode, $paymentDate, $channel, $t $trx['process_datetime'] = gmdate("Y-m-d H:i:s"); $trx['message'] = "Payment process message come from Jokul. " . $transactionStatus . " : completed"; - $jokulDb = new JokulDb(); - $jokulDb->addData($trx); + $dokuDB = new DokuDB(); + $dokuDB->addData($trx); } } diff --git a/woo-doku-jokul/Service/JokulQrisNotificationService.php b/woo-doku-jokul/Service/JokulQrisNotificationService.php index 9444ba7..51fed5a 100644 --- a/woo-doku-jokul/Service/JokulQrisNotificationService.php +++ b/woo-doku-jokul/Service/JokulQrisNotificationService.php @@ -5,17 +5,17 @@ require_once(DOKU_PAYMENT_PLUGIN_PATH . '/Common/JokulConfig.php'); require_once(DOKU_PAYMENT_PLUGIN_PATH . '/Common/JokulUtils.php'); -class JokulQrisNotificationService +class DokuQrisNotificationService { public function getQrisNotification($request) { // Membuat instance untuk utilitas - $jokulUtils = new JokulUtils(); + $dokuUtils = new DokuUtils(); // Mendapatkan raw notification dari input $raw_notification = $request->get_json_params(); - $jokulUtils->doku_log($jokulUtils, 'Qris Notify : ' .'Jokul - Notification Controller Notification Raw Request: '.$raw_notification); + $dokuUtils->doku_log($dokuUtils, 'Qris Notify : ' .'Jokul - Notification Controller Notification Raw Request: '.$raw_notification); // Hanya mengambil nilai yang dibutuhkan dari $_POST $acquirer = isset($_POST['ACQUIRER']) ? sanitize_text_field($_POST['ACQUIRER']) : ''; @@ -28,32 +28,32 @@ public function getQrisNotification($request) $txn_status = isset($_POST['TXNSTATUS']) ? sanitize_text_field($_POST['TXNSTATUS']) : ''; // Logging acquirer - $jokulUtils->doku_log('Qris Notify','Jokul - Notification Controller Qris Notification Request : ' . $acquirer); + $dokuUtils->doku_log('Qris Notify','Jokul - Notification Controller Qris Notification Request : ' . $acquirer); // Mendapatkan order berdasarkan TRANSACTIONID if (empty($transaction_id)) { - $jokulUtils->doku_log('Qris Notify','TRANSACTIONID is missing'); + $dokuUtils->doku_log('Qris Notify','TRANSACTIONID is missing'); return; // Jika TRANSACTIONID tidak ada, keluar dari proses } $order = wc_get_order($transaction_id); if (!$order) { - $jokulUtils->doku_log('Qris Notify','Order not found for TRANSACTIONID: ' . $transaction_id); + $dokuUtils->doku_log('Qris Notify','Order not found for TRANSACTIONID: ' . $transaction_id); return; // Jika order tidak ditemukan, keluar } // Mengambil sharedKey dari setting - $mainSettings = get_option('woocommerce_jokul_checkout_settings'); + $mainSettings = get_option('woocommerce_doku_checkout_settings'); $sharedKey = isset($mainSettings['payment_shared_key']) ? $mainSettings['payment_shared_key'] : ''; // Membuat kata untuk validasi $words_to_validate = $issuer_id . $txn_date . $merchant_pan . $invoice . $sharedKey; - $jokulUtils->doku_log('Qris Notify','Component Words Qris Current : ' . $words_to_validate); + $dokuUtils->doku_log('Qris Notify','Component Words Qris Current : ' . $words_to_validate); // Melakukan hash dengan SHA1 $validateWord = sha1($words_to_validate); - $jokulUtils->doku_log('Qris Notify','Validated Words Qris Current : ' . $validateWord); - $jokulUtils->doku_log('Qris Notify','Words Qris Expected : ' . $words); + $dokuUtils->doku_log('Qris Notify','Validated Words Qris Current : ' . $validateWord); + $dokuUtils->doku_log('Qris Notify','Words Qris Expected : ' . $words); // Validasi kecocokan kata if ($validateWord == $words) { @@ -61,16 +61,16 @@ public function getQrisNotification($request) // Update status order menjadi 'processing' $order->update_status('processing'); $order->payment_complete(); - $jokulUtils->doku_log('Qris Notify','Jokul - Update transaction to Processing ' . $transaction_id); + $dokuUtils->doku_log('Qris Notify','Jokul - Update transaction to Processing ' . $transaction_id); echo "SUCCESS"; } else { // Update status order menjadi 'failed' $order->update_status('failed'); - $jokulUtils->doku_log('Qris Notify','Jokul - Update transaction to FAILED ' . $transaction_id); + $dokuUtils->doku_log('Qris Notify','Jokul - Update transaction to FAILED ' . $transaction_id); echo "SUCCESS"; } } else { - $jokulUtils->doku_log('Qris Notify','Words Not Match ' . $transaction_id); + $dokuUtils->doku_log('Qris Notify','Words Not Match ' . $transaction_id); } } } diff --git a/woo-doku-jokul/doku-payment.php b/woo-doku-jokul/doku-payment.php index 104481b..109e098 100644 --- a/woo-doku-jokul/doku-payment.php +++ b/woo-doku-jokul/doku-payment.php @@ -21,16 +21,16 @@ define('DOKU_PAYMENT_MAIN_FILE', __FILE__); define('DOKU_PAYMENT_PLUGIN_PATH', untrailingslashit(plugin_dir_path(__FILE__))); -add_action('plugins_loaded', 'jokul_init_gateway_class'); -function jokul_init_gateway_class() +add_action('plugins_loaded', 'doku_payment_init_gateway_class'); +function doku_payment_init_gateway_class() { if (!class_exists('WC_Payment_Gateway')) { return; } - if (!class_exists('JokulMainPg')) { - class JokulMainPg + if (!class_exists('DokuMainPg')) { + class DokuMainPg { private static $instance; @@ -62,14 +62,14 @@ public function init() */ function addJokulGateway($methods) { - $mainSettings = get_option('woocommerce_jokul_gateway_settings'); - $methods[] = 'JokulMainModule'; - $methods[] = 'JokulCheckoutModule'; + $mainSettings = get_option('woocommerce_doku_gateway_settings'); + $methods[] = 'DokuMainModule'; + $methods[] = 'DokuCheckoutModule'; return $methods; } } - $GLOBALS['jokul_main_pg'] = JokulMainPg::get_instance(); + $GLOBALS['doku_main_pg'] = DokuMainPg::get_instance(); } } @@ -115,7 +115,7 @@ function doku_payment_install_db() require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); - add_option('jokuldb_db_version', $doku_payment_db_version); + add_option('doku_db_version', $doku_payment_db_version); } add_action('rest_api_init', function () { @@ -127,20 +127,11 @@ function doku_payment_install_db() }, 'permission_callback' => '__return_true' )); - - // Register route for Jokul - register_rest_route('jokul', 'notification', array( - 'methods' => 'POST', - 'callback' => function ($request) { - return doku_payment_order_update_status('jokul',$request); - }, - 'permission_callback' => '__return_true' - )); }); function doku_payment_order_update_status($path,$request) { - $notificationService = new JokulNotificationService(); + $notificationService = new DokuNotificationService(); $response = $notificationService->getNotification($path,$request); return $response; } @@ -159,7 +150,7 @@ function doku_payment_qris_register_route() function doku_payment_order_update_status_qris($request) { - $qrisNotificationService = new JokulQrisNotificationService(); + $qrisNotificationService = new DokuQrisNotificationService(); $response = $qrisNotificationService->getQrisNotification($request); } diff --git a/woo-doku-jokul/readme.txt b/woo-doku-jokul/readme.txt index 5302d87..af7e680 100644 --- a/woo-doku-jokul/readme.txt +++ b/woo-doku-jokul/readme.txt @@ -1,43 +1,37 @@ === DOKU Payment === Contributors: dokuplugin Donate link: https://doku.com/ -Tags: Payment Gateway, Payment +Tags: Payment Gateway, Payment, Credit Card, DOKU, woocommerce Requires at least: 2.2 Tested up to: 6.7 Stable tag: 1.3.17 -Requires PHP: 5.6 +Requires PHP: 5.6v License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html DOKU plugin offers a secure payment with DOKU Checkout, letting customers choose from various payment methods and complete transactions seamlessly. == Description == - -Accept payment through various payment channels with DOKU. Make it easy for your customers to purchase on your store. - -For backwards compatibility, if this section is missing, the full length of the short description will be used, and -Markdown parsed. - -A few notes about the sections above: - -* "Contributors" is a comma separated list of wordpress.org usernames -* "Tags" is a comma separated list of tags that apply to the plugin -* "Requires at least" is the lowest version that the plugin will work on -* "Tested up to" is the highest version that you've *successfully used to test the plugin* -* Stable tag must indicate the Subversion "tag" of the latest stable version - -Note that the `readme.txt` value of stable tag is the one that is the defining one for the plugin. If the `/trunk/readme.txt` file says that the stable tag is `4.3`, then it is `/tags/4.3/readme.txt` that'll be used for displaying information about the plugin. - -If you develop in trunk, you can update the trunk `readme.txt` to reflect changes in your in-development version, without having that information incorrectly disclosed about the current stable version that lacks those changes -- as long as the trunk's `readme.txt` points to the correct stable tag. - -If no stable tag is provided, your users may not get the correct version of your code. + +DOKU plugin offers a seamless, secure payment solution allowing your customers to choose from various payment methods and complete transactions directly on your WooCommerce store. + +- **Multiple Payment Methods**: Accept credit cards, bank transfers, e-wallets, and other methods. +- **Seamless Checkout**: Deliver a fast and secure payment experience for your customers. +- **Customizable Checkout**: Tailor the checkout page to match your store’s branding and design. +- **Sandbox/Production Mode**: Switch between test and live environments for smooth integration. + +Refer to our [documentation](https://docs.doku.com/accept-payments/integration-tools/e-commerce-and-plugins/woocommerce-wordpress) for more information and tips. == Upgrade Notice == -= 1.3.16 = -Fixing minor bug and adjust code to wordpress standards. += 1.3.17 = +Improved readme formatting and updated documentation and code standardization. == Change Log == -= 1.3.16 = + += 1.3.17 = +Improved readme formatting and updated documentation and code standardization. + +1.3.16 - Fixing minor bug and adjust code to wordpress standards. 1.3.15 - @@ -46,122 +40,60 @@ DOKU Payment Support Tax and Fee for indodana. 1.3.14 - DOKU Payment compatible with WooCommerce Checkout Block. -== External services == -This plugin connects to DOKU Checkout to facilitate customer payments by enabling them to select a payment method and complete transactions through DOKU Checkout. For testing purposes, it connects to the sandbox environment at https://api-sandbox.doku.com, while live transactions are processed through the production environment at https://api.doku.com. During payment initiation and processing, the plugin transmits transaction details and customer payment preferences to these endpoints. -Additionally, the plugin uses Service/JokulNotificationService to update payment statuses via a notification endpoint. The notification endpoint is dynamically constructed using the following logic: $requestTarget = '/wp-json/' . $path . '/notification'; where the $path includes merchant name as data. This ensures that each notification endpoint is unique to the merchant. The notification service is triggered whenever an event, such as a status change, occurs (e.g., transaction authorization, capture, refund, or cancellation). The transmitted data includes the merchant's name as part of the $path, ensuring that transaction updates are accurately reflected in the merchant’s system. -For more information, please refer to DOKU’s Checkout Document https://developers.doku.com/accept-payment/doku-checkout - +## Installation Overview +1. Install the DOKU Payment plugin. +2. Activate the plugin from the Plugins page in your WordPress dashboard. +3. Configure DOKU Payment settings in WooCommerce and DOKU Dashboard. ## Requirements +- WordPress 5.6 or higher +- WooCommerce 4.9.0 or higher +- PHP 5.6 or higher +- MySQL 5.6 or higher -- WordPress 5.6 or higher. This plugin is tested with Wordpress 6.2 -- WooCommerce 4.9.0 or higher. This plugin is tested with WooCommerce v7.2.1 -- PHP v5.6 or higher -- MySQL v5.6 or higher -- DOKU account: - - For testing purpose, please register to the Sandbox environment and retrieve the Client ID & Secret Key. Learn more about the sandbox environment [here](https://jokul.doku.com/docs/docs/getting-started/explore-sandbox) - - For real transaction, please register to the Production environment and retrieve the Client ID & Secret Key. Learn more about the production registration process [here](https://jokul.doku.com/docs/docs/getting-started/register-user) - -## DOKU Already Supported `doku_log` -​ -This `doku_log` is useful to help simplify the process of checking if an issue occurs related to the payment process using the DOKU Plugin. If there are problems or problems using the plugin, you can contact our team by sending this doku_log file. `Doku_log` will record all transaction processes from any channel by date. - -​ -## How to use and take doku_log file? -​ -1. Open your `WooCommerce_dir` directory on your store's webserver. -2. Create folder `doku_log` in your directory store's, so plugin will automatically track log in your store's webserver. -3. Then check `doku_log` and open file in your store's webserver. -4. You will see `doku log` file by date. -5. And you can download the file. -6. If an issue occurs, you can send this `doku_log` file to the team to make it easier to find the cause of the issue. - -**Checkout** -Easily embed our well-crafted yet customizable DOKU payment page for your website. With a single integration, you can start accepting payments on your web. With a single integration, Checkout allows you to accept payments from various DOKU payment channels. - - ![General Configuration](https://i.ibb.co/rMbyngg/screencapture-sandboxenv-devwoolatest-wp-admin-admin-php-2022-04-06-09-26-39.png) - - - **Environment**: For testing purpose, select Sandbox. For accepting real transactions, select Production - - **Sandbox Client ID**: Client ID you retrieved from the Sandbox environment DOKU Back Office - - **Sandbox Secret Key**: Secret Key you retrieved from the Sandbox environment DOKU Back Office - - **Production Client ID**: Client ID you retrieved from the Production environment DOKU Back Office - - **Production Secret Key**: Secret Key you retrieved from the Production environment DOKU Back Office - - **Expiry Time**: Input the time that for VA expiration in minutes - - **Notification URL**: Copy this URL and paste the URL into the DOKU Back Office. Learn more about how to setup Notification URL [here](https://jokul.doku.com/docs/docs/after-payment/setup-notification-url) - - **QRIS Notification URL** : Copy this URL and and contact our support team to help paste in QRIS Backoffice. This channel only support if youre enabling Checkout as a payment method. - - **Email Notifications** : You can activated the feature send emails for VA and O2O channels. This email contains how to pay for the VA or Paycode. - - **Sub Account Feature** : This feature helps you to routing your payment into your Sub Account ID. You can see the details for payment flow if youre using this feature [here](https://jokul.doku.com/docs/docs/jokul-sub-account/jokul-sub-account-overview) -1. Click Save Changes button -1. Go Back to Payments Tab -1. Now your customer should be able to see the payment channels and you start receiving payments - -### Checkout Configuration - -![DOKU Checkout Configuration](https://i.ibb.co/v4LqSfj/Screen-Shot-2022-04-06-at-10-16-05.png) - -To show the Checkout options to your customers, simply toggle the channel that you wish to show. DOKU Checkout allows you to accept payments from various DOKU payment channels. You can enable or disable the payment channel that you want to show in your store view in DOKU Backoffice Configuration. - -![DOKU Checkout Configuration Details](https://i.ibb.co/MPGD1B1/Screen-Shot-2022-04-06-at-10-19-44.png) - -You can also click Manage to edit how the Checkout channels will be shown to your customers by clicking the Manage button. -Below you can update the QRIS Credential that youre already get from our Support Team. - -Links require brackets and parenthesis: - -Here's a link to [WordPress](https://wordpress.org/ "Your favorite software") and one to [Markdown's Syntax Documentation][markdown syntax]. Link titles are optional, naturally. - -Blockquotes are email style: - -> Asterisks for *emphasis*. Double it up for **strong**. - -And Backticks for code: - -`` +== Installation == + +Before installing **DOKU Payment**, ensure that **WooCommerce** is already installed and activated on your WordPress site. + +1. Install DOKU payment from our WordPress plugin store or under Plugins menu - Add New Plugin in your WordPress dashboard +2. Go to Plugins page, and activate DOKU Payment + +After activation, follow these steps to configure the plugin: + +### Step 1: Configure DOKU Payment in WooCommerce + +1. Go to **WooCommerce** (in sidebar) > **Settings** > **Payments** tab. +2. Find **DOKU General-Configuration** and click **Manage**. +3. Fill in the fields: + - Tick Enable DOKU + - Choose **Sandbox** (for testing) or **Production** (for live payments). + - **Client ID** and **Secret Key** (from your DOKU Dashboard). + - Set the **Expiry Time** for payment sessions (in minutes). + +### Step 2: Configure DOKU Dashboard + +1. Log in to your **DOKU Dashboard** at [https://dashboard.doku.com](https://dashboard.doku.com) +2. Navigate to **Settings** > **Payments Settings** +3. Configure the payment methods you wish to accept, and for each channel, click **Configure** +4. Copy the **Notification URL** from the WooCommerce settings and paste it into the corresponding payment channel settings in your DOKU Dashboard + +This also applies to QRIS Notification URL. You may do so by going to QR Payment page under Payment Settings section == Frequently Asked Questions == -1. Do I need to have a DOKU Merchant account to use the plugin? -Yes. You can sign up for a merchant account on DOKU Business Account Registration page (https://dashboard.doku.com/register) and obtain your API credentials (Merchant ID and Secret Key). -2. How do I get my API credentials? -To get your API credentials, log in to DOKU Dashboard. Once logged in, follow the steps below -Log in to DOKU Dashboard, and then access the side navigation bar -Select Settings from the menu -Settings page will appear. Under Account section, select API Keys -Your credentials containing Brand ID/Client ID and Secret Key are found on this page -Enter these credentials into the WooCommerce DOKU Checkout settings to enable payment processing -Refer to the following link for the complete guide: -https://docs.doku.com/accept-payments/integration-tools/e-commerce-and-plugins/woocommerce-wordpress -3. What payment methods are supported by DOKU? - 1. Bank Transfer (Virtual Account) - 2. Cards - 3. e-Wallet - 4. QR payment - 5. PayLater - 6. Direct Debit - 7. Digital Banking - 8. Internet banking -Refer to https://docs.doku.com/accept-payments/payment-methods for the complete list -4. Can I add more payment methods? -Yes, you can add more payment methods in DOKU Dashboard by following the steps below: -Log in to DOKU Dashboard, and then access the side navigation bar -Select Settings from the menu -Settings page will appear. Under Account section, select Service -On Service page, click ADD SERVICE button -Select the payment method you would like to activate -Click ACTIVATE button. -Notes: -Some payment methods require our Sales Team's assistance to activate -If payment methods are disabled, that means your account type is limited from activating those payment methods. -5. Can you configure how your checkout page appears? -Yes. DOKU provides configuration settings to customize how your checkout page appears by customizing colors, fonts, store logo, as well as the payment methods you would like to show/hide on the checkout page. -Log in to DOKU Dashboard, and then access the side navigation bar -Select Settings from the menu -Settings page will appear. Under Accept Payments section, select Checkout Appearance -Checkout Page Configuration page will appear, then click Interface Settings tab where you will find several options for customizing the look and feel of your checkout page, including the ability to add your logo and change the background color that fits your brand -Click Save button to save your configuration -6. Is DOKU WooCommerce plugin secure? -Yes, DOKU WooCommerce plugin is secured. It uses industry-standard security protocols, including SSL encryption, to ensure that sensitive customer data (like payment details) is protected during transactions. DOKU complies with PCI-DSS security standards to handle payment card information securely. += Do I need to have a DOKU Merchant account to this plugin ? = +Yes. Sign up on DOKU Business Account [Registration page](https://dashboard.doku.com). + += How do I get my API credentials (Client ID and Secret Key)? = +To obtain your API credentials: + +1. Log in to your **DOKU Dashboard**. +2. Navigate to **Settings** > **API Keys**. +3. Your **Client ID** and **Secret Key** will be displayed here. + +Copy these credentials and paste them into the WooCommerce DOKU Payment settings. + += How can I get support from DOKU? = +For support, visit our [Help Center](https://help.doku.com/en/support/home) to read FAQs, troubleshoot, or submit a support ticket. == Screenshots == -1. Customizable Checkout page -2. Various payment channel -3. Configuration Page \ No newline at end of file +1. Checkout Page \ No newline at end of file