|
|
|
|
@ -138,23 +138,11 @@ sub PATCH :Allow {
|
|
|
|
|
last unless $customer;
|
|
|
|
|
|
|
|
|
|
my $hal = $self->hal_from_customer($c, $customer, $form, $now);
|
|
|
|
|
last unless $self->add_update_journal_item_hal($c,$hal);
|
|
|
|
|
last unless $self->add_update_journal_item_hal($c, $hal);
|
|
|
|
|
|
|
|
|
|
$guard->commit;
|
|
|
|
|
|
|
|
|
|
if ('minimal' eq $preference) {
|
|
|
|
|
$c->response->status(HTTP_NO_CONTENT);
|
|
|
|
|
$c->response->header(Preference_Applied => 'return=minimal');
|
|
|
|
|
$c->response->body(q());
|
|
|
|
|
} else {
|
|
|
|
|
#my $hal = $self->hal_from_customer($c, $customer, $form);
|
|
|
|
|
my $response = HTTP::Response->new(HTTP_OK, undef, HTTP::Headers->new(
|
|
|
|
|
$hal->http_headers,
|
|
|
|
|
), $hal->as_json);
|
|
|
|
|
$c->response->headers($response->headers);
|
|
|
|
|
$c->response->header(Preference_Applied => 'return=representation');
|
|
|
|
|
$c->response->body($response->content);
|
|
|
|
|
}
|
|
|
|
|
$self->return_representation($c, 'hal' => $hal, 'preference' => $preference );
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
@ -187,19 +175,7 @@ sub PUT :Allow {
|
|
|
|
|
|
|
|
|
|
$guard->commit;
|
|
|
|
|
|
|
|
|
|
if ('minimal' eq $preference) {
|
|
|
|
|
$c->response->status(HTTP_NO_CONTENT);
|
|
|
|
|
$c->response->header(Preference_Applied => 'return=minimal');
|
|
|
|
|
$c->response->body(q());
|
|
|
|
|
} else {
|
|
|
|
|
#my $hal = $self->hal_from_customer($c, $customer, $form);
|
|
|
|
|
my $response = HTTP::Response->new(HTTP_OK, undef, HTTP::Headers->new(
|
|
|
|
|
$hal->http_headers,
|
|
|
|
|
), $hal->as_json);
|
|
|
|
|
$c->response->headers($response->headers);
|
|
|
|
|
$c->response->header(Preference_Applied => 'return=representation');
|
|
|
|
|
$c->response->body($response->content);
|
|
|
|
|
}
|
|
|
|
|
$self->return_representation($c, 'hal' => $hal, 'preference' => $preference );
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|