diff --git a/.github/workflows/translations_modules.yml b/.github/workflows/translations_modules.yml deleted file mode 100644 index 2ba86308c..000000000 --- a/.github/workflows/translations_modules.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Translations of Modules - -on: - schedule: - - cron: '0 0 * * *' - workflow_dispatch: - -jobs: - sync: - name: Sync - - runs-on: ubuntu-latest - - steps: - - - name: Checkout - uses: actions/checkout@v2 - - - name: Sync with Crowdin - uses: crowdin/github-action@master - with: - upload_sources: true - upload_translations: true - download_translations: true - skip_untranslated_files: true - - localization_branch_name: 'translations-modules' - commit_message: 'new crowdin translations of modules' - pull_request_title: 'New Crowdin translations of modules' - pull_request_body: 'https://crowdin.com/project/akaunting-apps' - pull_request_labels: 'Translation' - - config: 'crowdin_modules.yml' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_APPS_ID }} - CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} diff --git a/.gitignore b/.gitignore index 5e52afa9f..c3b794d89 100644 --- a/.gitignore +++ b/.gitignore @@ -93,7 +93,4 @@ _ide_helper_models.php /storage/debugbar/* .phpunit.result.cache modules/* -!modules/OfflinePayments -!modules/PaypalStandard -!modules/BC21 .laravelstatsrc diff --git a/composer.json b/composer.json index d55f0ad69..4ddc169e2 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,9 @@ "akaunting/language": "1.0.*", "akaunting/menu": "1.0.*", "akaunting/module": "2.0.*", + "akaunting/module-bc21": "^2.0", + "akaunting/module-offline-payments": "^2.0", + "akaunting/module-paypal-standard": "^2.0", "akaunting/money": "1.2.*", "akaunting/setting": "1.2.*", "akaunting/version": "1.0.*", @@ -47,6 +50,7 @@ "lorisleiva/laravel-search-string": "1.1.*", "maatwebsite/excel": "3.1.*", "monooso/unobserve": "^3.0", + "mnsami/composer-custom-directory-installer": "2.0.*", "plank/laravel-mediable": "4.4.*", "riverskies/laravel-mobile-detect": "^1.3", "santigarcor/laratrust": "6.3.*", @@ -67,6 +71,11 @@ "extra": { "laravel": { "dont-discover": [] + }, + "installer-paths": { + "modules/BC21": ["akaunting/module-bc21"], + "modules/OfflinePayments": ["akaunting/module-offline-payments"], + "modules/PaypalStandard": ["akaunting/module-paypal-standard"] } }, "autoload": { diff --git a/composer.lock b/composer.lock index 61a074626..eeee330bc 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "79c12898250f9e11176ed2a82226d3fa", + "content-hash": "7957d8f2405488fbcac455b6ed3f5856", "packages": [ { "name": "akaunting/firewall", @@ -209,16 +209,16 @@ }, { "name": "akaunting/module", - "version": "2.0.5", + "version": "2.0.6", "source": { "type": "git", "url": "https://github.com/akaunting/module.git", - "reference": "d4b82b8f25d8ef1d220b68f23e0b20946037822a" + "reference": "e8d5a883a8c0e66baaaaa59b6726d7738c406933" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/akaunting/module/zipball/d4b82b8f25d8ef1d220b68f23e0b20946037822a", - "reference": "d4b82b8f25d8ef1d220b68f23e0b20946037822a", + "url": "https://api.github.com/repos/akaunting/module/zipball/e8d5a883a8c0e66baaaaa59b6726d7738c406933", + "reference": "e8d5a883a8c0e66baaaaa59b6726d7738c406933", "shasum": "" }, "require": { @@ -273,9 +273,76 @@ ], "support": { "issues": "https://github.com/akaunting/module/issues", - "source": "https://github.com/akaunting/module/tree/2.0.5" + "source": "https://github.com/akaunting/module/tree/2.0.6" }, - "time": "2021-02-25T11:15:01+00:00" + "time": "2021-03-04T08:17:22+00:00" + }, + { + "name": "akaunting/module-offline-payments", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/akaunting/module-offline-payments.git", + "reference": "09bd63c03bd81c524d97bc112ca29f0d82c14e46" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/akaunting/module-offline-payments/zipball/09bd63c03bd81c524d97bc112ca29f0d82c14e46", + "reference": "09bd63c03bd81c524d97bc112ca29f0d82c14e46", + "shasum": "" + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-3.0+" + ], + "description": "Offline Payments app for Akaunting", + "homepage": "https://akaunting.com", + "keywords": [ + "Accounting", + "akaunting", + "invoice", + "laravel", + "offline-payments" + ], + "support": { + "issues": "https://github.com/akaunting/module-offline-payments/issues", + "source": "https://github.com/akaunting/module-offline-payments/tree/2.0.0" + }, + "time": "2021-03-04T09:00:22+00:00" + }, + { + "name": "akaunting/module-paypal-standard", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/akaunting/module-paypal-standard.git", + "reference": "0dd391492c6ae47f2d91abe27165907029bf7960" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/akaunting/module-paypal-standard/zipball/0dd391492c6ae47f2d91abe27165907029bf7960", + "reference": "0dd391492c6ae47f2d91abe27165907029bf7960", + "shasum": "" + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-3.0+" + ], + "description": "Paypal Standard app for Akaunting", + "homepage": "https://akaunting.com", + "keywords": [ + "Accounting", + "invoice", + "laravel", + "paypal" + ], + "support": { + "issues": "https://github.com/akaunting/module-paypal-standard/issues", + "source": "https://github.com/akaunting/module-paypal-standard/tree/2.0.0" + }, + "time": "2021-03-04T08:53:43+00:00" }, { "name": "akaunting/money", @@ -4148,16 +4215,16 @@ }, { "name": "jaybizzle/crawler-detect", - "version": "v1.2.104", + "version": "v1.2.105", "source": { "type": "git", "url": "https://github.com/JayBizzle/Crawler-Detect.git", - "reference": "a581e89a9212c4e9d18049666dc735718c29de9c" + "reference": "719c1ed49224857800c3dc40838b6b761d046105" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/JayBizzle/Crawler-Detect/zipball/a581e89a9212c4e9d18049666dc735718c29de9c", - "reference": "a581e89a9212c4e9d18049666dc735718c29de9c", + "url": "https://api.github.com/repos/JayBizzle/Crawler-Detect/zipball/719c1ed49224857800c3dc40838b6b761d046105", + "reference": "719c1ed49224857800c3dc40838b6b761d046105", "shasum": "" }, "require": { @@ -4194,9 +4261,9 @@ ], "support": { "issues": "https://github.com/JayBizzle/Crawler-Detect/issues", - "source": "https://github.com/JayBizzle/Crawler-Detect/tree/v1.2.104" + "source": "https://github.com/JayBizzle/Crawler-Detect/tree/v1.2.105" }, - "time": "2021-01-13T15:25:20+00:00" + "time": "2021-03-03T20:55:48+00:00" }, { "name": "jenssegers/agent", @@ -4522,16 +4589,16 @@ }, { "name": "laravel/framework", - "version": "v8.29.0", + "version": "v8.30.1", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "d2eba352b3b3a3c515b18c5726b373fe5026733e" + "reference": "ab7e1c19ee0403e15fc59983b7ccb86d85db45e6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/d2eba352b3b3a3c515b18c5726b373fe5026733e", - "reference": "d2eba352b3b3a3c515b18c5726b373fe5026733e", + "url": "https://api.github.com/repos/laravel/framework/zipball/ab7e1c19ee0403e15fc59983b7ccb86d85db45e6", + "reference": "ab7e1c19ee0403e15fc59983b7ccb86d85db45e6", "shasum": "" }, "require": { @@ -4686,20 +4753,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2021-02-23T14:27:41+00:00" + "time": "2021-03-03T14:59:13+00:00" }, { "name": "laravel/tinker", - "version": "v2.6.0", + "version": "v2.6.1", "source": { "type": "git", "url": "https://github.com/laravel/tinker.git", - "reference": "daae1c43f1300fe88c05d83db6f3d8f76677ad88" + "reference": "04ad32c1a3328081097a181875733fa51f402083" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/tinker/zipball/daae1c43f1300fe88c05d83db6f3d8f76677ad88", - "reference": "daae1c43f1300fe88c05d83db6f3d8f76677ad88", + "url": "https://api.github.com/repos/laravel/tinker/zipball/04ad32c1a3328081097a181875733fa51f402083", + "reference": "04ad32c1a3328081097a181875733fa51f402083", "shasum": "" }, "require": { @@ -4752,9 +4819,9 @@ ], "support": { "issues": "https://github.com/laravel/tinker/issues", - "source": "https://github.com/laravel/tinker/tree/v2.6.0" + "source": "https://github.com/laravel/tinker/tree/v2.6.1" }, - "time": "2021-01-26T20:35:18+00:00" + "time": "2021-03-02T16:53:12+00:00" }, { "name": "laravel/ui", @@ -5850,6 +5917,62 @@ }, "time": "2020-12-07T11:07:24+00:00" }, + { + "name": "mnsami/composer-custom-directory-installer", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/mnsami/composer-custom-directory-installer.git", + "reference": "85f66323978d0b1cb0e6acc7f69b3e7b912f82d9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mnsami/composer-custom-directory-installer/zipball/85f66323978d0b1cb0e6acc7f69b3e7b912f82d9", + "reference": "85f66323978d0b1cb0e6acc7f69b3e7b912f82d9", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0 || ^2.0", + "php": ">=5.3" + }, + "type": "composer-plugin", + "extra": { + "class": [ + "Composer\\CustomDirectoryInstaller\\LibraryPlugin", + "Composer\\CustomDirectoryInstaller\\PearPlugin", + "Composer\\CustomDirectoryInstaller\\PluginPlugin" + ], + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-0": { + "Composer\\CustomDirectoryInstaller": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mina Nabil Sami", + "email": "mina.nsami@gmail.com" + } + ], + "description": "A composer plugin, to help install packages of different types in custom paths.", + "keywords": [ + "composer", + "composer-installer", + "composer-plugin" + ], + "support": { + "issues": "https://github.com/mnsami/composer-custom-directory-installer/issues", + "source": "https://github.com/mnsami/composer-custom-directory-installer/tree/2.0.0" + }, + "time": "2020-08-18T11:00:11+00:00" + }, { "name": "mobiledetect/mobiledetectlib", "version": "2.8.37", @@ -7186,16 +7309,16 @@ }, { "name": "phpoffice/phpspreadsheet", - "version": "1.16.0", + "version": "1.17.1", "source": { "type": "git", "url": "https://github.com/PHPOffice/PhpSpreadsheet.git", - "reference": "76d4323b85129d0c368149c831a07a3e258b2b50" + "reference": "c55269cb06911575a126dc225a05c0e4626e5fb4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/76d4323b85129d0c368149c831a07a3e258b2b50", - "reference": "76d4323b85129d0c368149c831a07a3e258b2b50", + "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/c55269cb06911575a126dc225a05c0e4626e5fb4", + "reference": "c55269cb06911575a126dc225a05c0e4626e5fb4", "shasum": "" }, "require": { @@ -7223,7 +7346,7 @@ }, "require-dev": { "dompdf/dompdf": "^0.8.5", - "friendsofphp/php-cs-fixer": "^2.16", + "friendsofphp/php-cs-fixer": "^2.18", "jpgraph/jpgraph": "^4.0", "mpdf/mpdf": "^8.0", "phpcompatibility/php-compatibility": "^9.3", @@ -7281,9 +7404,9 @@ ], "support": { "issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues", - "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.16.0" + "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.17.1" }, - "time": "2020-12-31T18:03:49+00:00" + "time": "2021-03-02T17:54:11+00:00" }, { "name": "phpoption/phpoption", @@ -8312,16 +8435,16 @@ }, { "name": "santigarcor/laratrust", - "version": "6.3.1", + "version": "6.3.2", "source": { "type": "git", "url": "https://github.com/santigarcor/laratrust.git", - "reference": "dcb43416ecfeacb67e056423780e288c325e9c82" + "reference": "9ab3bfdc06afe18b17f69b77cb77291c36dae9f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/santigarcor/laratrust/zipball/dcb43416ecfeacb67e056423780e288c325e9c82", - "reference": "dcb43416ecfeacb67e056423780e288c325e9c82", + "url": "https://api.github.com/repos/santigarcor/laratrust/zipball/9ab3bfdc06afe18b17f69b77cb77291c36dae9f6", + "reference": "9ab3bfdc06afe18b17f69b77cb77291c36dae9f6", "shasum": "" }, "require": { @@ -8375,7 +8498,7 @@ ], "support": { "issues": "https://github.com/santigarcor/laratrust/issues", - "source": "https://github.com/santigarcor/laratrust/tree/6.3.1" + "source": "https://github.com/santigarcor/laratrust/tree/6.3.2" }, "funding": [ { @@ -8383,7 +8506,7 @@ "type": "github" } ], - "time": "2020-12-09T14:25:23+00:00" + "time": "2021-03-03T13:34:32+00:00" }, { "name": "seld/jsonlint", @@ -11580,16 +11703,16 @@ }, { "name": "facade/ignition", - "version": "2.5.13", + "version": "2.5.14", "source": { "type": "git", "url": "https://github.com/facade/ignition.git", - "reference": "5e9ef386aaad9985cee2ac23281a27568d083b7e" + "reference": "17097f7a83e200d90d1cf9f4d1b35c1001513a47" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/facade/ignition/zipball/5e9ef386aaad9985cee2ac23281a27568d083b7e", - "reference": "5e9ef386aaad9985cee2ac23281a27568d083b7e", + "url": "https://api.github.com/repos/facade/ignition/zipball/17097f7a83e200d90d1cf9f4d1b35c1001513a47", + "reference": "17097f7a83e200d90d1cf9f4d1b35c1001513a47", "shasum": "" }, "require": { @@ -11653,7 +11776,7 @@ "issues": "https://github.com/facade/ignition/issues", "source": "https://github.com/facade/ignition" }, - "time": "2021-02-16T12:46:19+00:00" + "time": "2021-03-04T08:48:01+00:00" }, { "name": "facade/ignition-contracts", diff --git a/crowdin_modules.yml b/crowdin_modules.yml deleted file mode 100644 index 6fee73225..000000000 --- a/crowdin_modules.yml +++ /dev/null @@ -1,22 +0,0 @@ -"project_id_env": CROWDIN_PROJECT_ID -"api_token_env": CROWDIN_PERSONAL_TOKEN -"preserve_hierarchy": true - -"files": [ - { - "source": "modules/OfflinePayments/Resources/lang/en-GB/general.php", - "dest": "offline-payments/general.php", - "translation": "modules/OfflinePayments/Resources/lang/%locale%/offline-payments/general.php", - "translation_replace": { - "offline-payments/": "" - } - }, - { - "source": "modules/PaypalStandard/Resources/lang/en-GB/general.php", - "dest": "paypal-standard/general.php", - "translation": "modules/PaypalStandard/Resources/lang/%locale%/paypal-standard/general.php", - "translation_replace": { - "paypal-standard/": "" - } - } -] diff --git a/modules/BC21/Abstracts/DocumentModel.php b/modules/BC21/Abstracts/DocumentModel.php deleted file mode 100644 index ed75f4a2b..000000000 --- a/modules/BC21/Abstracts/DocumentModel.php +++ /dev/null @@ -1,13 +0,0 @@ -with('contact', 'histories', 'items', 'transactions')->collect(['issued_at'=> 'desc']); - - return $this->response->paginator($bills, new Transformer()); - } - - /** - * Display the specified resource. - * - * @param Document $bill - * - * @return \Dingo\Api\Http\Response - */ - public function show(Document $bill) - { - return $this->response->item($bill, new Transformer()); - } - - /** - * Store a newly created resource in storage. - * - * @param $request - * - * @return \Dingo\Api\Http\Response - */ - public function store(Request $request) - { - $bill = $this->dispatch(new CreateDocument($request)); - - return $this->response->created(route('api.bills.show', $bill->id)); - } - - /** - * Update the specified resource in storage. - * - * @param $bill - * @param $request - * - * @return \Dingo\Api\Http\Response - */ - public function update(Document $bill, Request $request) - { - $bill = $this->dispatch(new UpdateDocument($bill, $request)); - - return $this->item($bill->fresh(), new Transformer()); - } - - /** - * Remove the specified resource from storage. - * - * @param Document $bill - * - * @return \Dingo\Api\Http\Response - */ - public function destroy(Document $bill) - { - try { - $this->dispatch(new DeleteDocument($bill)); - - return $this->response->noContent(); - } catch(\Exception $e) { - $this->response->errorUnauthorized($e->getMessage()); - } - } -} diff --git a/modules/BC21/Http/Controllers/Api/Sales/InvoiceTransactions.php b/modules/BC21/Http/Controllers/Api/Sales/InvoiceTransactions.php deleted file mode 100644 index f4dc09f28..000000000 --- a/modules/BC21/Http/Controllers/Api/Sales/InvoiceTransactions.php +++ /dev/null @@ -1,85 +0,0 @@ -middleware('permission:create-banking-transactions')->only('create', 'store', 'duplicate', 'import'); - $this->middleware('permission:read-banking-transactions')->only('index', 'show', 'edit', 'export'); - $this->middleware('permission:update-banking-transactions')->only('update', 'enable', 'disable'); - $this->middleware('permission:delete-banking-transactions')->only('destroy'); - } - - /** - * Display a listing of the resource. - * - * @param $invoice_id - * @return \Dingo\Api\Http\Response - */ - public function index($invoice_id) - { - $transactions = Transaction::documentId($invoice_id)->get(); - - return $this->response->collection($transactions, new Transformer()); - } - - /** - * Display the specified resource. - * - * @param $invoice_id - * @param $id - * @return \Dingo\Api\Http\Response - */ - public function show($invoice_id, $id) - { - $transaction = Transaction::documentId($invoice_id)->find($id); - - return $this->response->item($transaction, new Transformer()); - } - - /** - * Store a newly created resource in storage. - * - * @param $invoice_id - * @param $request - * @return \Dingo\Api\Http\Response - */ - public function store($invoice_id, Request $request) - { - $invoice = Document::find($invoice_id); - - $transaction = $this->dispatch(new CreateBankingDocumentTransaction($invoice, $request)); - - return $this->response->created(url('api/invoices/' . $invoice_id . '/transactions/' . $transaction->id)); - } - - /** - * Remove the specified resource from storage. - * - * @param $invoice_id - * @param $id - * @return \Dingo\Api\Http\Response - */ - public function destroy($invoice_id, $id) - { - $transaction = Transaction::documentId($invoice_id)->find($id); - - $this->dispatch(new DeleteTransaction($transaction)); - - return $this->response->noContent(); - } -} diff --git a/modules/BC21/Http/Controllers/Api/Sales/Invoices.php b/modules/BC21/Http/Controllers/Api/Sales/Invoices.php deleted file mode 100644 index c8831390d..000000000 --- a/modules/BC21/Http/Controllers/Api/Sales/Invoices.php +++ /dev/null @@ -1,91 +0,0 @@ -with('contact', 'histories', 'items', 'transactions')->collect(['issued_at'=> 'desc']); - - return $this->response->paginator($invoices, new Transformer()); - } - - /** - * Display the specified resource. - * - * @param $id - * @return \Dingo\Api\Http\Response - */ - public function show($id) - { - // Check if we're querying by id or number - if (is_numeric($id)) { - $invoice = Document::find($id); - } else { - $invoice = Document::where('document_number', $id)->first(); - } - - return $this->response->item($invoice, new Transformer()); - } - - /** - * Store a newly created resource in storage. - * - * @param $request - * - * @return \Dingo\Api\Http\Response - */ - public function store(Request $request) - { - $invoice = $this->dispatch(new CreateDocument($request)); - - return $this->response->created(route('api.invoices.show', $invoice->id)); - } - - /** - * Update the specified resource in storage. - * - * @param $invoice - * @param $request - * - * @return \Dingo\Api\Http\Response - */ - public function update(Document $invoice, Request $request) - { - $invoice = $this->dispatch(new UpdateDocument($invoice, $request)); - - return $this->response->item($invoice->fresh(), new Transformer()); - } - - /** - * Remove the specified resource from storage. - * - * @param Document $invoice - * - * @return \Dingo\Api\Http\Response - */ - public function destroy(Document $invoice) - { - try { - $this->dispatch(new DeleteDocument($invoice)); - - return $this->response->noContent(); - } catch(\Exception $e) { - $this->response->errorUnauthorized($e->getMessage()); - } - } -} diff --git a/modules/BC21/Http/Requests/Purchase/Bill.php b/modules/BC21/Http/Requests/Purchase/Bill.php deleted file mode 100644 index 3220b25a9..000000000 --- a/modules/BC21/Http/Requests/Purchase/Bill.php +++ /dev/null @@ -1,42 +0,0 @@ -errors()->count()) { - $this->request->set('billed_at', $this->request->get('issued_at')); - $this->request->remove('issued_at'); - } - } -} diff --git a/modules/BC21/Http/Requests/Purchase/BillAddItem.php b/modules/BC21/Http/Requests/Purchase/BillAddItem.php deleted file mode 100644 index 65918574f..000000000 --- a/modules/BC21/Http/Requests/Purchase/BillAddItem.php +++ /dev/null @@ -1,13 +0,0 @@ -errors()->count()) { - $this->request->set('invoiced_at', $this->request->get('issued_at')); - $this->request->remove('issued_at'); - } - } -} diff --git a/modules/BC21/Http/Requests/Sale/InvoiceAddItem.php b/modules/BC21/Http/Requests/Sale/InvoiceAddItem.php deleted file mode 100644 index 45688a03e..000000000 --- a/modules/BC21/Http/Requests/Sale/InvoiceAddItem.php +++ /dev/null @@ -1,13 +0,0 @@ -request->merge( - [ - 'type' => Document::BILL_TYPE, - 'document_number' => $this->request->get('bill_number'), - 'issued_at' => $this->request->get('billed_at'), - ] - ); - - } -} diff --git a/modules/BC21/Jobs/Purchase/CreateBillHistory.php b/modules/BC21/Jobs/Purchase/CreateBillHistory.php deleted file mode 100644 index 669e4e368..000000000 --- a/modules/BC21/Jobs/Purchase/CreateBillHistory.php +++ /dev/null @@ -1,13 +0,0 @@ -request->merge( - [ - 'type' => Document::INVOICE_TYPE, - 'document_number' => $this->request->get('invoice_number'), - 'issued_at' => $this->request->get('invoiced_at'), - ] - ); - - } -} diff --git a/modules/BC21/Jobs/Sale/CreateInvoiceHistory.php b/modules/BC21/Jobs/Sale/CreateInvoiceHistory.php deleted file mode 100644 index c007109f4..000000000 --- a/modules/BC21/Jobs/Sale/CreateInvoiceHistory.php +++ /dev/null @@ -1,13 +0,0 @@ -document_number; - } - - public function setBillNumberAttribute($value) - { - $this->attributes['document_number'] = $value; - } - - public function getBilledAtAttribute($value) - { - return $this->issued_at; - } - - public function setBilledAtAttribute($value) - { - $this->attributes['issued_at'] = $value; - } -} diff --git a/modules/BC21/Models/Purchase/BillHistory.php b/modules/BC21/Models/Purchase/BillHistory.php deleted file mode 100644 index 8cbeac199..000000000 --- a/modules/BC21/Models/Purchase/BillHistory.php +++ /dev/null @@ -1,22 +0,0 @@ -document_id; - } - - public function setBillIdAttribute($value) - { - $this->attributes['document_id'] = $value; - } -} diff --git a/modules/BC21/Models/Purchase/BillItem.php b/modules/BC21/Models/Purchase/BillItem.php deleted file mode 100644 index 0d6f35921..000000000 --- a/modules/BC21/Models/Purchase/BillItem.php +++ /dev/null @@ -1,22 +0,0 @@ -document_id; - } - - public function setBillIdAttribute($value) - { - $this->attributes['document_id'] = $value; - } -} diff --git a/modules/BC21/Models/Purchase/BillItemTax.php b/modules/BC21/Models/Purchase/BillItemTax.php deleted file mode 100644 index d440dc3ca..000000000 --- a/modules/BC21/Models/Purchase/BillItemTax.php +++ /dev/null @@ -1,32 +0,0 @@ -document_id; - } - - public function setBillIdAttribute($value) - { - $this->attributes['document_id'] = $value; - } - - public function getBillItemIdAttribute($value) - { - return $this->document_item_id; - } - - public function setBillItemIdAttribute($value) - { - $this->attributes['document_item_id'] = $value; - } -} diff --git a/modules/BC21/Models/Purchase/BillTotal.php b/modules/BC21/Models/Purchase/BillTotal.php deleted file mode 100644 index 17697c9e3..000000000 --- a/modules/BC21/Models/Purchase/BillTotal.php +++ /dev/null @@ -1,22 +0,0 @@ -document_id; - } - - public function setBillIdAttribute($value) - { - $this->attributes['document_id'] = $value; - } -} diff --git a/modules/BC21/Models/Sale/Invoice.php b/modules/BC21/Models/Sale/Invoice.php deleted file mode 100644 index bd7eb5f05..000000000 --- a/modules/BC21/Models/Sale/Invoice.php +++ /dev/null @@ -1,38 +0,0 @@ -attributes['document_number'] = $value; - } - - public function getInvoiceNumberAttribute($value) - { - return $this->document_number; - } - - public function setInvoicedAtAttribute($value) - { - $this->attributes['issued_at'] = $value; - } - - public function getInvoicedAtAttribute($value) - { - return $this->issued_at; - } -} diff --git a/modules/BC21/Models/Sale/InvoiceHistory.php b/modules/BC21/Models/Sale/InvoiceHistory.php deleted file mode 100644 index e0cb95f48..000000000 --- a/modules/BC21/Models/Sale/InvoiceHistory.php +++ /dev/null @@ -1,22 +0,0 @@ -document_id; - } - - public function setInvoiceIdAttribute($value) - { - $this->attributes['document_id'] = $value; - } -} diff --git a/modules/BC21/Models/Sale/InvoiceItem.php b/modules/BC21/Models/Sale/InvoiceItem.php deleted file mode 100644 index 386bed40d..000000000 --- a/modules/BC21/Models/Sale/InvoiceItem.php +++ /dev/null @@ -1,22 +0,0 @@ -document_id; - } - - public function setInvoiceIdAttribute($value) - { - $this->attributes['document_id'] = $value; - } -} diff --git a/modules/BC21/Models/Sale/InvoiceItemTax.php b/modules/BC21/Models/Sale/InvoiceItemTax.php deleted file mode 100644 index fa6abb746..000000000 --- a/modules/BC21/Models/Sale/InvoiceItemTax.php +++ /dev/null @@ -1,32 +0,0 @@ -document_id; - } - - public function setInvoiceIdAttribute($value) - { - $this->attributes['document_id'] = $value; - } - - public function getInvoiceItemIdAttribute($value) - { - return $this->document_item_id; - } - - public function setInvoiceItemIdAttribute($value) - { - $this->attributes['document_item_id'] = $value; - } -} diff --git a/modules/BC21/Models/Sale/InvoiceTotal.php b/modules/BC21/Models/Sale/InvoiceTotal.php deleted file mode 100644 index 97202638c..000000000 --- a/modules/BC21/Models/Sale/InvoiceTotal.php +++ /dev/null @@ -1,22 +0,0 @@ -document_id; - } - - public function setInvoiceIdAttribute($value) - { - $this->attributes['document_id'] = $value; - } -} diff --git a/modules/BC21/Providers/Main.php b/modules/BC21/Providers/Main.php deleted file mode 100644 index d94b84b9b..000000000 --- a/modules/BC21/Providers/Main.php +++ /dev/null @@ -1,55 +0,0 @@ -loadRoutes(); - } - - /** - * Load routes. - * - * @return void - */ - public function loadRoutes() - { - if (app()->routesAreCached()) { - return; - } - - $routes = ['api.php']; - - foreach ($routes as $route) { - $this->loadRoutesFrom(__DIR__ . '/../Routes/' . $route); - } - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return []; - } -} diff --git a/modules/BC21/Routes/api.php b/modules/BC21/Routes/api.php deleted file mode 100644 index 5f19c5d74..000000000 --- a/modules/BC21/Routes/api.php +++ /dev/null @@ -1,72 +0,0 @@ -version('v2', ['middleware' => ['api']], function($api) { - $api->group(['namespace' => 'App\Http\Controllers\Api'], function($api) { - // Companies - $api->get('companies/{company}/owner', 'Common\Companies@owner')->name('companies.owner'); - $api->get('companies/{company}/enable', 'Common\Companies@enable')->name('companies.enable'); - $api->get('companies/{company}/disable', 'Common\Companies@disable')->name('companies.disable'); - $api->resource('companies', 'Common\Companies'); - - // Items - $api->get('items/{item}/enable', 'Common\Items@enable')->name('items.enable'); - $api->get('items/{item}/disable', 'Common\Items@disable')->name('items.disable'); - $api->resource('items', 'Common\Items'); - - // Contacts - $api->get('contacts/{contact}/enable', 'Common\Contacts@enable')->name('contacts.enable'); - $api->get('contacts/{contact}/disable', 'Common\Contacts@disable')->name('contacts.disable'); - $api->resource('contacts', 'Common\Contacts'); - - // Sales - $api->resource('invoices', 'Sales\Invoices'); - $api->resource('invoices.transactions', 'Sales\InvoiceTransactions'); - - // Purchases - $api->get('bills/{bill}/received', 'Purchases\Bills@received')->name('bills.received'); - $api->resource('bills', 'Purchases\Bills'); - - // Banking - $api->get('accounts/{account}/enable', 'Banking\Accounts@enable')->name('accounts.enable'); - $api->get('accounts/{account}/disable', 'Banking\Accounts@disable')->name('accounts.disable'); - $api->resource('accounts', 'Banking\Accounts'); - $api->resource('reconciliations', 'Banking\Reconciliations'); - $api->resource('transactions', 'Banking\Transactions'); - $api->resource('transfers', 'Banking\Transfers'); - - // Reports - $api->resource('reports', 'Common\Reports'); - - // Settings - $api->get('categories/{category}/enable', 'Settings\Categories@enable')->name('categories.enable'); - $api->get('categories/{category}/disable', 'Settings\Categories@disable')->name('categories.disable'); - $api->resource('categories', 'Settings\Categories'); - $api->get('currencies/{currency}/enable', 'Settings\Currencies@enable')->name('currencies.enable'); - $api->get('currencies/{currency}/disable', 'Settings\Currencies@disable')->name('currencies.disable'); - $api->resource('currencies', 'Settings\Currencies'); - $api->resource('settings', 'Settings\Settings'); - $api->get('taxes/{tax}/enable', 'Settings\Taxes@enable')->name('taxes.enable'); - $api->get('taxes/{tax}/disable', 'Settings\Taxes@disable')->name('taxes.disable'); - $api->resource('taxes', 'Settings\Taxes'); - - // Common - $api->resource('ping', 'Common\Ping'); - - // Auth - $api->resource('permissions', 'Auth\Permissions'); - $api->resource('roles', 'Auth\Roles'); - $api->get('users/{user}/enable', 'Auth\Users@enable')->name('users.enable'); - $api->get('users/{user}/disable', 'Auth\Users@disable')->name('users.disable'); - $api->resource('users', 'Auth\Users'); - }); -}); diff --git a/modules/BC21/Scopes/ReplaceDeprecatedColumns.php b/modules/BC21/Scopes/ReplaceDeprecatedColumns.php deleted file mode 100644 index bccce4680..000000000 --- a/modules/BC21/Scopes/ReplaceDeprecatedColumns.php +++ /dev/null @@ -1,79 +0,0 @@ - 'issued_at', - 'invoice_number' => 'document_number', - ]; - break; - case Bill::class: - $replacements = [ - 'billed_at' => 'issued_at', - 'bill_number' => 'document_number', - ]; - break; - } - - if (false === isset($replacements)) { - return; - } - - - $query = $builder->getQuery(); - - foreach ($replacements as $column => $replace) { - if ($query->orders !== null) { - $query->orders = $this->replaceColumn($query->orders, $column, $replace); - } - - if ($query->wheres !== null) { - $query->wheres = $this->replaceColumn($query->wheres, $column, $replace); - } - - if ($query->havings !== null) { - $query->havings = $this->replaceColumn($query->havings, $column, $replace); - } - - if ($query->unionOrders !== null) { - $query->unionOrders = $this->replaceColumn($query->unionOrders, $column, $replace); - } - } - } - - private function replaceColumn(array $columns, string $column, string $replace): array - { - return Collection::make($columns) - ->transform( - function ($item) use ($column, $replace) { - if (isset($item['column']) && $item['column'] === $column) { - $item['column'] = $replace; - } - - return $item; - } - )->values()->all(); - } -} diff --git a/modules/BC21/Traits/Purchases.php b/modules/BC21/Traits/Purchases.php deleted file mode 100644 index 6441b1b76..000000000 --- a/modules/BC21/Traits/Purchases.php +++ /dev/null @@ -1,65 +0,0 @@ -getNextDocumentNumber(Document::BILL_TYPE); - } - - /** - * Increase the next bill number - * - * @deprecated`1 - * @see Documents::increaseNextDocumentNumber() - */ - public function increaseNextBillNumber(): void - { - $this->increaseNextDocumentNumber(Document::BILL_TYPE); - } - - /** - * Get a collection bill statuses - * - * @deprecated - * @see Documents::getBillStatuses() - */ - public function getBillStatuses(): Collection - { - return $this->getDocumentStatuses(Document::BILL_TYPE); - } - - /** - * @deprecated - * @see Documents::getDocumentFileName() - */ - public function getBillFileName(Document $bill, string $separator = '-', string $extension = 'pdf'): string - { - return $this->getDocumentFileName($bill, $separator, $extension); - } - - /** - * @deprecated - * @see Documents::getSafeDocumentNumber() - */ - public function getSafeBillNumber(Document $bill, string $separator = '-'): string - { - return $this->getSafeDocumentNumber($bill, $separator); - } -} diff --git a/modules/BC21/Traits/Sales.php b/modules/BC21/Traits/Sales.php deleted file mode 100644 index 07ac05b02..000000000 --- a/modules/BC21/Traits/Sales.php +++ /dev/null @@ -1,65 +0,0 @@ -getNextDocumentNumber(Document::INVOICE_TYPE); - } - - /** - * Increase the next invoice number - * - * @deprecated - * @see Documents::increaseNextDocumentNumber() - */ - public function increaseNextInvoiceNumber(): void - { - $this->increaseNextDocumentNumber(Document::INVOICE_TYPE); - } - - /** - * Get a collection invoice statuses - * - * @deprecated - * @see Documents::getInvoiceStatuses() - */ - public function getInvoiceStatuses(): Collection - { - return $this->getDocumentStatuses(Document::INVOICE_TYPE); - } - - /** - * @deprecated - * @see Documents::getDocumentFileName() - */ - public function getInvoiceFileName(Document $invoice, string $separator = '-', string $extension = 'pdf'): string - { - return $this->getDocumentFileName($invoice, $separator, $extension); - } - - /** - * @deprecated - * @see Documents::getSafeDocumentNumber() - */ - public function getSafeInvoiceNumber(Document $invoice, string $separator = '-'): string - { - return $this->getSafeDocumentNumber($invoice, $separator); - } -} diff --git a/modules/BC21/Transformers/Purchase/Bill.php b/modules/BC21/Transformers/Purchase/Bill.php deleted file mode 100644 index a806fa3a2..000000000 --- a/modules/BC21/Transformers/Purchase/Bill.php +++ /dev/null @@ -1,92 +0,0 @@ - $model->id, - 'company_id' => $model->company_id, - 'bill_number' => $model->document_number, - 'order_number' => $model->order_number, - 'status' => $model->status, - 'billed_at' => $model->issued_at ? $model->issued_at->toIso8601String() : '', - 'due_at' => $model->due_at ? $model->due_at->toIso8601String() : '', - 'amount' => $model->amount, - 'currency_code' => $model->currency_code, - 'currency_rate' => $model->currency_rate, - 'contact_id' => $model->contact_id, - 'contact_name' => $model->contact_name, - 'contact_email' => $model->contact_email, - 'contact_tax_number' => $model->contact_tax_number, - 'contact_phone' => $model->contact_phone, - 'contact_address' => $model->contact_address, - 'notes' => $model->notes, - 'attachment' => $model->attachment, - 'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '', - 'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : '', - ]; - } - - /** - * @param Model $model - * @return \League\Fractal\Resource\Item - */ - public function includeContact(Model $model) - { - return $this->item($model->contact, new Contact()); - } - - /** - * @param Model $model - * @return \League\Fractal\Resource\Item - */ - public function includeCurrency(Model $model) - { - return $this->item($model->currency, new Currency()); - } - - /** - * @param Model $model - * @return \League\Fractal\Resource\Collection - */ - public function includeHistories(Model $model) - { - return $this->collection($model->histories, new BillHistories()); - } - - /** - * @param Model $model - * @return \League\Fractal\Resource\Collection - */ - public function includeItems(Model $model) - { - return $this->collection($model->items, new BillItems()); - } - - /** - * @param Model $model - * @return \League\Fractal\Resource\Collection - */ - public function includeTransactions(Model $model) - { - return $this->collection($model->transactions, new Transaction()); - } -} diff --git a/modules/BC21/Transformers/Purchase/BillHistories.php b/modules/BC21/Transformers/Purchase/BillHistories.php deleted file mode 100644 index ee1c8de90..000000000 --- a/modules/BC21/Transformers/Purchase/BillHistories.php +++ /dev/null @@ -1,27 +0,0 @@ - $model->id, - 'company_id' => $model->company_id, - 'bill_id' => $model->bill_id, - 'status' => $model->status, - 'notify' => $model->notify, - 'description' => $model->description, - 'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '', - 'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : '', - ]; - } -} diff --git a/modules/BC21/Transformers/Purchase/BillItems.php b/modules/BC21/Transformers/Purchase/BillItems.php deleted file mode 100644 index c615ef126..000000000 --- a/modules/BC21/Transformers/Purchase/BillItems.php +++ /dev/null @@ -1,30 +0,0 @@ - $model->id, - 'company_id' => $model->company_id, - 'bill_id' => $model->bill_id, - 'item_id' => $model->item_id, - 'name' => $model->name, - 'price' => $model->price, - 'total' => $model->total, - 'tax' => $model->tax, - 'tax_id' => $model->tax_id, - 'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '', - 'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : '', - ]; - } -} diff --git a/modules/BC21/Transformers/Purchase/BillTotals.php b/modules/BC21/Transformers/Purchase/BillTotals.php deleted file mode 100644 index 1531837e9..000000000 --- a/modules/BC21/Transformers/Purchase/BillTotals.php +++ /dev/null @@ -1,29 +0,0 @@ - $model->id, - 'company_id' => $model->company_id, - 'bill_id' => $model->bill_id, - 'code' => $model->code, - 'name' => $model->name, - 'amount' => $model->amount, - 'sort_order' => $model->sort_order, - 'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '', - 'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : '', - ]; - } -} diff --git a/modules/BC21/Transformers/Sale/Invoice.php b/modules/BC21/Transformers/Sale/Invoice.php deleted file mode 100644 index b9bc4fb6d..000000000 --- a/modules/BC21/Transformers/Sale/Invoice.php +++ /dev/null @@ -1,92 +0,0 @@ - $model->id, - 'company_id' => $model->company_id, - 'invoice_number' => $model->document_number, - 'order_number' => $model->order_number, - 'status' => $model->status, - 'invoiced_at' => $model->issued_at ? $model->issued_at->toIso8601String() : '', - 'due_at' => $model->due_at ? $model->due_at->toIso8601String() : '', - 'amount' => $model->amount, - 'currency_code' => $model->currency_code, - 'currency_rate' => $model->currency_rate, - 'contact_id' => $model->contact_id, - 'contact_name' => $model->contact_name, - 'contact_email' => $model->contact_email, - 'contact_tax_number' => $model->contact_tax_number, - 'contact_phone' => $model->contact_phone, - 'contact_address' => $model->contact_address, - 'notes' => $model->notes, - 'attachment' => $model->attachment, - 'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '', - 'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : '', - ]; - } - - /** - * @param Model $model - * @return \League\Fractal\Resource\Item - */ - public function includeContact(Model $model) - { - return $this->item($model->contact, new Contact()); - } - - /** - * @param Model $model - * @return \League\Fractal\Resource\Item - */ - public function includeCurrency(Model $model) - { - return $this->item($model->currency, new Currency()); - } - - /** - * @param Model $model - * @return \League\Fractal\Resource\Collection - */ - public function includeHistories(Model $model) - { - return $this->collection($model->histories, new InvoiceHistories()); - } - - /** - * @param Model $model - * @return \League\Fractal\Resource\Collection - */ - public function includeItems(Model $model) - { - return $this->collection($model->items, new InvoiceItems()); - } - - /** - * @param Model $model - * @return \League\Fractal\Resource\Collection - */ - public function includeTransactions(Model $model) - { - return $this->collection($model->transactions, new Transaction()); - } -} diff --git a/modules/BC21/Transformers/Sale/InvoiceHistories.php b/modules/BC21/Transformers/Sale/InvoiceHistories.php deleted file mode 100644 index 868f78698..000000000 --- a/modules/BC21/Transformers/Sale/InvoiceHistories.php +++ /dev/null @@ -1,27 +0,0 @@ - $model->id, - 'company_id' => $model->company_id, - 'invoice_id' => $model->invoice_id, - 'status' => $model->status, - 'notify' => $model->notify, - 'description' => $model->description, - 'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '', - 'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : '', - ]; - } -} diff --git a/modules/BC21/Transformers/Sale/InvoiceItems.php b/modules/BC21/Transformers/Sale/InvoiceItems.php deleted file mode 100644 index 82bf6df10..000000000 --- a/modules/BC21/Transformers/Sale/InvoiceItems.php +++ /dev/null @@ -1,30 +0,0 @@ - $model->id, - 'company_id' => $model->company_id, - 'invoice_id' => $model->invoice_id, - 'item_id' => $model->item_id, - 'name' => $model->name, - 'price' => $model->price, - 'total' => $model->total, - 'tax' => $model->tax, - 'tax_id' => $model->tax_id, - 'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '', - 'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : '', - ]; - } -} diff --git a/modules/BC21/Transformers/Sale/InvoiceTotals.php b/modules/BC21/Transformers/Sale/InvoiceTotals.php deleted file mode 100644 index f9b9a939f..000000000 --- a/modules/BC21/Transformers/Sale/InvoiceTotals.php +++ /dev/null @@ -1,29 +0,0 @@ - $model->id, - 'company_id' => $model->company_id, - 'invoice_id' => $model->invoice_id, - 'code' => $model->code, - 'name' => $model->name, - 'amount' => $model->amount, - 'sort_order' => $model->sort_order, - 'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '', - 'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : '', - ]; - } -} diff --git a/modules/BC21/module.json b/modules/BC21/module.json deleted file mode 100644 index f68c21684..000000000 --- a/modules/BC21/module.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "alias": "bc21", - "icon": "fa fa-cog", - "version": "1.0.0", - "active": 1, - "providers": [ - "Modules\\BC21\\Providers\\Main" - ], - "aliases": {}, - "files": [], - "requires": [], - "reports": [], - "widgets": [], - "settings": [], - "extra-modules": {} -} diff --git a/modules/OfflinePayments/Http/Controllers/Payment.php b/modules/OfflinePayments/Http/Controllers/Payment.php deleted file mode 100644 index 317b60637..000000000 --- a/modules/OfflinePayments/Http/Controllers/Payment.php +++ /dev/null @@ -1,96 +0,0 @@ -render(); - - return response()->json([ - 'code' => $setting['code'], - 'name' => $setting['name'], - 'description' => $setting['description'], - 'redirect' => false, - 'html' => $html, - ]); - } - - public function signed(Document $invoice, PaymentRequest $request) - { - $setting = []; - - $payment_methods = json_decode(setting('offline-payments.methods'), true); - - foreach ($payment_methods as $payment_method) { - if ($payment_method['code'] == $request['payment_method']) { - $setting = $payment_method; - - break; - } - } - - $confirm_url = URL::signedRoute('signed.invoices.offline-payments.confirm', [$invoice->id, 'company_id' => session('company_id')]); - - $html = view('offline-payments::signed', compact('setting', 'invoice', 'confirm_url'))->render(); - - return response()->json([ - 'code' => $setting['code'], - 'name' => $setting['name'], - 'description' => $setting['description'], - 'redirect' => false, - 'html' => $html, - ]); - } - - public function confirm(Document $invoice, Request $request) - { - try { - event(new PaymentReceived($invoice, $request)); - - $message = trans('messages.success.added', ['type' => trans_choice('general.payments', 1)]); - - $response = [ - 'success' => true, - 'error' => false, - 'message' => $message, - 'data' => false, - ]; - } catch(\Exception $e) { - $message = $e->getMessage(); - - $response = [ - 'success' => false, - 'error' => true, - 'message' => $message, - 'data' => false, - ]; - } - - return response()->json($response); - } -} diff --git a/modules/OfflinePayments/Http/Controllers/Settings.php b/modules/OfflinePayments/Http/Controllers/Settings.php deleted file mode 100644 index 148bab50a..000000000 --- a/modules/OfflinePayments/Http/Controllers/Settings.php +++ /dev/null @@ -1,130 +0,0 @@ -update_code, array_column($methods, 'code')) == false) { - $code_exists = false; - } - - if (!empty($request->get('update_code')) && $code_exists == true) { - $payment_method = $this->dispatch(new UpdatePaymentMethod($request)); - - $message = trans('messages.success.updated', ['type' => $payment_method['name']]); - } else { - $payment_method = $this->dispatch(new CreatePaymentMethod($request)); - - $message = trans('messages.success.added', ['type' => $payment_method['name']]); - } - - flash($message)->success(); - - return response()->json([ - 'success' => true, - 'error' => false, - 'message' => $message, - 'redirect' => route('offline-payments.settings.edit'), - ]); - } - - /** - * Remove the specified resource from storage. - * - * @param GRequest $request - * - * @return Response - */ - public function get(GRequest $request) - { - $data = []; - - $code = $request->get('code'); - - $methods = json_decode(setting('offline-payments.methods'), true); - - foreach ($methods as $key => $method) { - if ($method['code'] != $code) { - continue; - } - - $method['title'] = trans('offline-payments::offline-payments.edit', ['method' => $method['name']]); - $method['update_code'] = $code; - - $code = explode('.', $method['code']); - - $method['code'] = $code[1]; - - $data = $method; - - break; - } - - return response()->json([ - 'errors' => false, - 'success' => true, - 'data' => $data, - ]); - } - - /** - * Remove the specified resource from storage. - * - * @param DRequest $request - * - * @return Response - */ - public function destroy(DRequest $request) - { - $response = $this->ajaxDispatch(new DeletePaymentMethod($request)); - - if ($response['success']) { - //$response['redirect'] = route('offline-payments.settings.edit'); - - $response['message'] = trans('messages.success.deleted', ['type' => $response['data']['name']]); - - //flash($message)->success(); - } else { - //$response['redirect'] = route('offline-payments.settings.edit'); - - $message = $response['message']; - - //flash($message)->error()->important(); - } - - return response()->json($response); - } -} diff --git a/modules/OfflinePayments/Http/Requests/Setting.php b/modules/OfflinePayments/Http/Requests/Setting.php deleted file mode 100644 index 5e289ed19..000000000 --- a/modules/OfflinePayments/Http/Requests/Setting.php +++ /dev/null @@ -1,31 +0,0 @@ - 'required|string', - 'code' => 'required|string', - ]; - } -} diff --git a/modules/OfflinePayments/Http/Requests/SettingDelete.php b/modules/OfflinePayments/Http/Requests/SettingDelete.php deleted file mode 100644 index 0319d17f9..000000000 --- a/modules/OfflinePayments/Http/Requests/SettingDelete.php +++ /dev/null @@ -1,30 +0,0 @@ - 'required|string', - ]; - } -} diff --git a/modules/OfflinePayments/Http/Requests/SettingGet.php b/modules/OfflinePayments/Http/Requests/SettingGet.php deleted file mode 100644 index 1643dfe33..000000000 --- a/modules/OfflinePayments/Http/Requests/SettingGet.php +++ /dev/null @@ -1,30 +0,0 @@ - 'required|string', - ]; - } -} diff --git a/modules/OfflinePayments/Http/Requests/Show.php b/modules/OfflinePayments/Http/Requests/Show.php deleted file mode 100644 index be28422c1..000000000 --- a/modules/OfflinePayments/Http/Requests/Show.php +++ /dev/null @@ -1,30 +0,0 @@ - 'required|string', - ]; - } -} diff --git a/modules/OfflinePayments/Jobs/CreatePaymentMethod.php b/modules/OfflinePayments/Jobs/CreatePaymentMethod.php deleted file mode 100644 index 1ac6c223b..000000000 --- a/modules/OfflinePayments/Jobs/CreatePaymentMethod.php +++ /dev/null @@ -1,49 +0,0 @@ -request = $this->getRequestInstance($request); - } - - /** - * Execute the job. - * - * @return array - */ - public function handle() - { - $methods = json_decode(setting('offline-payments.methods'), true); - - $payment_method = [ - 'code' => 'offline-payments.' . $this->request->get('code') . '.' . (count($methods) + 1), - 'name' => $this->request->get('name'), - 'customer' => $this->request->get('customer'), - 'order' => $this->request->get('order'), - 'description' => $this->request->get('description'), - ]; - - $methods[] = $payment_method; - - setting()->set('offline-payments.methods', json_encode($methods)); - - setting()->save(); - - Modules::clearPaymentMethodsCache(); - - return $payment_method; - } -} diff --git a/modules/OfflinePayments/Jobs/DeletePaymentMethod.php b/modules/OfflinePayments/Jobs/DeletePaymentMethod.php deleted file mode 100644 index 132a8218a..000000000 --- a/modules/OfflinePayments/Jobs/DeletePaymentMethod.php +++ /dev/null @@ -1,83 +0,0 @@ -request = $this->getRequestInstance($request); - } - - /** - * Execute the job. - * - * @return array - */ - public function handle() - { - $this->authorize(); - - $methods = json_decode(setting('offline-payments.methods'), true); - - $payment_method = []; - - $code = $this->request->get('code'); - - foreach ($methods as $key => $method) { - if ($method['code'] != $code) { - continue; - } - - $payment_method = $methods[$key]; - - unset($methods[$key]); - } - - setting()->set('offline-payments.methods', json_encode($methods)); - - setting()->save(); - - Modules::clearPaymentMethodsCache(); - - return $payment_method; - } - - /** - * Determine if this action is applicable. - * - * @return void - */ - public function authorize() - { - if ($relationships = $this->getRelationships()) { - $message = trans('messages.warning.deleted', ['name' => $this->request->get('code'), 'text' => implode(', ', $relationships)]); - - throw new \Exception($message); - } - } - - public function getRelationships() - { - $counter = []; - - if (!$c = Transaction::where('payment_method', $this->request->get('code'))->get()->count()) { - return []; - } - - $counter[] = $c . ' ' . strtolower(trans_choice('general.transactions', ($c > 1) ? 2 : 1)); - - return $counter; - } -} diff --git a/modules/OfflinePayments/Jobs/UpdatePaymentMethod.php b/modules/OfflinePayments/Jobs/UpdatePaymentMethod.php deleted file mode 100644 index c13c2e5cc..000000000 --- a/modules/OfflinePayments/Jobs/UpdatePaymentMethod.php +++ /dev/null @@ -1,61 +0,0 @@ -request = $this->getRequestInstance($request); - } - - /** - * Execute the job. - * - * @return array - */ - public function handle() - { - $methods = json_decode(setting('offline-payments.methods'), true); - - $payment_method = []; - - $code = $this->request->get('update_code'); - - foreach ($methods as $key => $method) { - if ($method['code'] != $code) { - continue; - } - - $method = explode('.', $code); - - $payment_method = [ - 'code' => 'offline-payments.' . $this->request->get('code') . '.' . $method[2], - 'name' => $this->request->get('name'), - 'customer' => $this->request->get('customer'), - 'order' => $this->request->get('order'), - 'description' => $this->request->get('description'), - ]; - - $methods[$key] = $payment_method; - } - - setting()->set('offline-payments.methods', json_encode($methods)); - - setting()->save(); - - Modules::clearPaymentMethodsCache(); - - return $payment_method; - } -} diff --git a/modules/OfflinePayments/Listeners/AddLandingPage.php b/modules/OfflinePayments/Listeners/AddLandingPage.php deleted file mode 100644 index 87306294a..000000000 --- a/modules/OfflinePayments/Listeners/AddLandingPage.php +++ /dev/null @@ -1,19 +0,0 @@ -user->landing_pages['offline-payments.settings.edit'] = trans('offline-payments::general.name'); - } -} diff --git a/modules/OfflinePayments/Listeners/FinishInstallation.php b/modules/OfflinePayments/Listeners/FinishInstallation.php deleted file mode 100644 index 89a7804ef..000000000 --- a/modules/OfflinePayments/Listeners/FinishInstallation.php +++ /dev/null @@ -1,36 +0,0 @@ -alias != $this->alias) { - return; - } - - $this->updatePermissions(); - } - - protected function updatePermissions() - { - // c=create, r=read, u=update, d=delete - $this->attachPermissionsToAdminRoles([ - $this->alias . '-settings' => 'r,u,d', - ]); - } -} diff --git a/modules/OfflinePayments/Listeners/ShowAsPaymentMethod.php b/modules/OfflinePayments/Listeners/ShowAsPaymentMethod.php deleted file mode 100644 index e324d591f..000000000 --- a/modules/OfflinePayments/Listeners/ShowAsPaymentMethod.php +++ /dev/null @@ -1,27 +0,0 @@ -modules->payment_methods[] = $method; - } - } -} diff --git a/modules/OfflinePayments/Listeners/ShowInSettingsPage.php b/modules/OfflinePayments/Listeners/ShowInSettingsPage.php deleted file mode 100644 index a69afc123..000000000 --- a/modules/OfflinePayments/Listeners/ShowInSettingsPage.php +++ /dev/null @@ -1,24 +0,0 @@ -modules->settings['offline-payments'] = [ - 'name' => trans('offline-payments::general.name'), - 'description' => trans('offline-payments::general.description'), - 'url' => route('offline-payments.settings.edit'), - 'icon' => 'fas fa-credit-card', - ]; - } -} diff --git a/modules/OfflinePayments/Providers/Event.php b/modules/OfflinePayments/Providers/Event.php deleted file mode 100644 index 79369acd7..000000000 --- a/modules/OfflinePayments/Providers/Event.php +++ /dev/null @@ -1,30 +0,0 @@ -loadTranslations(); - $this->loadViews(); - } - - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - $this->loadRoutes(); - } - - /** - * Load views. - * - * @return void - */ - public function loadViews() - { - $this->loadViewsFrom(__DIR__ . '/../Resources/views', 'offline-payments'); - } - - /** - * Load translations. - * - * @return void - */ - public function loadTranslations() - { - $this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'offline-payments'); - } - - /** - * Load routes. - * - * @return void - */ - public function loadRoutes() - { - if (app()->routesAreCached()) { - return; - } - - $routes = [ - 'admin.php', - 'portal.php', - 'signed.php', - ]; - - foreach ($routes as $route) { - $this->loadRoutesFrom(__DIR__ . '/../Routes/' . $route); - } - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return []; - } -} diff --git a/modules/OfflinePayments/Resources/assets/js/offline-payments.js b/modules/OfflinePayments/Resources/assets/js/offline-payments.js deleted file mode 100644 index 24d65576d..000000000 --- a/modules/OfflinePayments/Resources/assets/js/offline-payments.js +++ /dev/null @@ -1,132 +0,0 @@ -/** - * First we will load all of this project's JavaScript dependencies which - * includes Vue and other libraries. It is a great starting point when - * building robust, powerful web applications using Vue and Laravel. - */ - -require('./../../../../../resources/assets/js/bootstrap'); - -import Vue from 'vue'; - -import Global from './../../../../../resources/assets/js/mixins/global'; -import Form from './../../../../../resources/assets/js/plugins/form'; -import DashboardPlugin from './../../../../../resources/assets/js/plugins/dashboard-plugin'; - -// plugin setup -Vue.use(DashboardPlugin); - -const app = new Vue({ - el: '#app', - - mixins: [ - Global - ], - - data() { - return { - form: new Form('offline-payment'), - update_code: null, - form_loading: '', - } - }, - - methods:{ - onEdit(event) { - var code = event.target.dataset.code; - - this.form_loading = '
'; - - this.form.loading = true; - - axios.post('offline-payments/settings/get', { - code: code - }) - .then(response => { - this.form.name = response.data.data.name; - this.form.code = response.data.data.code; - this.form.customer = response.data.data.customer; - this.form.order = response.data.data.order; - this.form.description = response.data.data.description; - this.form.update_code = response.data.data.update_code; - this.update_code = response.data.data.update_code; - this.form.loading = false; - this.form_loading = ''; - }) - .catch(error => { - this.form.loading = false; - this.form_loading = ''; - }); - }, - - // Actions > Delete - confirmDelete(code, title, message, button_cancel, button_delete) { - let confirm = { - code: code, - url: url, - title: title, - message: message, - button_cancel: button_cancel, - button_delete: button_delete, - show: true - }; - - this.component = Vue.component('add-new-component', (resolve, reject) => { - resolve({ - template : '