You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
493 lines
13 KiB
493 lines
13 KiB
---
|
|
#create a Customer Contact
|
|
-
|
|
name: create a Customer Contact
|
|
type: item
|
|
method: POST
|
|
path: '/api/customercontacts/'
|
|
header:
|
|
Content-Type: application/json
|
|
content:
|
|
firstname: 'cust_contact_first'
|
|
lastname: 'cust_contact_last'
|
|
email: 'cust_contact@custcontact.invalid'
|
|
reseller_id: 1
|
|
conditions:
|
|
is:
|
|
code: 201
|
|
retain:
|
|
customer_contact_path: header.location
|
|
customer_contact_id: header.location
|
|
|
|
#get CustomerContact
|
|
-
|
|
name: check CustomerContact
|
|
type: item
|
|
method: GET
|
|
path: '/${customer_contact_path}'
|
|
retain:
|
|
customer_contact: body
|
|
conditions:
|
|
is:
|
|
code: 200
|
|
|
|
#create a Domain
|
|
-
|
|
name: create a Domain
|
|
type: item
|
|
method: POST
|
|
path: /api/domains/
|
|
header:
|
|
Content-Type: application/json
|
|
content:
|
|
domain: test${unique_id}.example.org
|
|
reseller_id: 1
|
|
conditions:
|
|
is:
|
|
code: 201
|
|
retain:
|
|
domain_path: header.location
|
|
domain_id: header.location
|
|
|
|
#get Domain
|
|
-
|
|
name: check Domain
|
|
type: item
|
|
method: GET
|
|
path: '/${domain_path}'
|
|
retain:
|
|
domain: body
|
|
conditions:
|
|
is:
|
|
code: 200
|
|
|
|
#create billingprofile
|
|
-
|
|
name: create billingprofile
|
|
type: item
|
|
method: POST
|
|
path: '/api/billingprofiles/'
|
|
header:
|
|
Content-Type: application/json
|
|
content:
|
|
reseller_id: 1
|
|
handle: test_profile_${unique_id}
|
|
name: test profile ${unique_id}
|
|
retain:
|
|
billingprofile_id: header.location
|
|
conditions:
|
|
is:
|
|
code: 201
|
|
|
|
#get billingprofile
|
|
-
|
|
name: get billingprofile
|
|
type: item
|
|
method: GET
|
|
path: '/api/billingprofiles/${billingprofile_id}'
|
|
retain:
|
|
billingprofile: body
|
|
conditions:
|
|
is:
|
|
code: 200
|
|
|
|
#create Customer
|
|
-
|
|
name: include create Customer
|
|
type: include
|
|
file: CreateCustomer.yaml
|
|
perl_code: !!perl/code |
|
|
{
|
|
my ($retained) = @_;
|
|
|
|
$retained->{customer_content} = {
|
|
status => 'active',
|
|
contact_id => $retained->{customer_contact_id},
|
|
billing_profile_id => $retained->{billingprofile_id},
|
|
type => 'sipaccount',
|
|
max_subscribers => undef,
|
|
external_id => undef
|
|
};
|
|
}
|
|
|
|
#create Subscriber
|
|
-
|
|
name: include create Subscriber
|
|
type: include
|
|
file: CreateSubscriber.yaml
|
|
perl_code: !!perl/code |
|
|
{
|
|
my ($retained) = @_;
|
|
|
|
my $cc = 800;
|
|
my $ac = '1';
|
|
my $sn = $retained->{unique_id};
|
|
$retained->{customer_id} = $retained->{customer}->{id};
|
|
$retained->{subscriber_content} = {
|
|
primary_number => { cc => $cc, ac => $ac, sn => $sn },
|
|
domain_id => $retained->{domain_id},
|
|
username => 'subscriber_' . '1' . '_'.$retained->{unique_id},
|
|
password => 'subscriber_password',
|
|
customer_id => $retained->{customer_id},
|
|
};
|
|
}
|
|
|
|
#create voucher
|
|
-
|
|
name: create voucher
|
|
type: item
|
|
method: POST
|
|
path: '/api/vouchers/'
|
|
header:
|
|
Content-Type: application/json
|
|
content:
|
|
amount: 1000.0
|
|
code: test_voucher_1${unique_id}
|
|
customer_id: ${customer_id}
|
|
reseller_id: 1
|
|
valid_until: '2037-01-01 00:00:00'
|
|
retain:
|
|
voucher_path1: header.location
|
|
conditions:
|
|
is:
|
|
code: 201
|
|
|
|
#get Voucher
|
|
-
|
|
name: get Voucher
|
|
type: item
|
|
method: GET
|
|
path: '${voucher_path1}'
|
|
retain:
|
|
voucher1: body
|
|
perl_code: !!perl/code |
|
|
{
|
|
my ($retained) = @_;
|
|
$retained->{voucher1_code} = $retained->{voucher1}->{code};
|
|
}
|
|
conditions:
|
|
is:
|
|
code: 200
|
|
|
|
#create voucher
|
|
-
|
|
name: create voucher
|
|
type: item
|
|
method: POST
|
|
path: '/api/vouchers/'
|
|
header:
|
|
Content-Type: application/json
|
|
content:
|
|
amount: 1000.0
|
|
code: test_voucher_2${unique_id}
|
|
customer_id: ${customer_id}
|
|
reseller_id: 1
|
|
valid_until: '2010-01-01 00:00:00'
|
|
retain:
|
|
voucher_path2: header.location
|
|
conditions:
|
|
is:
|
|
code: 201
|
|
|
|
#get Voucher
|
|
-
|
|
name: get Voucher
|
|
type: item
|
|
method: GET
|
|
path: '${voucher_path2}'
|
|
retain:
|
|
voucher2: body
|
|
perl_code: !!perl/code |
|
|
{
|
|
my ($retained) = @_;
|
|
$retained->{voucher2_code} = $retained->{voucher2}->{code};
|
|
$retained->{subscriber_id} = $retained->{subscriber}->{id};
|
|
}
|
|
conditions:
|
|
is:
|
|
code: 200
|
|
|
|
#perform topup cash
|
|
-
|
|
name: perform topup cash
|
|
type: item
|
|
method: POST
|
|
path: '/api/topupcash/'
|
|
header:
|
|
Content-Type: application/json
|
|
content:
|
|
amount: 0.5
|
|
package_id: null
|
|
subscriber_id: invalid
|
|
request_token: 1${unique_id}
|
|
conditions:
|
|
is:
|
|
code: 422
|
|
|
|
#check topuplog
|
|
-
|
|
name: check topuplog
|
|
type: item
|
|
method: GET
|
|
path: '/api/topuplogs/?page=1&rows=10&order_by_direction=asc&order_by=timestamp&request_token=1${unique_id}'
|
|
retain:
|
|
topuplogs_result: body
|
|
perl_code: !!perl/code |
|
|
{
|
|
my ($retained) = @_;
|
|
$retained->{topuplogs} = $retained->{topuplogs_result}->{_embedded}->{'ngcp:topuplogs'}->[0];
|
|
$retained->{expected_token} = "1$retained->{unique_id}";
|
|
$retained->{expected_outcome} = 'failed';
|
|
}
|
|
conditions:
|
|
is:
|
|
'${topuplogs}.request_token': '${expected_token}'
|
|
'${topuplogs}.outcome': '${expected_outcome}'
|
|
like:
|
|
'${topuplogs}.message': "Validation failed. field='subscriber_id'"
|
|
|
|
#perform topup cash
|
|
-
|
|
name: perform topup cash
|
|
type: item
|
|
method: POST
|
|
path: '/api/topupcash/'
|
|
header:
|
|
Content-Type: application/json
|
|
content:
|
|
amount: 'invalid_amount'
|
|
package_id: null
|
|
subscriber_id: ${subscriber_id}
|
|
request_token: 2${unique_id}
|
|
conditions:
|
|
is:
|
|
code: 422
|
|
|
|
#check topuplog
|
|
-
|
|
name: check topuplog
|
|
type: item
|
|
method: GET
|
|
path: '/api/topuplogs/?page=1&rows=10&order_by_direction=asc&order_by=timestamp&request_token=2${unique_id}'
|
|
retain:
|
|
topuplogs_result: body
|
|
perl_code: !!perl/code |
|
|
{
|
|
my ($retained) = @_;
|
|
$retained->{topuplogs} = $retained->{topuplogs_result}->{_embedded}->{'ngcp:topuplogs'}->[0];
|
|
$retained->{expected_token} = "2$retained->{unique_id}";
|
|
$retained->{expected_outcome} = 'failed';
|
|
}
|
|
conditions:
|
|
is:
|
|
'${topuplogs}.request_token': '${expected_token}'
|
|
'${topuplogs}.outcome': '${expected_outcome}'
|
|
like:
|
|
'${topuplogs}.message': "Value cannot be converted to money"
|
|
|
|
#perform topup cash
|
|
-
|
|
name: perform topup cash
|
|
type: item
|
|
method: POST
|
|
path: '/api/topupcash/'
|
|
header:
|
|
Content-Type: application/json
|
|
content:
|
|
amount: 50
|
|
package_id:
|
|
id : invalid
|
|
subscriber_id: ${subscriber_id}
|
|
request_token: 3${unique_id}
|
|
conditions:
|
|
is:
|
|
code: 422
|
|
|
|
#check topuplog
|
|
-
|
|
name: check topuplog
|
|
type: item
|
|
method: GET
|
|
path: '/api/topuplogs/?page=1&rows=10&order_by_direction=asc&order_by=timestamp&request_token=3${unique_id}'
|
|
retain:
|
|
topuplogs_result: body
|
|
perl_code: !!perl/code |
|
|
{
|
|
my ($retained) = @_;
|
|
$retained->{topuplogs} = $retained->{topuplogs_result}->{_embedded}->{'ngcp:topuplogs'}->[0];
|
|
$retained->{expected_token} = "3$retained->{unique_id}";
|
|
$retained->{expected_outcome} = 'failed';
|
|
}
|
|
conditions:
|
|
is:
|
|
'${topuplogs}.request_token': '${expected_token}'
|
|
'${topuplogs}.outcome': '${expected_outcome}'
|
|
like:
|
|
'${topuplogs}.message': "Validation failed. field='package_id'"
|
|
|
|
#perform topup voucher
|
|
-
|
|
name: perform topup voucher
|
|
type: item
|
|
method: POST
|
|
path: '/api/topupvouchers/'
|
|
header:
|
|
Content-Type: application/json
|
|
content:
|
|
code: invalid
|
|
subscriber_id: ${subscriber_id}
|
|
request_token: 4${unique_id}
|
|
conditions:
|
|
is:
|
|
code: 422
|
|
|
|
#check topuplog
|
|
-
|
|
name: check topuplog
|
|
type: item
|
|
method: GET
|
|
path: '/api/topuplogs/?page=1&rows=10&order_by_direction=asc&order_by=timestamp&request_token=4${unique_id}'
|
|
retain:
|
|
topuplogs_result: body
|
|
perl_code: !!perl/code |
|
|
{
|
|
my ($retained) = @_;
|
|
$retained->{topuplogs} = $retained->{topuplogs_result}->{_embedded}->{'ngcp:topuplogs'}->[0];
|
|
$retained->{expected_token} = "4$retained->{unique_id}";
|
|
$retained->{expected_outcome} = 'failed';
|
|
$retained->{long_request_token} = 'a' x 256;
|
|
$retained->{expected_request_token} = substr($retained->{long_request_token},0,255);
|
|
}
|
|
conditions:
|
|
is:
|
|
'${topuplogs}.request_token': '${expected_token}'
|
|
'${topuplogs}.outcome': '${expected_outcome}'
|
|
like:
|
|
'${topuplogs}.message': "Invalid voucher code 'invalid'"
|
|
|
|
#perform topup voucher
|
|
-
|
|
name: perform topup voucher
|
|
type: item
|
|
method: POST
|
|
path: '/api/topupvouchers/'
|
|
header:
|
|
|
|
Content-Type: application/json
|
|
content:
|
|
code: ${voucher1_code}
|
|
subscriber_id: ${subscriber_id}
|
|
request_token: ${long_request_token}
|
|
conditions:
|
|
is:
|
|
code: 422
|
|
|
|
#check topuplog
|
|
-
|
|
name: check topuplog
|
|
type: item
|
|
method: GET
|
|
path: '/api/topuplogs/?page=1&rows=10&order_by_direction=asc&order_by=timestamp&request_token=${expected_request_token}'
|
|
retain:
|
|
topuplogs_result: body
|
|
perl_code: !!perl/code |
|
|
{
|
|
my ($retained) = @_;
|
|
$retained->{topuplogs} = $retained->{topuplogs_result}->{_embedded}->{'ngcp:topuplogs'}->[0];
|
|
}
|
|
conditions:
|
|
is:
|
|
'${topuplogs}.request_token': '${expected_request_token}'
|
|
'${topuplogs}.outcome': 'failed'
|
|
like:
|
|
'${topuplogs}.message': "Validation failed. field='request_token'"
|
|
|
|
#perform topup voucher
|
|
-
|
|
name: perform topup voucher
|
|
type: item
|
|
method: POST
|
|
path: '/api/topupvouchers/'
|
|
header:
|
|
Content-Type: application/json
|
|
content:
|
|
code: ${voucher1_code}
|
|
subscriber_id: ${subscriber_id}
|
|
request_token: 5${unique_id}
|
|
conditions:
|
|
is:
|
|
code: 204
|
|
|
|
#perform same topup voucher
|
|
-
|
|
name: perform same topup voucher
|
|
type: item
|
|
method: POST
|
|
path: '/api/topupvouchers/'
|
|
header:
|
|
Content-Type: application/json
|
|
content:
|
|
code: ${voucher1_code}
|
|
subscriber_id: ${subscriber_id}
|
|
request_token: 6${unique_id}
|
|
conditions:
|
|
is:
|
|
code: 422
|
|
|
|
#check topuplog
|
|
-
|
|
name: check topuplog
|
|
type: item
|
|
method: GET
|
|
path: '/api/topuplogs/?page=1&rows=10&order_by_direction=asc&order_by=timestamp&request_token=6${unique_id}'
|
|
retain:
|
|
topuplogs_result: body
|
|
perl_code: !!perl/code |
|
|
{
|
|
my ($retained) = @_;
|
|
$retained->{topuplogs} = $retained->{topuplogs_result}->{_embedded}->{'ngcp:topuplogs'}->[0];
|
|
$retained->{expected_token} = "6$retained->{unique_id}";
|
|
}
|
|
conditions:
|
|
is:
|
|
'${topuplogs}.request_token': '${expected_token}'
|
|
'${topuplogs}.outcome': 'failed'
|
|
like:
|
|
'${topuplogs}.message': "already used"
|
|
|
|
#perform same topup voucher
|
|
-
|
|
name: perform same topup voucher
|
|
type: item
|
|
method: POST
|
|
path: '/api/topupvouchers/'
|
|
header:
|
|
Content-Type: application/json
|
|
content:
|
|
code: ${voucher2_code}
|
|
subscriber_id: ${subscriber_id}
|
|
request_token: 7${unique_id}
|
|
conditions:
|
|
is:
|
|
code: 422
|
|
|
|
#check topuplog
|
|
-
|
|
name: check topuplog
|
|
type: item
|
|
method: GET
|
|
path: '/api/topuplogs/?page=1&rows=10&order_by_direction=asc&order_by=timestamp&request_token=7${unique_id}'
|
|
retain:
|
|
topuplogs_result: body
|
|
perl_code: !!perl/code |
|
|
{
|
|
my ($retained) = @_;
|
|
$retained->{topuplogs} = $retained->{topuplogs_result}->{_embedded}->{'ngcp:topuplogs'}->[0];
|
|
$retained->{expected_token} = "7$retained->{unique_id}";
|
|
}
|
|
conditions:
|
|
is:
|
|
'${topuplogs}.request_token': '${expected_token}'
|
|
'${topuplogs}.outcome': 'failed'
|
|
like:
|
|
'${topuplogs}.message': "expired" |