Jacek Kowalski
2022-08-15 286d38fc4ab966b71f741065e9a5948544a26df2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
 
namespace SIPL\UCRM\wFirma;
 
class wFirmaApiFactory {
    protected $ucrmHelper;
 
    function __construct(UcrmHelper $ucrmHelper) {
        $this->ucrmHelper = $ucrmHelper;
    }
 
    function create(): \Webit\WFirmaSDK\Entity\ModuleApiFactory {
        $config = $this->ucrmHelper->getConfig();
        $wFirmaAuth = new \Webit\WFirmaSDK\Auth\BasicAuth($config['wfirma_username'], $config['wfirma_password']);
 
        $wFirmaEntityApiFactory = new \Webit\WFirmaSDK\Entity\EntityApiFactory();
        $wFirmaEntityApi = $wFirmaEntityApiFactory->create($wFirmaAuth);
 
        return new \Webit\WFirmaSDK\Entity\ModuleApiFactory($wFirmaEntityApi);
    }
}