From a4d1f3925be671b2caacd4428aa7be33e27ea146 Mon Sep 17 00:00:00 2001 From: Gundo Sifhufhi <sifhufhisg@gmail.com> Date: Fri, 30 Dec 2022 21:22:43 +0200 Subject: [PATCH] Add admin input fields and store Client ID, Secret and Rates endpoint to DB --- .../Model/Carrier/Customshipping.php | 3 ++- .../Customshipping/etc/adminhtml/system.xml | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/uafrica/Customshipping/Model/Carrier/Customshipping.php b/uafrica/Customshipping/Model/Carrier/Customshipping.php index 49c88c0..4478292 100644 --- a/uafrica/Customshipping/Model/Carrier/Customshipping.php +++ b/uafrica/Customshipping/Model/Carrier/Customshipping.php @@ -374,11 +374,12 @@ class Customshipping extends AbstractCarrier implements CarrierInterface */ private function getApiUrl(): string { - //return $this->getConfigData('api_url'); // return 'https://api.dev.ship.uafrica.com'; //Used for testing purposes only on localhost, since there is not endpoint to get magento rates to work with //Basically, I am using the structure of the response from the uAfrica API to test the functionality of the module + // return $this->getConfigData('rates_endpoint'); + return 'https://8390956f-c00b-497d-8742-87b1d6305bd2.mock.pstmn.io/putrates'; } diff --git a/uafrica/Customshipping/etc/adminhtml/system.xml b/uafrica/Customshipping/etc/adminhtml/system.xml index 7b5c5b8..28a9dbc 100644 --- a/uafrica/Customshipping/etc/adminhtml/system.xml +++ b/uafrica/Customshipping/etc/adminhtml/system.xml @@ -38,7 +38,7 @@ </section> <section id="carriers" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1"> <group id="uafrica" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> - <label>bobGo</label> + <label>uAfrica</label> <field id="version" translate="label" type="label" sortOrder="0" showInDefault="1" showInWebsite="0" showInStore="0"> <label>Version</label> @@ -133,8 +133,21 @@ <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> <field id="access_token" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0"> - <label>BobGo Access Token</label> - <comment>The Access token you received from BobGo</comment> + <label>uAfrica Access Token</label> + <comment>The Access token you received from uAfrica</comment> + </field> + <field id="client_id" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0"> + <label>uAfrica Client ID</label> + <comment>The Client ID you received from uAfrica</comment> + </field> + <field id="client_secret" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0"> + <label>uAfrica Client Secret</label> + <comment>The Client Secret you received from uAfrica</comment> + </field> + <field id="rates_endpoint" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0"> + <label>uAfrica Rates</label> + <comment>Rates at check out collection Endpoint</comment> + </field> <field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0"> -- GitLab