From 95e1baed2913d2cd422085005274424d631db967 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 7 Feb 2016 19:30:47 +1100 Subject: [PATCH 1/4] testing payment api --- app/Http/Controllers/PaymentApiController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/PaymentApiController.php b/app/Http/Controllers/PaymentApiController.php index bcdbc6b1ca40..c2289b952a54 100644 --- a/app/Http/Controllers/PaymentApiController.php +++ b/app/Http/Controllers/PaymentApiController.php @@ -101,7 +101,7 @@ class PaymentApiController extends BaseAPIController return $this->response($data); } - + /** * @SWG\Post( * path="/payments", @@ -155,6 +155,8 @@ class PaymentApiController extends BaseAPIController $this->contactMailer->sendPaymentConfirmation($payment); } + Log::info($payment); + /* $payment = Payment::scope($payment->public_id)->with('client', 'contact', 'user', 'invoice')->first(); $transformer = new PaymentTransformer(Auth::user()->account, Input::get('serializer')); From 0c251392eb08bc25c040fbdac5679627a2b0ac40 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 7 Feb 2016 19:32:43 +1100 Subject: [PATCH 2/4] testing payment api --- app/Http/Controllers/PaymentApiController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/PaymentApiController.php b/app/Http/Controllers/PaymentApiController.php index c2289b952a54..33aad548f85b 100644 --- a/app/Http/Controllers/PaymentApiController.php +++ b/app/Http/Controllers/PaymentApiController.php @@ -2,6 +2,7 @@ use App\Ninja\Mailers\ContactMailer; use Auth; +use Illuminate\Support\Facades\Log; use Input; use Utils; use Response; @@ -156,7 +157,6 @@ class PaymentApiController extends BaseAPIController } Log::info($payment); - /* $payment = Payment::scope($payment->public_id)->with('client', 'contact', 'user', 'invoice')->first(); $transformer = new PaymentTransformer(Auth::user()->account, Input::get('serializer')); From 7d2f635272f078441f682248c4548907d4696edb Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 7 Feb 2016 19:39:51 +1100 Subject: [PATCH 3/4] testing payment api --- app/Http/Controllers/PaymentApiController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/PaymentApiController.php b/app/Http/Controllers/PaymentApiController.php index 33aad548f85b..3a9a5bd5635b 100644 --- a/app/Http/Controllers/PaymentApiController.php +++ b/app/Http/Controllers/PaymentApiController.php @@ -156,13 +156,15 @@ class PaymentApiController extends BaseAPIController $this->contactMailer->sendPaymentConfirmation($payment); } - Log::info($payment); /* $payment = Payment::scope($payment->public_id)->with('client', 'contact', 'user', 'invoice')->first(); $transformer = new PaymentTransformer(Auth::user()->account, Input::get('serializer')); $data = $this->createItem($payment, $transformer, 'payment'); */ - $invoice = Invoice::scope($payment->invoice_id)->with('client', 'invoice_items', 'invitations')->first(); + $invoice = Invoice::scope($invoice->public_id)->with('client', 'invoice_items', 'invitations')->first(); + + + $transformer = new InvoiceTransformer(\Auth::user()->account, Input::get('serializer')); $data = $this->createItem($invoice, $transformer, 'invoice'); From b3346011bc2a15b0647323b30bd8762c0952a2f9 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 7 Feb 2016 20:20:38 +1100 Subject: [PATCH 4/4] api bug fixes --- app/Http/Controllers/PaymentApiController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/PaymentApiController.php b/app/Http/Controllers/PaymentApiController.php index 3a9a5bd5635b..e52cc2807109 100644 --- a/app/Http/Controllers/PaymentApiController.php +++ b/app/Http/Controllers/PaymentApiController.php @@ -91,12 +91,14 @@ class PaymentApiController extends BaseAPIController { $data = Input::all(); $data['public_id'] = $publicId; + $invoice = Invoice::scope($data['invoice_id'])->with('client')->first(); + $error = false; $payment = $this->paymentRepo->save($data); if ($error) { return $error; } - $invoice = Invoice::scope($payment->invoice_id)->with('client', 'invoice_items', 'invitations')->first(); + $invoice = Invoice::scope($invoice->public_id)->with('client', 'invoice_items', 'invitations')->first(); $transformer = new InvoiceTransformer(\Auth::user()->account, Input::get('serializer')); $data = $this->createItem($invoice, $transformer, 'invoice'); return $this->response($data);