This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -53,7 +53,7 @@
|
|||||||
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
|
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
|
||||||
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
|
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
|
||||||
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
|
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
|
||||||
"AYANOVA_SERVER_TEST_MODE": "false",
|
"AYANOVA_SERVER_TEST_MODE": "true",
|
||||||
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
|
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
|
||||||
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
|
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
|
||||||
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"
|
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"
|
||||||
|
|||||||
@@ -169,11 +169,12 @@ namespace AyaNova.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get billing address for this customer
|
/// Get addresses of interest for Customer id provided
|
||||||
|
/// (postal, physical, headoffice postal if billheadoffice=true)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <returns>Billing address (including headoffice if bill to head office = true)</returns>
|
/// <returns>Multiple addresses</returns>
|
||||||
[HttpGet("bill-to-address/{id}")]
|
[HttpGet("address/{id}")]
|
||||||
public async Task<IActionResult> GetCustomerBillToAddress([FromRoute] long id)
|
public async Task<IActionResult> GetCustomerBillToAddress([FromRoute] long id)
|
||||||
{
|
{
|
||||||
if (!serverState.IsOpen)
|
if (!serverState.IsOpen)
|
||||||
@@ -193,34 +194,35 @@ namespace AyaNova.Api.Controllers
|
|||||||
|
|
||||||
return Ok(ApiOkResponse.Response(new
|
return Ok(ApiOkResponse.Response(new
|
||||||
{
|
{
|
||||||
customer = new PostalAddressRecord(cust.PostAddress, cust.PostCity, cust.PostRegion, cust.PostCountry, cust.PostCode),
|
customerpost = new PostalAddressRecord(cust.PostAddress, cust.PostCity, cust.PostRegion, cust.PostCountry, cust.PostCode),
|
||||||
headoffice = (head == null ? new PostalAddressRecord(head.PostAddress, head.PostCity, head.PostRegion, head.PostCountry, head.PostCode) : new PostalAddressRecord("", "", "", "", ""))
|
customerphys = new AddressRecord(cust.Address, cust.City, cust.Region, cust.Country, cust.Latitude, cust.Longitude),
|
||||||
|
headofficepost = (head == null ? new PostalAddressRecord(head.PostAddress, head.PostCity, head.PostRegion, head.PostCountry, head.PostCode) : new PostalAddressRecord("", "", "", "", ""))
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Get service (physical) address for this customer
|
// /// Get service (physical) address for this customer
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="id"></param>
|
// /// <param name="id"></param>
|
||||||
/// <returns>Service address</returns>
|
// /// <returns>Service address</returns>
|
||||||
[HttpGet("service-address/{id}")]
|
// [HttpGet("service-address/{id}")]
|
||||||
public async Task<IActionResult> GetCustomerServiceAddress([FromRoute] long id)
|
// public async Task<IActionResult> GetCustomerServiceAddress([FromRoute] long id)
|
||||||
{
|
// {
|
||||||
if (!serverState.IsOpen)
|
// if (!serverState.IsOpen)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
if (!Authorized.HasReadFullRole(HttpContext.Items, AyaType.Customer))
|
// if (!Authorized.HasReadFullRole(HttpContext.Items, AyaType.Customer))
|
||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
if (!ModelState.IsValid)
|
// if (!ModelState.IsValid)
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
// return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
var cust = await ct.Customer.AsNoTracking().Where(x => x.Id == id).FirstOrDefaultAsync();
|
// var cust = await ct.Customer.AsNoTracking().Where(x => x.Id == id).FirstOrDefaultAsync();
|
||||||
if (cust == null)
|
// if (cust == null)
|
||||||
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
// return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||||
|
|
||||||
return Ok(ApiOkResponse.Response(new
|
// return Ok(ApiOkResponse.Response(new
|
||||||
{
|
// {
|
||||||
customer = new AddressRecord(cust.Address, cust.City, cust.Region, cust.Country, cust.Latitude, cust.Longitude)
|
// customer = new AddressRecord(cust.Address, cust.City, cust.Region, cust.Country, cust.Latitude, cust.Longitude)
|
||||||
}));
|
// }));
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1373,6 +1373,12 @@ namespace AyaNova.Util
|
|||||||
o.Region = Fake.Address.State();
|
o.Region = Fake.Address.State();
|
||||||
o.Country = Fake.Address.Country();
|
o.Country = Fake.Address.Country();
|
||||||
|
|
||||||
|
o.PostAddress = Fake.Address.StreetAddress();
|
||||||
|
o.PostCity = o.City;
|
||||||
|
o.PostRegion = o.Region;
|
||||||
|
o.PostCountry = o.Country;
|
||||||
|
o.PostCode = Fake.Address.ZipCode();
|
||||||
|
|
||||||
o.Phone1 = Fake.Phone.PhoneNumber();
|
o.Phone1 = Fake.Phone.PhoneNumber();
|
||||||
o.Phone2 = Fake.Phone.PhoneNumber();
|
o.Phone2 = Fake.Phone.PhoneNumber();
|
||||||
o.Phone3 = Fake.Phone.PhoneNumber();
|
o.Phone3 = Fake.Phone.PhoneNumber();
|
||||||
@@ -1438,6 +1444,12 @@ namespace AyaNova.Util
|
|||||||
o.Region = Fake.Address.State();
|
o.Region = Fake.Address.State();
|
||||||
o.Country = Fake.Address.Country();
|
o.Country = Fake.Address.Country();
|
||||||
|
|
||||||
|
o.PostAddress = Fake.Address.StreetAddress();
|
||||||
|
o.PostCity = o.City;
|
||||||
|
o.PostRegion = o.Region;
|
||||||
|
o.PostCountry = o.Country;
|
||||||
|
o.PostCode = Fake.Address.ZipCode();
|
||||||
|
|
||||||
o.Phone1 = Fake.Phone.PhoneNumber();
|
o.Phone1 = Fake.Phone.PhoneNumber();
|
||||||
o.Phone2 = Fake.Phone.PhoneNumber();
|
o.Phone2 = Fake.Phone.PhoneNumber();
|
||||||
o.Phone3 = Fake.Phone.PhoneNumber();
|
o.Phone3 = Fake.Phone.PhoneNumber();
|
||||||
|
|||||||
Reference in New Issue
Block a user