From 73807e6eca56610b6aa48edf1917f8d54ce24de1 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Sat, 01 Jul 2023 10:52:44 +0000
Subject: [PATCH] Support App Key authentication to wFirma.pl API
---
manifest.json | 12 ++++++++----
composer.json | 2 +-
src/wFirmaApiFactory.php | 2 +-
README.md | 2 +-
4 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index 43e0aac..a428fd1 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
Prerequisites:
-- wFirma account with no 2FA enabled,
+- wFirma access key, secret key and app key,
- separate invoice numbering scheme with no checking created in wFirma,
- tax included pricing set in UCRM.
diff --git a/composer.json b/composer.json
index b0e8cf3..eefbeab 100644
--- a/composer.json
+++ b/composer.json
@@ -13,6 +13,6 @@
"php": ">=8.1",
"ext-json": "*",
"ubnt/ucrm-plugin-sdk": "^0.9.0",
- "webit/w-firma-api": "^2.3"
+ "webit/w-firma-api": "^2.6.0"
}
}
diff --git a/manifest.json b/manifest.json
index 9a26124..f0dfe39 100644
--- a/manifest.json
+++ b/manifest.json
@@ -18,12 +18,16 @@
},
"configuration": [
{
- "key": "wfirma_username",
- "label": "wFirma.pl username"
+ "key": "wfirma_access_key",
+ "label": "wFirma.pl Access Key"
},
{
- "key": "wfirma_password",
- "label": "wFirma.pl password"
+ "key": "wfirma_secret_key",
+ "label": "wFirma.pl Secret Key"
+ },
+ {
+ "key": "wfirma_app_key",
+ "label": "wFirma App Key"
},
{
"key": "wfirma_series_invoice",
diff --git a/src/wFirmaApiFactory.php b/src/wFirmaApiFactory.php
index a502603..70c1a9a 100644
--- a/src/wFirmaApiFactory.php
+++ b/src/wFirmaApiFactory.php
@@ -11,7 +11,7 @@
function create(): \Webit\WFirmaSDK\Entity\ModuleApiFactory {
$config = $this->ucrmHelper->getConfig();
- $wFirmaAuth = new \Webit\WFirmaSDK\Auth\BasicAuth($config['wfirma_username'], $config['wfirma_password']);
+ $wFirmaAuth = new \Webit\WFirmaSDK\Auth\ApiKeysAuth($config['wfirma_access_key'], $config['wfirma_secret_key'], $config['wfirma_app_key']);
$wFirmaEntityApiFactory = new \Webit\WFirmaSDK\Entity\EntityApiFactory();
$wFirmaEntityApi = $wFirmaEntityApiFactory->create($wFirmaAuth);
--
Gitblit v1.10.0