Standard Sub Customers Import
Introduction
This will import Sub customers.
download sample sub-customers import file.
Fields
Visn Sub Customers Import
| Field name | Description | Max length | Datatype | Rules | Mandatory | Default Value | Example | 
|---|---|---|---|---|---|---|---|
| Customer Name | Customer Name | 50 | String | a-zA-Z0-9- ' | N | Senger Boyer and Corkery | |
| Company Registration Number | Company Registration Number | 50 | String | A-Z and 0-9 & All Special Char | N | 04876932 | |
| Account Number | Account Number | 50 | String | A-Z and 0-9 & All Special Char | Y | ACC852614 | |
| 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 | |
| Consumer | Consumer | 1 | String | ‘Y' / 'N’ | N | Y | |
| Cost Centre | Cost Centre | 15 | String | [ A-Za-z0-9_@./'#&+-/(/)' '] | N | 10 | |
| Invoice Centre | Invoice Centre | 15 | String | [ A-Za-z0-9_@./'#&+-/(/)' '] | N | 100 | |
| Building Number | Building Number | 50 | String | A-Z and 0-9 & All Special Char | N | 20 | |
| Street Name | Street Name | 100 | String | A-Z and 0-9 & All Special Char | N | George Street | |
| District | District | 50 | String | A-Z and 0-9 & All Special Char | N | Lambeth | |
| Town | Town | 100 | String | A-Z and 0-9 & All Special Char | N | London | |
| County | 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 | |
| Contact Name | Contact Name | 50 | String | a-zA-Z0-9- ' | N | Adah | |
| 50 | String | Standard email format | N | jitendra+urbkir@digitalinnk.com | |||
| Contact Number | Contact Number | 15 | Numeric | 0-9 | N | 01234567891 | |
| Mobile Number | Mobile Number | 15 | Numeric | 0-9 | N | 01234567890 | |
| Alert Email | Alert Email | 50 | String | Standard email format | N | alertEmail+lynewy@digitalinnk.com | |
| 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! | 
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:subCustomers - 
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:subCustomers - 
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:subCustomers - 
Leave Overrides empty
 

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


Importing the file via cloud run
Creating Schedulers for validating the 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: 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 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": "subCustomers.csv",
  "email": "mailgun@digitalinnk.com",
  "fatalErrorEmailToAddress": "mailgun@digitalinnk.com"
}
Create scheduler for validating the sub-customers



Creating Schedulers for importing the 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: 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 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": "subCustomers.csv",
  "email": "mailgun@digitalinnk.com",
  "fatalErrorEmailToAddress": "mailgun@digitalinnk.com"
}
Create scheduler for importing the 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 "subCustomers". This action will place the file in the specified location within the designated bucket.
 

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

logs in cloud

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

logs in cloud

Testing:
- 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: Harish on March 25, 2024
Revisions