api bug fixes

This commit is contained in:
David Bomba 2016-02-07 20:20:38 +11:00
parent 7d2f635272
commit b3346011bc

View File

@ -91,12 +91,14 @@ class PaymentApiController extends BaseAPIController
{ {
$data = Input::all(); $data = Input::all();
$data['public_id'] = $publicId; $data['public_id'] = $publicId;
$invoice = Invoice::scope($data['invoice_id'])->with('client')->first();
$error = false; $error = false;
$payment = $this->paymentRepo->save($data); $payment = $this->paymentRepo->save($data);
if ($error) { if ($error) {
return $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')); $transformer = new InvoiceTransformer(\Auth::user()->account, Input::get('serializer'));
$data = $this->createItem($invoice, $transformer, 'invoice'); $data = $this->createItem($invoice, $transformer, 'invoice');
return $this->response($data); return $this->response($data);