summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-07-14 11:48:48 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-07-14 11:48:48 +0800
commit85bc0f37e4a178f0d25441301316b76282d28d6a (patch)
tree86f63734e09c700d58e38c2bac083443b8acec2f
parent3e8f47da1d2c80285ab08f04e982f4d22d646876 (diff)
Generalise template_tag so no need for shipping usertag
-rw-r--r--config/pikul_cost.tag20
-rw-r--r--dbconf/pgsql/anteraja.pgsql7
-rw-r--r--dbconf/pgsql/shipping.pgsql7
-rw-r--r--products/ship/anteraja.csv (renamed from products/ship/Indonesia.csv)0
-rw-r--r--products/ship/shipping.asc7
-rw-r--r--products/variable.txt8
-rw-r--r--usertag/anteraja_rates.tag15
7 files changed, 31 insertions, 33 deletions
diff --git a/config/pikul_cost.tag b/config/pikul_cost.tag
index c8f1052..9b36e3b 100644
--- a/config/pikul_cost.tag
+++ b/config/pikul_cost.tag
@@ -1,10 +1,24 @@
-UserTag pikul_cost Order company provisions origin destination weight service
+UserTag pikul_cost Order company district city province weight service
UserTag pikul_cost Routine <<EOR
sub {
- my ($company, $provisions, $origin, $destination, $weight, $service) = @_;
+ my ($company, $district, $city, $province, $weight, $service) = @_;
+ my @provisions, $origin, $table;
+ given ($company) {
+ when (0) {
+ @provisions = (
+ "$Tag->var('ANTERAJA_BASE_PATH', 2)",
+ "$Tag->var('ANTERAJA_ACCESS_KEY_ID', 2)",
+ "$Tag->var('ANTERAJA_SECRET_ACCESS_KEY', 2)"
+ );
+ $origin = "$Tag->var('ANTERAJA_ORIGIN', 2)";
+ $table = 'anteraja';
+ }
+ }
use Pikul;
Pikul::init($company, $provisions);
- my $cost = Pikul::cost($origin, $destination, $weight, $service);
+ my $cost = Pikul::cost($origin, $Tag->query({sql => "SELECT code FROM $table WHERE district='"
+ . $district . "' AND city='" . $city . "' AND province='" . $province . "'",
+ wantarray => 1})->[0]->[0], $weight, $service);
Pikul::cleanup();
return $cost;
}
diff --git a/dbconf/pgsql/anteraja.pgsql b/dbconf/pgsql/anteraja.pgsql
new file mode 100644
index 0000000..58f3bc8
--- /dev/null
+++ b/dbconf/pgsql/anteraja.pgsql
@@ -0,0 +1,7 @@
+Database anteraja anteraja.txt __SQLDSN__
+Database anteraja DEFAULT_TYPE VARCHAR(64)
+Database anteraja COLUMN_DEF "code=VARCHAR(8) NOT NULL PRIMARY KEY"
+Database anteraja COLUMN_DEF "district=VARCHAR(64) NOT NULL"
+Database anteraja COLUMN_DEF "city=VARCHAR(32) NOT NULL"
+Database anteraja COLUMN_DEF "province=VARCHAR(32) NOT NULL"
+Database anteraja INDEX district
diff --git a/dbconf/pgsql/shipping.pgsql b/dbconf/pgsql/shipping.pgsql
deleted file mode 100644
index f0b1870..0000000
--- a/dbconf/pgsql/shipping.pgsql
+++ /dev/null
@@ -1,7 +0,0 @@
-Database shipping shipping.txt __SQLDSN__
-Database shipping DEFAULT_TYPE VARCHAR(64)
-Database shipping COLUMN_DEF "code=VARCHAR(8) NOT NULL PRIMARY KEY"
-Database shipping COLUMN_DEF "district=VARCHAR(64) NOT NULL"
-Database shipping COLUMN_DEF "city=VARCHAR(32) NOT NULL"
-Database shipping COLUMN_DEF "province=VARCHAR(32) NOT NULL"
-Database shipping INDEX district
diff --git a/products/ship/Indonesia.csv b/products/ship/anteraja.csv
index 7b92400..7b92400 100644
--- a/products/ship/Indonesia.csv
+++ b/products/ship/anteraja.csv
diff --git a/products/ship/shipping.asc b/products/ship/shipping.asc
index ed5849a..2253c18 100644
--- a/products/ship/shipping.asc
+++ b/products/ship/shipping.asc
@@ -1,5 +1,2 @@
-anteraja: Anteraja
- crit weight
- min 1
- max 50
- cost f [anteraja_rates district='[evalue address3]' city='[evalue city]' province='[evalue state]' weight=@@TOTAL@@]
+anteraja: Anteraja Regular
+ cost f [pikul_cost company=0 district='[evalue address3]' city='[evalue city]' province='[evalue state]' weight=@@TOTAL@@ service='REG']
diff --git a/products/variable.txt b/products/variable.txt
index 531addf..1e7e3b0 100644
--- a/products/variable.txt
+++ b/products/variable.txt
@@ -1,5 +1,9 @@
code Variable pref_group
ADDRESS 123 Main St. Company
+ANTERAJA_CITY Jakarta Selatan Shipping
+ANTERAJA_DISTRICT Mampang Prapatan Shipping
+ANTERAJA_ORIGIN 31.74.03 Shipping
+ANTERAJA_PROVINCE DKI Jakarta Shipping
BANK ABC Payment
BANK_ACCOUNT_NUMBER 01-234-56 Payment
BANK_ACCOUNT_HOLDER_NAME DEF GHI Payment
@@ -11,7 +15,7 @@ CHECKOUT_MAIL 1 Cart/Checkout
CHECKOUT_MAIL_LIST 1 Cart/Checkout
CHECKOUT_PAGE ord/checkout Cart/Checkout
CHECK_ACCEPTED 1 Payment
-CITY Jakarta Selatan Company
+CITY Jakarta Company
COD_ACCEPTED 0 Payment
COMPANY __MVC_COMPANY__ Company
CREDIT_CARDS_ACCEPTED visa mc amex discover Payment
@@ -20,7 +24,6 @@ DEFAULT_COUNTRY ID Shipping
DEFAULT_LOCALE id_ID Internationalization
DEFAULT_PAYMENT_MODE bank_transfer Payment
DESCRIPTION Strategy freemium early adopters social proof bandwidth. Vesting period pivot hackathon technology network effects release angel investor bootstrapping. Partner network market founders social media venture. Angel investor paradigm shift accelerator. Company
-DISTRICT Mampang Prapatan Company
DOCROOT __MVC_DOCUMENTROOT__ Directories and Paths
EMAIL_INFO __MVC_MAILORDERTO__ Company
EMAIL_SERVICE __MVC_MAILORDERTO__ Company
@@ -62,7 +65,6 @@ PGSQL __MVC_PGSQL__ Database
PHONE (765) 555-1212 Company
POSTAL_ACCEPTED 0 Payment
PO_ACCEPTED 1 Payment
-PROVINCE DKI Jakarta Company
PUBLISH_DO_RCS 0 Admin Control
PUBLISH_NO_PAGE_ROOT 0 Admin Control
PUBLISH_PUT_IMAGES images Admin Control
diff --git a/usertag/anteraja_rates.tag b/usertag/anteraja_rates.tag
deleted file mode 100644
index 40a8afd..0000000
--- a/usertag/anteraja_rates.tag
+++ /dev/null
@@ -1,15 +0,0 @@
-UserTag anteraja_rates Order district city province weight
-UserTag anteraja_rates Routine <<EOR
-sub {
- my ($district, $city, $province, $weight) = @_;
- my @provisions = ( "@@ANTERAJA_BASE_PATH@@", "@@ANTERAJA_ACCESS_KEY_ID@@",
- "@@ANTERAJA_SECRET_ACCESS_KEY@@" );
- my $origin = $Tag->query({sql => "SELECT code FROM shipping WHERE district='". "__DISTRICT__"
- . "' AND city='" . "__CITY__" . "' AND province='" . "__PROVINCE__" . "'",
- wantarray=> 1})->[0]->[0];
- my $destination = $Tag->query({sql => "SELECT code FROM shipping WHERE district='" . $district
- . "' AND city='" . $city . "' AND province='" . $province . "'",
- wantarray=> 1})->[0]->[0];
- return $Tag->pikul_cost(0, \@provisions, "$origin", "$destination", $weight * 1000, 'REG');
-}
-EOR