Zenith Sub Customers Import
Introduction
This will import zenith sub customers.
download sample sub-customers import file.
Fields
Zenith Sub Customers Import
| Zenith Customer contract fields | Description | Max length | Data Type | Rules | Mandatory | Default Value | Example | 
|---|---|---|---|---|---|---|---|
| Customer Name | Customer Name | 150 | String | A-Z & 0-9 and special characters | N | Éléonore-Marie de Bourbon-Condé | |
| Customer Account Number | Account Number | 50 | String | A-Z & 0-9 and special characters | Y | ZNKFHA04 | |
| VAT Number | VAT Number | 10 | String | A-Z and 0-9 & All Special Char | N | GB244524763 | |
| Vehicle Product | Vehicle Product | 50 | String | A-Z and 0-9 & All Special Char | N | Business Contract Hire | |
| Cost Centre | Cost Centre | 15 | String | [ A-Za-z0-9_@./'#&+-/(/)' '] | N | 10 | |
| Invoice Centre | Invoice Centre | 15 | String | [ A-Za-z0-9_@./'#&+-/(/)' '] | N | 100 | |
| Address 1 | Building Number | 50 | String | A-Z and 0-9 & All Special Char | N | 20 | |
| Address 2 | Street Name | 100 | String | A-Z and 0-9 & All Special Char | N | George Street | |
| Address 3 | District | 50 | String | A-Z and 0-9 & All Special Char | N | Lambeth | |
| Address 4 | Town | 100 | String | A-Z and 0-9 & All Special Char | N | London | |
| Address 5 | County | 50 | String | A-Z and 0-9 & All Special Char | N | Surrey and Kent | |
| Postcode | Postcode | 15 | String | [a-zA-Z0-9] | N | B57AA | |
| Customer Email | 50 | String | Standard email format | N | jitendra+urbkir@digitalinnk.com | ||
| Customer Contact | Contact Number | 15 | Numeric | 0-9 | N | 01234567891 | |
| Customer Number | Mobile Number | 15 | Numeric | 0-9 | N | 01234567890 | |
| Customer Policy Notes | Policy Notes | 250 | String | A-Z and 0-9 & All Special Char | N | I'll navigate the cross-platform UTF8 capacitor, that should interface the XML transmitter! | |
| Customer Recharge Limit | Recharge Limit | 6 | Numeric | 0-9 | N | 300 | |
| Customer Referral Limit | Referral Limit | 6 | Numeric | 0-9 | N | 300 | 
Importing a file
Preparation
- 
Create a new branch with Jira task number in the branch name
 - 
Delete all the files in importFiles folder
 - 
Create a folder with the current sprint number
 - 
Copy the file that needs to be imported
 - 
Go to
package.json, find the linevalidate:zenithSubCustomers - 
Modify
--leaseIdwith the required lease Id - 
Modify
--filewith the relative path of the file - 
Save package.json
 
Validating locally
- 
in a terminal run
npm run build - 
in a terminal run
npm run validate:zenithSubCustomers - 
If there are no errors, push the code
 
Validating in workflow
- 
Go to Action of Import-manger
 - 
Find
<Environment> - on-demand-import - 
Select the branch that was created for this import
 - 
Enter script name as
validate:zenithSubCustomers - 
Leave Overrides empty
 

Importing the file
- 
If the validation has passed
 - 
Go to Action of Import-manger
 - 
Find
<Environment> - on-demand-import - 
Select the branch that was created for this import
 - 
Enter script name as
import:zenithSubCustomers - 
Enter
--persistin Overrides field 


Importing the file via cloud run
Creating Schedulers for validating the zenith-sub-customers
- Go to Cloud Scheduler and select the CREATE JOB
 
Setup Required
A Scheduler should be created cloud scheduler with the following parameters
- Name: zenith_sub_customer_import_file_validation
 - Region: europe-west2
 - Frequency: 0 0 31 12 1
 - TimeZone: GMT London
 - Target type: HTTP
 - URL: https://import-manager-36r2bu4izq-uc.a.run.app/import-subCustomers
 - HTTP method: POST
 - Auth header: select OIDC token
 - Service account: cloud-run-import-customer-contract
 - body: a JSON object including the following parameters
 
JSON object for zenith_sub_customer_import_file_validation scheduler
{
  "leaseId": "QJKgdjS4I02sEia4yTne",
  "leaseCompanyName": "Next Fleet Services",
  "persist": "false",
  "bucket": "biddirect-2.appspot.com",
  "appDirectory": "/usr/src/app/",
  "importPath": "imports/fileDrop/",
  "importFileDropPath": "imports/fileDrop/",
  "importFileName": "zenithSubCustomer.csv",
  "email": "mailgun@digitalinnk.com",
  "fatalErrorEmailToAddress": "mailgun@digitalinnk.com",
  "schema": "ZENITH_SUB_CUSTOMER"
}
Create scheduler for validating the zenith-sub-customers



Creating Schedulers for importing the zenith-sub-customers
- Go to Cloud Scheduler and select the CREATE JOB
 
Setup Required
A Scheduler should be created cloud scheduler with the following parameters
- Name: zenith_sub_customer_file_import
 - Region: europe-west2
 - Frequency: 0 0 31 12 1
 - TimeZone: GMT London
 - Target type: HTTP
 - URL: https://import-manager-36r2bu4izq-uc.a.run.app/import-subCustomers
 - HTTP method: POST
 - Auth header: select OIDC token
 - Service account: cloud-run-import-customer-contract
 - body: a JSON object including the following parameters
 
JSON object for zenith_sub_customer_file_import scheduler
{
  "leaseId": "QJKgdjS4I02sEia4yTne",
  "leaseCompanyName": "Next Fleet Services",
  "persist": "true",
  "bucket": "biddirect-2.appspot.com",
  "appDirectory": "/usr/src/app/",
  "importPath": "imports/fileDrop/",
  "importFileDropPath": "imports/fileDrop/",
  "importFileName": "zenithSubCustomer.csv",
  "email": "mailgun@digitalinnk.com",
  "fatalErrorEmailToAddress": "mailgun@digitalinnk.com",
  "schema": "ZENITH_SUB_CUSTOMER"
}
Create scheduler for importing the zenith-sub-customers



Preparation:
- Bucket name is biddirect-2.appspot.com and it will vary for higher envs and the file path should imports/fileDrop, where you can drop the CSV file named "zenithSubCustomer". This action will place the file in the specified location within the designated bucket.
 

Validation:
- Go to Cloud Scheduler
 - Run zenith_sub_customer_import_file_validation job (job name could be different on other env)
 

logs in cloud

Importing:
- Go to Cloud Scheduler
 - Run zenith_sub_customer_file_import job (job name could be different on other env)
 

logs in cloud

Testing
- Zenith Sub-customers will be created under customer. You can verify this by navigating to the ViSN customer platform and selecting 
Settings > Customers. 
Status: Pending Approval
Category: Protected
Authored By: Hadley on June 20, 2024
Revisions