Commit 0cf28e60 authored by mr.amirka's avatar mr.amirka
Browse files

changed endpoints

parent 4fc5a653
...@@ -10,16 +10,28 @@ ...@@ -10,16 +10,28 @@
*/ */
DEFINE('LUNUPAYMENT_SERVER_NAME', $_SERVER['SERVER_NAME']); DEFINE('LUNUPAYMENT_SERVER_NAME', $_SERVER['SERVER_NAME']);
DEFINE('LUNUPAYMENT_VERSION_BETA', 'beta'); DEFINE('LUNUPAYMENT_WIDGET_VERSION_SANDBOX', 'rc');
DEFINE('LUNUPAYMENT_VERSION', ( DEFINE('LUNUPAYMENT_WIDGET_PROCESSING_SANDBOX', 'rc');
DEFINE('LUNUPAYMENT_WIDGET_VERSION', (
LUNUPAYMENT_SERVER_NAME === 'shop.dev.lunu.io' LUNUPAYMENT_SERVER_NAME === 'shop.dev.lunu.io'
? LUNUPAYMENT_VERSION_BETA ? 'beta'
: ( : (
LUNUPAYMENT_SERVER_NAME === 'shop.rc.lunu.io' LUNUPAYMENT_SERVER_NAME === 'shop.rc.lunu.io'
? 'rc' ? 'rc'
: 'alpha' : 'alpha'
) )
)); ));
DEFINE('LUNUPAYMENT_PROCESSING_VERSION', (
LUNUPAYMENT_SERVER_NAME === 'shop.dev.lunu.io'
? 'stage'
: (
LUNUPAYMENT_SERVER_NAME === 'shop.rc.lunu.io'
? 'rc'
: 'alpha'
)
));
DEFINE('LUNUPAYMENT_CALLBACK_ENDPOINT', 'https://' . LUNUPAYMENT_SERVER_NAME . '/wp-json/lunu/payment/v1/notify'); DEFINE('LUNUPAYMENT_CALLBACK_ENDPOINT', 'https://' . LUNUPAYMENT_SERVER_NAME . '/wp-json/lunu/payment/v1/notify');
...@@ -194,7 +206,7 @@ if ( ...@@ -194,7 +206,7 @@ if (
'release' => array( 'release' => array(
'title' => __('Release(checked)/Debug', LUNUPAYMENTWC), 'title' => __('Release(checked)/Debug', LUNUPAYMENTWC),
'type' => 'checkbox', 'type' => 'checkbox',
'default' => (LUNUPAYMENT_VERSION == 'beta' ? 'no' : 'yes'), 'default' => 'yes',
), ),
'app_id' => array( 'app_id' => array(
'title' => __('App ID', LUNUPAYMENTWC), 'title' => __('App ID', LUNUPAYMENTWC),
...@@ -326,8 +338,8 @@ if ( ...@@ -326,8 +338,8 @@ if (
'app_id' => $app_id, 'app_id' => $app_id,
'api_secret' => $api_secret, 'api_secret' => $api_secret,
'version' => $this->release === 'no' 'version' => $this->release === 'no'
? LUNUPAYMENT_VERSION_BETA ? LUNUPAYMENT_PROCESSING_VERSION_SANDBOX
: LUNUPAYMENT_VERSION : LUNUPAYMENT_PROCESSING_VERSION
); );
$payment = array( $payment = array(
'id' => $order_id, 'id' => $order_id,
...@@ -356,9 +368,9 @@ if ( ...@@ -356,9 +368,9 @@ if (
update_post_meta($order_id, '_lunupayment_status', $payment_status); update_post_meta($order_id, '_lunupayment_status', $payment_status);
} }
$WIDGET_VERSION = $this->release === 'no' $widget_version = $this->release === 'no'
? LUNUPAYMENT_VERSION_BETA ? LUNUPAYMENT_WIDGET_VERSION_SANDBOX
: LUNUPAYMENT_VERSION; : LUNUPAYMENT_WIDGET_VERSION;
$payment_status = strtolower($payment_status); $payment_status = strtolower($payment_status);
...@@ -377,7 +389,7 @@ if ( ...@@ -377,7 +389,7 @@ if (
s.type = 'text/javascript'; s.type = 'text/javascript';
s.charset = 'utf-8'; s.charset = 'utf-8';
s.async = true; s.async = true;
s.src = 'https://plugins.lunu.io/packages/widget-ui/" . $WIDGET_VERSION . ".js?t=' + 1 * new Date(); s.src = 'https://plugins.lunu.io/packages/widget-ui/" . $widget_version . ".js?t=' + 1 * new Date();
s.onload = function() { s.onload = function() {
new window.Lunu.widgets.Payment( new window.Lunu.widgets.Payment(
d.getElementById('payment-form'), d.getElementById('payment-form'),
...@@ -467,8 +479,8 @@ if ( ...@@ -467,8 +479,8 @@ if (
'app_id' => $this->app_id, 'app_id' => $this->app_id,
'api_secret' => $this->api_secret, 'api_secret' => $this->api_secret,
'version' => $this->release === 'no' 'version' => $this->release === 'no'
? LUNUPAYMENT_VERSION_BETA ? LUNUPAYMENT_PROCESSING_VERSION_SANDBOX
: LUNUPAYMENT_VERSION : LUNUPAYMENT_PROCESSING_VERSION
), $payment_id); ), $payment_id);
$currency = true === version_compare(WOOCOMMERCE_VERSION, '3.0', '<') $currency = true === version_compare(WOOCOMMERCE_VERSION, '3.0', '<')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment