From b3346011bc2a15b0647323b30bd8762c0952a2f9 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 7 Feb 2016 20:20:38 +1100 Subject: [PATCH] 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);