MT#7959 update contracts api doc

gjungwirth/voicemail_number
Gerhard Jungwirth 11 years ago
parent b40f4e7721
commit fc4bdaf750

@ -20,7 +20,7 @@ class_has 'api_description' => (
is => 'ro',
isa => 'Str',
default =>
'Specifies the fees to be applied for a call if it matches the source or destination number of the call. You can POST fees individually one-by-one using json. To bulk-upload fees, specify the Content-Type as "text/csv" and POST the CSV in the request body to the collection while specifying the the billing profile via URI parameters, like "/api/billingfees/?billing_profile_id=xx&purge_existing=true"'
'Specifies the fees to be applied for a call if it matches the source or destination number of the call. You can POST fees individually one-by-one using json. To bulk-upload fees, specify the Content-Type as "text/csv" and POST the CSV in the request body to the collection while specifying the the billing profile via URI parameters, like "/api/billingfees/?billing_profile_id=xx&purge_existing=true"'
);
class_has 'query_params' => (

@ -20,7 +20,7 @@ class_has 'api_description' => (
is => 'ro',
isa => 'Str',
default =>
'Defines a billing container for peerings and resellers. A <a href="#billingprofiles">Billing Profile</a> is assigned to a contract, and it has <a href="#contractbalances">Contract Balances</a> indicating the saldo of the contract for current and past billing intervals.'
'Defines a billing container for peerings and resellers. A <a href="#billingprofiles">Billing Profile</a> is assigned to a contract, and it has <a href="#contractbalances">Contract Balances</a> indicating the saldo of the contract for current and past billing intervals.',
);
class_has 'query_params' => (
@ -67,7 +67,7 @@ __PACKAGE__->config(
Does => [qw(ACL CheckTrailingSlash RequireSSL)],
Method => $_,
Path => __PACKAGE__->dispatch_path,
} } @{ __PACKAGE__->allowed_methods }
} } @{ __PACKAGE__->allowed_methods },
},
action_roles => [qw(HTTPMethods)],
);
@ -77,6 +77,7 @@ sub auto :Private {
$self->set_body($c);
$self->log_request($c);
return 1;
}
sub GET :Allow {
@ -159,13 +160,6 @@ sub POST :Allow {
);
last unless $resource;
# TODO: check type
my $product_class = delete $resource->{type};
unless($product_class eq "sippeering" || $product_class eq "reseller") {
$self->error($c, HTTP_UNPROCESSABLE_ENTITY, "Invalid 'type', must be 'sippeering' or 'reseller'.");
last;
}
unless(defined $resource->{billing_profile_id}) {
$self->error($c, HTTP_UNPROCESSABLE_ENTITY, "Invalid 'billing_profile_id', not defined.");
last;
@ -191,6 +185,7 @@ sub POST :Allow {
$self->error($c, HTTP_UNPROCESSABLE_ENTITY, "Invalid 'billing_profile_id'.");
last;
}
my $product_class = delete $resource->{type};
my $product = $schema->resultset('products')->find({ class => $product_class });
unless($product) {
$self->error($c, HTTP_UNPROCESSABLE_ENTITY, "Invalid 'type'.");
@ -238,6 +233,7 @@ sub end : Private {
my ($self, $c) = @_;
$self->log_response($c);
return;
}
# vim: set tabstop=4 expandtab:

@ -0,0 +1,26 @@
package NGCP::Panel::Form::Contract::PeeringResellerAPI;
use HTML::FormHandler::Moose;
extends 'NGCP::Panel::Form::Contract::PeeringReseller';
has_field 'type' => (
type => 'Select',
options => [
{ value => 'sippeering', label => 'Peering'},
{ value => 'reseller', label => 'Reseller'},
],
required => 1,
element_attr => {
rel => ['tooltip'],
title => ['Either "sippeering" or "reseller".']
},
);
has_block 'fields' => (
tag => 'div',
class => [qw/modal-body/],
render_list => [qw/contact billing_profile status external_id type/],
);
1;
# vim: set tabstop=4 expandtab:

@ -13,7 +13,7 @@ use Data::HAL::Link qw();
use HTTP::Status qw(:constants);
use NGCP::Panel::Utils::DateTime;
use NGCP::Panel::Utils::Contract;
use NGCP::Panel::Form::Contract::PeeringReseller qw();
use NGCP::Panel::Form::Contract::PeeringResellerAPI qw();
sub item_rs {
my ($self, $c) = @_;
@ -34,7 +34,7 @@ sub item_rs {
sub get_form {
my ($self, $c) = @_;
return NGCP::Panel::Form::Contract::PeeringReseller->new;
return NGCP::Panel::Form::Contract::PeeringResellerAPI->new;
}
sub hal_from_contract {

Loading…
Cancel
Save