From 9738203e8cce488fbe0d9b5dc3b12a7922cfcabc Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 4 Nov 2015 11:34:17 +1100 Subject: [PATCH 1/2] merge --- composer.lock | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/composer.lock b/composer.lock index 8f95175f878f..4060860ea781 100644 --- a/composer.lock +++ b/composer.lock @@ -1,10 +1,11 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], "hash": "d0f3825f6d361f655c7393dd024b676e", + "content-hash": "988069b01d6c774baba9cda91e5acb59", "packages": [ { "name": "alfaproject/omnipay-neteller", @@ -339,7 +340,7 @@ }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Chumper/Datatable/zipball/7fa47cb5469f07c620fb69dee94b8e1a96943ee2", + "url": "https://api.github.com/repos/Chumper/Datatable/zipball/b44834db3d4e560d4368c1a04248b9e6a422ccff", "reference": "7fa47cb", "shasum": "" }, @@ -351,7 +352,7 @@ }, "require-dev": { "mockery/mockery": "dev-master", - "orchestra/testbench": "2.1.*", + "orchestra/testbench": "3.1.*", "phpunit/phpunit": "3.7.*" }, "type": "library", @@ -380,7 +381,7 @@ "jquery", "laravel" ], - "time": "2015-04-20 09:21:21" + "time": "2015-10-26 01:21:31" }, { "name": "classpreloader/classpreloader", @@ -3951,16 +3952,16 @@ }, { "name": "omnipay/payflow", - "version": "v2.1.1", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/thephpleague/omnipay-payflow.git", - "reference": "9d86e3478dd42cbe40ab9466a7505c4f99c70ee7" + "reference": "1d5963fd57bf16cfb8134900d3c34d9e30ca59a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/omnipay-payflow/zipball/9d86e3478dd42cbe40ab9466a7505c4f99c70ee7", - "reference": "9d86e3478dd42cbe40ab9466a7505c4f99c70ee7", + "url": "https://api.github.com/repos/thephpleague/omnipay-payflow/zipball/1d5963fd57bf16cfb8134900d3c34d9e30ca59a9", + "reference": "1d5963fd57bf16cfb8134900d3c34d9e30ca59a9", "shasum": "" }, "require": { @@ -4004,7 +4005,7 @@ "payflow", "payment" ], - "time": "2014-09-17 00:38:58" + "time": "2015-11-03 20:55:42" }, { "name": "omnipay/paymentexpress", @@ -4943,12 +4944,12 @@ "target-dir": "Symfony/Component/Console", "source": { "type": "git", - "url": "https://github.com/symfony/Console.git", + "url": "https://github.com/symfony/console.git", "reference": "0e5e18ae09d3f5c06367759be940e9ed3f568359" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/0e5e18ae09d3f5c06367759be940e9ed3f568359", + "url": "https://api.github.com/repos/symfony/console/zipball/0e5e18ae09d3f5c06367759be940e9ed3f568359", "reference": "0e5e18ae09d3f5c06367759be940e9ed3f568359", "shasum": "" }, @@ -5001,12 +5002,12 @@ "target-dir": "Symfony/Component/Debug", "source": { "type": "git", - "url": "https://github.com/symfony/Debug.git", + "url": "https://github.com/symfony/debug.git", "reference": "fca5696e0c9787722baa8f2ad6940dfd7a6a6941" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Debug/zipball/fca5696e0c9787722baa8f2ad6940dfd7a6a6941", + "url": "https://api.github.com/repos/symfony/debug/zipball/fca5696e0c9787722baa8f2ad6940dfd7a6a6941", "reference": "fca5696e0c9787722baa8f2ad6940dfd7a6a6941", "shasum": "" }, @@ -5215,12 +5216,12 @@ "target-dir": "Symfony/Component/HttpFoundation", "source": { "type": "git", - "url": "https://github.com/symfony/HttpFoundation.git", + "url": "https://github.com/symfony/http-foundation.git", "reference": "e8fd1b73ac1c3de1f76c73801ddf1a8ecb1c1c9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/e8fd1b73ac1c3de1f76c73801ddf1a8ecb1c1c9c", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/e8fd1b73ac1c3de1f76c73801ddf1a8ecb1c1c9c", "reference": "e8fd1b73ac1c3de1f76c73801ddf1a8ecb1c1c9c", "shasum": "" }, @@ -5269,12 +5270,12 @@ "target-dir": "Symfony/Component/HttpKernel", "source": { "type": "git", - "url": "https://github.com/symfony/HttpKernel.git", + "url": "https://github.com/symfony/http-kernel.git", "reference": "a3f0ed713255c0400a2db38b3ed01989ef4b7322" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/a3f0ed713255c0400a2db38b3ed01989ef4b7322", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/a3f0ed713255c0400a2db38b3ed01989ef4b7322", "reference": "a3f0ed713255c0400a2db38b3ed01989ef4b7322", "shasum": "" }, From 81fc77d14295b8fabfdb2fd741b35214e09a5ead Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 7 Nov 2015 23:15:37 +1100 Subject: [PATCH 2/2] Mapped transformers --- app/Models/Contact.php | 5 ++++ app/Models/InvoiceItem.php | 6 ++++ app/Ninja/Transformers/AccountTransformer.php | 25 ++++++++++++++++ app/Ninja/Transformers/ClientTransformer.php | 25 +++++++++++++++- app/Ninja/Transformers/ContactTransformer.php | 9 +++++- .../Transformers/InvoiceItemTransformer.php | 14 ++++++++- app/Ninja/Transformers/InvoiceTransformer.php | 29 ++++++++++++++++++- app/Ninja/Transformers/QuoteTransformer.php | 2 +- app/Ninja/Transformers/UserTransformer.php | 11 ++++++- 9 files changed, 120 insertions(+), 6 deletions(-) diff --git a/app/Models/Contact.php b/app/Models/Contact.php index 782a7e47424a..cc5f6d27963d 100644 --- a/app/Models/Contact.php +++ b/app/Models/Contact.php @@ -22,6 +22,11 @@ class Contact extends EntityModel public static $fieldEmail = 'Contact - Email'; public static $fieldPhone = 'Contact - Phone'; + public function account() + { + return $this->belongsTo('App\Models\Account'); + } + public function client() { return $this->belongsTo('App\Models\Client'); diff --git a/app/Models/InvoiceItem.php b/app/Models/InvoiceItem.php index 396a1c713413..b7b3c8ffc8e9 100644 --- a/app/Models/InvoiceItem.php +++ b/app/Models/InvoiceItem.php @@ -16,4 +16,10 @@ class InvoiceItem extends EntityModel { return $this->belongsTo('App\Models\Product'); } + + public function account() + { + return $this->belongsTo('App\Models\Account'); + } + } diff --git a/app/Ninja/Transformers/AccountTransformer.php b/app/Ninja/Transformers/AccountTransformer.php index e10938ebe235..a9f65a94dff7 100644 --- a/app/Ninja/Transformers/AccountTransformer.php +++ b/app/Ninja/Transformers/AccountTransformer.php @@ -27,6 +27,31 @@ class AccountTransformer extends TransformerAbstract return [ 'account_key' => $account->account_key, 'name' => $account->present()->name, + 'currency_id' => (int) $account->currency_id, + 'timezone_id' => (int) $account->timezone_id, + 'date_format_id' => (int) $account->date_format_id, + 'datetime_format_id' => (int) $account->datetime_format_id, + 'updated_at' => $account->updated_at, + 'deleted_at' => $account->deleted_at, + 'address1' => $account->address1, + 'address2' => $account->address2, + 'city' => $account->city, + 'state' => $account->state, + 'postal_code' => $account->postal_code, + 'country_id' => (int) $account->country_id, + 'invoice_terms' => $account->invoice_terms, + 'email_footer' => $account->email_footer, + 'industry_id' => (int) $account->industry_id, + 'size_id' => (int) $account->size_id, + 'invoice_taxes' => (bool) $account->invoice_taxes, + 'invoice_item_taxes' => (bool) $account->invoice_item_taxes, + 'invoice_design_id' => (int) $account->invoice_design_id, + 'work_phone' => $account->work_phone, + 'work_email' => $account->work_email, + 'language_id' => (int) $account->language_id, + 'fill_products' => (bool) $account->fill_products, + 'update_products' => (bool) $account->update_products, + 'vat_number' => $account->vat_number ]; } } \ No newline at end of file diff --git a/app/Ninja/Transformers/ClientTransformer.php b/app/Ninja/Transformers/ClientTransformer.php index c3041b063b18..2e0664734a83 100644 --- a/app/Ninja/Transformers/ClientTransformer.php +++ b/app/Ninja/Transformers/ClientTransformer.php @@ -39,10 +39,33 @@ class ClientTransformer extends TransformerAbstract public function transform(Client $client) { return [ - 'id' => (int) $client->public_id, + 'public_id' => (int) $client->public_id, 'name' => $client->name, 'balance' => (float) $client->balance, 'paid_to_date' => (float) $client->paid_to_date, + 'user_id' => (int) $client->user_id, + 'account_key' => $client->account->account_key, + 'updated_at' => $client->updated_at, + 'deleted_at' => $client->deleted_at, + 'address1' => $client->address1, + 'address2' => $client->address2, + 'city' => $client->city, + 'state' => $client->state, + 'postal_code' => $client->postal_code, + 'country_id' => (int) $client->country_id, + 'work_phone' => $client->work_phone, + 'private_notes' => $client->private_notes, + 'balance' => (float) $client->balance, + 'paid_to_date' => $client->paid_to_date, + 'last_login' => $client->last_login, + 'website' => $client->website, + 'industry_id' => (int) $client->industry_id, + 'size_id' => (int) $client->size_id, + 'is_deleted' => (bool) $client->is_deleted, + 'payment_terms' => (int) $client->payment_terms, + 'vat_number' => $client->vat_number, + 'id_number' => $client->id_number, + 'language_id' => (int) $client->language_id ]; } } \ No newline at end of file diff --git a/app/Ninja/Transformers/ContactTransformer.php b/app/Ninja/Transformers/ContactTransformer.php index fb63952567fe..ec4a8789ead6 100644 --- a/app/Ninja/Transformers/ContactTransformer.php +++ b/app/Ninja/Transformers/ContactTransformer.php @@ -9,10 +9,17 @@ class ContactTransformer extends TransformerAbstract public function transform(Contact $contact) { return [ - 'id' => (int) $contact->public_id, + 'public_id' => (int) $contact->public_id, 'first_name' => $contact->first_name, 'last_name' => $contact->last_name, 'email' => $contact->email, + 'user_id' => (int) $contact->user_id, + 'updated_at' => $contact->updated_at, + 'deleted_at' => $contact->deleted_at, + 'is_primary' => (bool) $contact->is_primary, + 'phone' => $contact->phone, + 'last_login' => $contact->last_login, + 'account_key' => $contact->account->account_key ]; } } \ No newline at end of file diff --git a/app/Ninja/Transformers/InvoiceItemTransformer.php b/app/Ninja/Transformers/InvoiceItemTransformer.php index b3186afcebb2..8d007002314c 100644 --- a/app/Ninja/Transformers/InvoiceItemTransformer.php +++ b/app/Ninja/Transformers/InvoiceItemTransformer.php @@ -9,8 +9,20 @@ class InvoiceItemTransformer extends TransformerAbstract public function transform(InvoiceItem $item) { return [ - 'id' => (int) $item->public_id, + 'public_id' => (int) $item->public_id, 'product_key' => $item->product_key, + 'account_key' => $item->account->account_key, + 'user_id' => (int) $item->user_id, + 'invoice_id' => (int) $item->invoice_id, + 'product_id' => (int) $item->product_id, + 'updated_at' => $item->updated_at, + 'deleted_at' => $item->deleted_at, + 'product_key' => $item->product_key, + 'notes' => $item->notes, + 'cost' => (float) $item->cost, + 'qty' => (float) $item->qty, + 'tax_name' => $item->tax_name, + 'tax_rate' => $item->tax_rate ]; } } \ No newline at end of file diff --git a/app/Ninja/Transformers/InvoiceTransformer.php b/app/Ninja/Transformers/InvoiceTransformer.php index 5e1dff91db2c..0246ca41907d 100644 --- a/app/Ninja/Transformers/InvoiceTransformer.php +++ b/app/Ninja/Transformers/InvoiceTransformer.php @@ -18,10 +18,37 @@ class InvoiceTransformer extends TransformerAbstract public function transform(Invoice $invoice) { return [ - 'id' => (int) $invoice->public_id, + 'public_id' => (int) $invoice->public_id, 'invoice_number' => $invoice->invoice_number, 'amount' => (float) $invoice->amount, 'balance' => (float) $invoice->balance, + 'client_id' => (int) $invoice->client_id, + 'invoice_status_id' => (int) $invoice->invoice_status_id, + 'updated_at' => $invoice->updated_at, + 'deleted_at' => $invoice->deleted_at, + 'invoice_number' => $invoice->invoice_number, + 'discount' => (double) $invoice->discount, + 'po_number' => $invoice->po_number, + 'invoice_date' => $invoice->invoice_date, + 'due_date' => $invoice->due_date, + 'terms' => $invoice->terms, + 'public_notes' => $invoice->public_notes, + 'is_deleted' => (bool) $invoice->is_deleted, + 'is_recurring' => (bool) $invoice->is_recurring, + 'frequency_id' => (int) $invoice->frequency_id, + 'start_date' => $invoice->start_date, + 'end_date' => $invoice->end_date, + 'last_sent_date' => $invoice->last_sent_date, + 'recurring_invoice_id' => (int) $invoice->recurring_invoice_id, + 'tax_name' => $invoice->tax_name, + 'tax_rate' => (float) $invoice->tax_rate, + 'amount' => (float) $invoice->amount, + 'balance' => (float) $invoice->balance, + 'is_amount_discount' => (bool) $invoice->is_amount_discount, + 'invoice_footer' => $invoice->invoice_footer, + 'partial' => (float) $invoice->partial, + 'has_tasks' => (bool) $invoice->has_tasks, + 'auto_bill' => (bool) $invoice->auto_bill ]; } } \ No newline at end of file diff --git a/app/Ninja/Transformers/QuoteTransformer.php b/app/Ninja/Transformers/QuoteTransformer.php index 7b3cc752d5d0..bfedf7c2513e 100644 --- a/app/Ninja/Transformers/QuoteTransformer.php +++ b/app/Ninja/Transformers/QuoteTransformer.php @@ -18,7 +18,7 @@ class QuoteTransformer extends TransformerAbstract public function transform(Invoice $invoice) { return [ - 'id' => (int) $invoice->public_id, + 'public_id' => (int) $invoice->public_id, 'quote_number' => $invoice->invoice_number, 'amount' => (float) $invoice->amount, ]; diff --git a/app/Ninja/Transformers/UserTransformer.php b/app/Ninja/Transformers/UserTransformer.php index f088bed87904..b73cfa70b016 100644 --- a/app/Ninja/Transformers/UserTransformer.php +++ b/app/Ninja/Transformers/UserTransformer.php @@ -9,10 +9,19 @@ class UserTransformer extends TransformerAbstract public function transform(User $user) { return [ - 'id' => (int) ($user->public_id + 1), + 'public_id' => (int) ($user->public_id + 1), 'first_name' => $user->first_name, 'last_name' => $user->last_name, 'email' => $user->email, + 'account_key' => $user->account->account_key, + 'updated_at' => $user->updated_at, + 'deleted_at' => $user->deleted_at, + 'phone' => $user->phone, + 'username' => $user->username, + 'registered' => (bool) $user->registered, + 'confirmed' => (bool) $user->confirmed, + 'oauth_user_id' => $user->oauth_user_id, + 'oauth_provider_id' => $user->oauth_provider_id ]; } } \ No newline at end of file