|
@@ -26,6 +26,15 @@ class OrderOrProformaController
|
|
$this->syncProformas();
|
|
$this->syncProformas();
|
|
return \Core\App\Factory\SettingsFactory::SELECT_PROFORMA;
|
|
return \Core\App\Factory\SettingsFactory::SELECT_PROFORMA;
|
|
}
|
|
}
|
|
|
|
+ if ($this->settingsRepository->getOptionOrderOrProforma() == \Core\App\Factory\SettingsFactory::SELECT_EXPFACTURA) {
|
|
|
|
+ $this->syncExpfactura();
|
|
|
|
+ return \Core\App\Factory\SettingsFactory::SELECT_EXPFACTURA;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ($this->settingsRepository->getOptionOrderOrProforma() == \Core\App\Factory\SettingsFactory::SELECT_AVIZE) {
|
|
|
|
+ $this->syncAvize();
|
|
|
|
+ return \Core\App\Factory\SettingsFactory::SELECT_AVIZE;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
public function syncOrders()
|
|
public function syncOrders()
|
|
@@ -114,7 +123,97 @@ class OrderOrProformaController
|
|
$facturisProformaRepository,
|
|
$facturisProformaRepository,
|
|
$this->settingsRepository
|
|
$this->settingsRepository
|
|
);
|
|
);
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ $service->sync();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function syncAvize()
|
|
|
|
+ {
|
|
|
|
+ $facturisCustomerRepository = new \Core\FacturisRepository\CustomerRepository(
|
|
|
|
+ $this->settingsRepository->getAuthApiKey(),
|
|
|
|
+ $this->settingsRepository->getAuthUsername(),
|
|
|
|
+ $this->settingsRepository->getAuthPassword(),
|
|
|
|
+ $this->settingsRepository->getAuthFiscalCode()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $facturisProductRepository = new \Core\FacturisRepository\ProductRepository(
|
|
|
|
+ $this->settingsRepository->getAuthApiKey(),
|
|
|
|
+ $this->settingsRepository->getAuthUsername(),
|
|
|
|
+ $this->settingsRepository->getAuthPassword(),
|
|
|
|
+ $this->settingsRepository->getAuthFiscalCode()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $marketplaceAvizeRepository = new \MarketplaceRepository\AvizeRepository(
|
|
|
|
+ $this->settingsRepository->getToken(),
|
|
|
|
+ $this->settingsRepository->getShop()
|
|
|
|
+ );
|
|
|
|
+ $marketplaceProductRepository = new \MarketplaceRepository\ProductRepository(
|
|
|
|
+ $this->settingsRepository->getToken(),
|
|
|
|
+ $this->settingsRepository->getShop()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ $facturisAvizeRepository = new \Core\FacturisRepository\AvizeRepository(
|
|
|
|
+ $this->settingsRepository->getAuthApiKey(),
|
|
|
|
+ $this->settingsRepository->getAuthUsername(),
|
|
|
|
+ $this->settingsRepository->getAuthPassword(),
|
|
|
|
+ $this->settingsRepository->getAuthFiscalCode()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $service = new \Core\App\Service\AvizeService(
|
|
|
|
+ $marketplaceAvizeRepository,
|
|
|
|
+ $marketplaceProductRepository,
|
|
|
|
+ $facturisCustomerRepository,
|
|
|
|
+ $facturisProductRepository,
|
|
|
|
+ $facturisAvizeRepository,
|
|
|
|
+ $this->settingsRepository
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $service->sync();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function syncExpfactura()
|
|
|
|
+ {
|
|
|
|
+ $facturisCustomerRepository = new \Core\FacturisRepository\CustomerRepository(
|
|
|
|
+ $this->settingsRepository->getAuthApiKey(),
|
|
|
|
+ $this->settingsRepository->getAuthUsername(),
|
|
|
|
+ $this->settingsRepository->getAuthPassword(),
|
|
|
|
+ $this->settingsRepository->getAuthFiscalCode()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $facturisProductRepository = new \Core\FacturisRepository\ProductRepository(
|
|
|
|
+ $this->settingsRepository->getAuthApiKey(),
|
|
|
|
+ $this->settingsRepository->getAuthUsername(),
|
|
|
|
+ $this->settingsRepository->getAuthPassword(),
|
|
|
|
+ $this->settingsRepository->getAuthFiscalCode()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $marketplaceExpfacturaRepository = new \MarketplaceRepository\ExpfacturaRepository(
|
|
|
|
+ $this->settingsRepository->getToken(),
|
|
|
|
+ $this->settingsRepository->getShop()
|
|
|
|
+ );
|
|
|
|
+ $marketplaceProductRepository = new \MarketplaceRepository\ProductRepository(
|
|
|
|
+ $this->settingsRepository->getToken(),
|
|
|
|
+ $this->settingsRepository->getShop()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ $facturisExpfacturaRepository = new \Core\FacturisRepository\ExpfacturaRepository(
|
|
|
|
+ $this->settingsRepository->getAuthApiKey(),
|
|
|
|
+ $this->settingsRepository->getAuthUsername(),
|
|
|
|
+ $this->settingsRepository->getAuthPassword(),
|
|
|
|
+ $this->settingsRepository->getAuthFiscalCode()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $service = new \Core\App\Service\ExpfacturaService(
|
|
|
|
+ $marketplaceExpfacturaRepository,
|
|
|
|
+ $marketplaceProductRepository,
|
|
|
|
+ $facturisCustomerRepository,
|
|
|
|
+ $facturisProductRepository,
|
|
|
|
+ $facturisExpfacturaRepository,
|
|
|
|
+ $this->settingsRepository
|
|
|
|
+ );
|
|
|
|
+
|
|
$service->sync();
|
|
$service->sync();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -126,5 +225,254 @@ class OrderOrProformaController
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public function addProforma($orderId)
|
|
|
|
+ {
|
|
|
|
+ $facturisCustomerRepository = new \Core\FacturisRepository\CustomerRepository(
|
|
|
|
+ $this->settingsRepository->getAuthApiKey(),
|
|
|
|
+ $this->settingsRepository->getAuthUsername(),
|
|
|
|
+ $this->settingsRepository->getAuthPassword(),
|
|
|
|
+ $this->settingsRepository->getAuthFiscalCode()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $facturisProductRepository = new \Core\FacturisRepository\ProductRepository(
|
|
|
|
+ $this->settingsRepository->getAuthApiKey(),
|
|
|
|
+ $this->settingsRepository->getAuthUsername(),
|
|
|
|
+ $this->settingsRepository->getAuthPassword(),
|
|
|
|
+ $this->settingsRepository->getAuthFiscalCode()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $marketplaceProformaRepository = new \MarketplaceRepository\ProformaRepository(
|
|
|
|
+ $this->settingsRepository->getToken(),
|
|
|
|
+ $this->settingsRepository->getShop()
|
|
|
|
+ );
|
|
|
|
+ $marketplaceProductRepository = new \MarketplaceRepository\ProductRepository(
|
|
|
|
+ $this->settingsRepository->getToken(),
|
|
|
|
+ $this->settingsRepository->getShop()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $facturisProformaRepository = new \Core\FacturisRepository\ProformaRepository(
|
|
|
|
+ $this->settingsRepository->getAuthApiKey(),
|
|
|
|
+ $this->settingsRepository->getAuthUsername(),
|
|
|
|
+ $this->settingsRepository->getAuthPassword(),
|
|
|
|
+ $this->settingsRepository->getAuthFiscalCode()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $service = new \Core\App\Service\ProformaService(
|
|
|
|
+ $marketplaceProformaRepository,
|
|
|
|
+ $marketplaceProductRepository,
|
|
|
|
+ $facturisCustomerRepository,
|
|
|
|
+ $facturisProductRepository,
|
|
|
|
+ $facturisProformaRepository,
|
|
|
|
+ $this->settingsRepository
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $result = $service->add($orderId);
|
|
|
|
+ return $result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function addAvize($orderId)
|
|
|
|
+ {
|
|
|
|
+ $facturisCustomerRepository = new \Core\FacturisRepository\CustomerRepository(
|
|
|
|
+ $this->settingsRepository->getAuthApiKey(),
|
|
|
|
+ $this->settingsRepository->getAuthUsername(),
|
|
|
|
+ $this->settingsRepository->getAuthPassword(),
|
|
|
|
+ $this->settingsRepository->getAuthFiscalCode()
|
|
|
|
+ );
|
|
|
|
|
|
-}
|
|
|
|
|
|
+ $facturisProductRepository = new \Core\FacturisRepository\ProductRepository(
|
|
|
|
+ $this->settingsRepository->getAuthApiKey(),
|
|
|
|
+ $this->settingsRepository->getAuthUsername(),
|
|
|
|
+ $this->settingsRepository->getAuthPassword(),
|
|
|
|
+ $this->settingsRepository->getAuthFiscalCode()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $marketplaceAvizeRepository = new \MarketplaceRepository\AvizeRepository(
|
|
|
|
+ $this->settingsRepository->getToken(),
|
|
|
|
+ $this->settingsRepository->getShop()
|
|
|
|
+ );
|
|
|
|
+ $marketplaceProductRepository = new \MarketplaceRepository\ProductRepository(
|
|
|
|
+ $this->settingsRepository->getToken(),
|
|
|
|
+ $this->settingsRepository->getShop()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $facturisAvizeRepository = new \Core\FacturisRepository\AvizeRepository(
|
|
|
|
+ $this->settingsRepository->getAuthApiKey(),
|
|
|
|
+ $this->settingsRepository->getAuthUsername(),
|
|
|
|
+ $this->settingsRepository->getAuthPassword(),
|
|
|
|
+ $this->settingsRepository->getAuthFiscalCode()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $service = new \Core\App\Service\AvizeService(
|
|
|
|
+ $marketplaceAvizeRepository,
|
|
|
|
+ $marketplaceProductRepository,
|
|
|
|
+ $facturisCustomerRepository,
|
|
|
|
+ $facturisProductRepository,
|
|
|
|
+ $facturisAvizeRepository,
|
|
|
|
+ $this->settingsRepository
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $result = $service->add($orderId);
|
|
|
|
+ return $result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function addExpfactura($orderId)
|
|
|
|
+ {
|
|
|
|
+ $facturisCustomerRepository = new \Core\FacturisRepository\CustomerRepository(
|
|
|
|
+ $this->settingsRepository->getAuthApiKey(),
|
|
|
|
+ $this->settingsRepository->getAuthUsername(),
|
|
|
|
+ $this->settingsRepository->getAuthPassword(),
|
|
|
|
+ $this->settingsRepository->getAuthFiscalCode()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $facturisProductRepository = new \Core\FacturisRepository\ProductRepository(
|
|
|
|
+ $this->settingsRepository->getAuthApiKey(),
|
|
|
|
+ $this->settingsRepository->getAuthUsername(),
|
|
|
|
+ $this->settingsRepository->getAuthPassword(),
|
|
|
|
+ $this->settingsRepository->getAuthFiscalCode()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $marketplaceExpfacturaRepository = new \MarketplaceRepository\ExpfacturaRepository(
|
|
|
|
+ $this->settingsRepository->getToken(),
|
|
|
|
+ $this->settingsRepository->getShop()
|
|
|
|
+ );
|
|
|
|
+ $marketplaceProductRepository = new \MarketplaceRepository\ProductRepository(
|
|
|
|
+ $this->settingsRepository->getToken(),
|
|
|
|
+ $this->settingsRepository->getShop()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $facturisExpfacturaRepository = new \Core\FacturisRepository\ExpfacturaRepository(
|
|
|
|
+ $this->settingsRepository->getAuthApiKey(),
|
|
|
|
+ $this->settingsRepository->getAuthUsername(),
|
|
|
|
+ $this->settingsRepository->getAuthPassword(),
|
|
|
|
+ $this->settingsRepository->getAuthFiscalCode()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $service = new \Core\App\Service\ExpfacturaService(
|
|
|
|
+ $marketplaceExpfacturaRepository,
|
|
|
|
+ $marketplaceProductRepository,
|
|
|
|
+ $facturisCustomerRepository,
|
|
|
|
+ $facturisProductRepository,
|
|
|
|
+ $facturisExpfacturaRepository,
|
|
|
|
+ $this->settingsRepository
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $result = $service->add($orderId);
|
|
|
|
+ return $result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function viewProforma($orderId)
|
|
|
|
+ {
|
|
|
|
+ $marketplaceProformaRepository = new \MarketplaceRepository\ProformaRepository(
|
|
|
|
+ $this->settingsRepository->getToken(),
|
|
|
|
+ $this->settingsRepository->getShop()
|
|
|
|
+ );
|
|
|
|
+ $factId = $marketplaceProformaRepository->getFactId($orderId);
|
|
|
|
+
|
|
|
|
+ $facturisProformaRepository = new \Core\FacturisRepository\ProformaRepository(
|
|
|
|
+ $this->settingsRepository->getAuthApiKey(),
|
|
|
|
+ $this->settingsRepository->getAuthUsername(),
|
|
|
|
+ $this->settingsRepository->getAuthPassword(),
|
|
|
|
+ $this->settingsRepository->getAuthFiscalCode()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $facturisProformaRepository->view($factId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function viewAvize($orderId)
|
|
|
|
+ {
|
|
|
|
+ $marketplaceAvizeRepository = new \MarketplaceRepository\AvizeRepository(
|
|
|
|
+ $this->settingsRepository->getToken(),
|
|
|
|
+ $this->settingsRepository->getShop()
|
|
|
|
+ );
|
|
|
|
+ $factId = $marketplaceAvizeRepository->getFactId($orderId);
|
|
|
|
+
|
|
|
|
+ $facturisAvizeRepository = new \Core\FacturisRepository\AvizeRepository(
|
|
|
|
+ $this->settingsRepository->getAuthApiKey(),
|
|
|
|
+ $this->settingsRepository->getAuthUsername(),
|
|
|
|
+ $this->settingsRepository->getAuthPassword(),
|
|
|
|
+ $this->settingsRepository->getAuthFiscalCode()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $facturisAvizeRepository->view($factId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function viewExpfactura($orderId)
|
|
|
|
+ {
|
|
|
|
+ $marketplaceExpfacturaRepository = new \MarketplaceRepository\ExpfacturaRepository(
|
|
|
|
+ $this->settingsRepository->getToken(),
|
|
|
|
+ $this->settingsRepository->getShop()
|
|
|
|
+ );
|
|
|
|
+ $factId = $marketplaceExpfacturaRepository->getFactId($orderId);
|
|
|
|
+
|
|
|
|
+ $facturisExpfacturaRepository = new \Core\FacturisRepository\ExpfacturaRepository(
|
|
|
|
+ $this->settingsRepository->getAuthApiKey(),
|
|
|
|
+ $this->settingsRepository->getAuthUsername(),
|
|
|
|
+ $this->settingsRepository->getAuthPassword(),
|
|
|
|
+ $this->settingsRepository->getAuthFiscalCode()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $facturisExpfacturaRepository->view($factId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function addInvoice($orderId)
|
|
|
|
+ {
|
|
|
|
+ $facturisCustomerRepository = new \Core\FacturisRepository\CustomerRepository(
|
|
|
|
+ $this->settingsRepository->getAuthApiKey(),
|
|
|
|
+ $this->settingsRepository->getAuthUsername(),
|
|
|
|
+ $this->settingsRepository->getAuthPassword(),
|
|
|
|
+ $this->settingsRepository->getAuthFiscalCode()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $facturisProductRepository = new \Core\FacturisRepository\ProductRepository(
|
|
|
|
+ $this->settingsRepository->getAuthApiKey(),
|
|
|
|
+ $this->settingsRepository->getAuthUsername(),
|
|
|
|
+ $this->settingsRepository->getAuthPassword(),
|
|
|
|
+ $this->settingsRepository->getAuthFiscalCode()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $marketplaceInvoiceRepository = new \MarketplaceRepository\InvoiceRepository(
|
|
|
|
+ $this->settingsRepository->getToken(),
|
|
|
|
+ $this->settingsRepository->getShop()
|
|
|
|
+ );
|
|
|
|
+ $marketplaceProductRepository = new \MarketplaceRepository\ProductRepository(
|
|
|
|
+ $this->settingsRepository->getToken(),
|
|
|
|
+ $this->settingsRepository->getShop()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $facturisInvoiceRepository = new \Core\FacturisRepository\InvoiceRepository(
|
|
|
|
+ $this->settingsRepository->getAuthApiKey(),
|
|
|
|
+ $this->settingsRepository->getAuthUsername(),
|
|
|
|
+ $this->settingsRepository->getAuthPassword(),
|
|
|
|
+ $this->settingsRepository->getAuthFiscalCode()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $service = new \Core\App\Service\InvoiceService(
|
|
|
|
+ $marketplaceInvoiceRepository,
|
|
|
|
+ $marketplaceProductRepository,
|
|
|
|
+ $facturisCustomerRepository,
|
|
|
|
+ $facturisProductRepository,
|
|
|
|
+ $facturisInvoiceRepository,
|
|
|
|
+ $this->settingsRepository
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ return $service->add($orderId);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+ public function viewInvoice($orderId)
|
|
|
|
+ {
|
|
|
|
+ $marketplaceInvoiceRepository = new \MarketplaceRepository\InvoiceRepository(
|
|
|
|
+ $this->settingsRepository->getToken(),
|
|
|
|
+ $this->settingsRepository->getShop()
|
|
|
|
+ );
|
|
|
|
+ $factId = $marketplaceInvoiceRepository->getFactId($orderId);
|
|
|
|
+
|
|
|
|
+ $facturisInvoiceRepository = new \Core\FacturisRepository\InvoiceRepository(
|
|
|
|
+ $this->settingsRepository->getAuthApiKey(),
|
|
|
|
+ $this->settingsRepository->getAuthUsername(),
|
|
|
|
+ $this->settingsRepository->getAuthPassword(),
|
|
|
|
+ $this->settingsRepository->getAuthFiscalCode()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $facturisInvoiceRepository->view($factId);
|
|
|
|
+ }
|
|
|
|
+}
|