Trim registration input in vehicle creation and add contactName parameter to OpenAPI spec and related routes.
This commit is contained in:
@@ -252,6 +252,7 @@ paths:
|
|||||||
- invoiceEmail
|
- invoiceEmail
|
||||||
- contactEmail
|
- contactEmail
|
||||||
- contactPhone
|
- contactPhone
|
||||||
|
- contactName
|
||||||
properties:
|
properties:
|
||||||
cvr:
|
cvr:
|
||||||
type: string
|
type: string
|
||||||
@@ -285,6 +286,10 @@ paths:
|
|||||||
minimum: 10000000
|
minimum: 10000000
|
||||||
maximum: 9999999999
|
maximum: 9999999999
|
||||||
example: 21754690
|
example: 21754690
|
||||||
|
contactName:
|
||||||
|
type: string
|
||||||
|
description: Contact person name
|
||||||
|
example: "Mikkel"
|
||||||
responses:
|
responses:
|
||||||
'201':
|
'201':
|
||||||
description: Customer registered successfully
|
description: Customer registered successfully
|
||||||
|
|||||||
@@ -168,12 +168,13 @@ class authRoute
|
|||||||
/**
|
/**
|
||||||
* Parameters:
|
* Parameters:
|
||||||
*/
|
*/
|
||||||
self::requireParameters(['cvr', 'companyPhone', 'invoiceEmail', 'contactEmail', 'contactPhone']);
|
self::requireParameters(['cvr', 'companyPhone', 'invoiceEmail', 'contactEmail', 'contactPhone', 'contactName']);
|
||||||
$cvr = self::getParameter('cvr');
|
$cvr = self::getParameter('cvr');
|
||||||
$companyPhone = (int)self::getParameter('companyPhone');
|
$companyPhone = (int)self::getParameter('companyPhone');
|
||||||
$invoiceEmail = self::getParameter('invoiceEmail');
|
$invoiceEmail = self::getParameter('invoiceEmail');
|
||||||
$contactEmail = self::getParameter('contactEmail');
|
$contactEmail = self::getParameter('contactEmail');
|
||||||
$contactPhone = (int)self::getParameter('contactPhone');
|
$contactPhone = (int)self::getParameter('contactPhone');
|
||||||
|
$contactName = self::getParameter('contactName');
|
||||||
/**
|
/**
|
||||||
* Validate
|
* Validate
|
||||||
*/
|
*/
|
||||||
@@ -201,6 +202,7 @@ class authRoute
|
|||||||
self::requireMinValue($contactPhone, 10000000);
|
self::requireMinValue($contactPhone, 10000000);
|
||||||
self::requireMaxValue($contactPhone, 9999999999);
|
self::requireMaxValue($contactPhone, 9999999999);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the contact phone is empty, default to company phone
|
* If the contact phone is empty, default to company phone
|
||||||
*/
|
*/
|
||||||
@@ -216,6 +218,7 @@ class authRoute
|
|||||||
if (empty($contactEmail)) {
|
if (empty($contactEmail)) {
|
||||||
$contactEmail = 'jb@truckwash.dk';
|
$contactEmail = 'jb@truckwash.dk';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the cvr already exists
|
* Check if the cvr already exists
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -193,6 +193,8 @@ class vehiclesRoute
|
|||||||
$reg = (string)self::getParameter('reg');
|
$reg = (string)self::getParameter('reg');
|
||||||
$type = (int)self::getParameter('type');
|
$type = (int)self::getParameter('type');
|
||||||
$subscription = (bool)self::getParameter('wash_subscription');
|
$subscription = (bool)self::getParameter('wash_subscription');
|
||||||
|
// Strip the registration number of whitespace
|
||||||
|
$reg = trim($reg);
|
||||||
// Create a new vehicle
|
// Create a new vehicle
|
||||||
$vehicle = new customer_vehicles_o();
|
$vehicle = new customer_vehicles_o();
|
||||||
$vehicle->add(
|
$vehicle->add(
|
||||||
|
|||||||
Reference in New Issue
Block a user