SIMS icon indicating copy to clipboard operation
SIMS copied to clipboard

CAS Integration 3A - Create new Supplier and Site

Open HRAGANBC opened this issue 1 year ago • 2 comments

User Story:

As an SABC Finance team member (Ministry user), I need all students in SIMS to have a supplier and site number attached. If we do not receive a match from the initial CAS supplier search after SIN validation, we need to create a new supplier and site for the student.

Acceptance Criteria:

  • [x] Create new Supplier Status: "Manual Intervention" Set the flag isValid=FALSE

Get Supplier (Last Name and SIN)

  • [x] Ensure initial Get Supplier call uses the follow name format to search:
    • [x] ALL upper case letters
    • [x] Hyphens accepted, not dashes
    • [x] Special characters: Please use our current translation strategy to convert special characters where possible, or omit them.
    • [x] If the student does NOT have a Given name, do NOT attempt the Get Supplier Call. Status: Manual Intervention Required
    • [x] If the student does NOT have a Canada address, do NOT attempt the Get Supplier Call. Status: Manual Intervention Required

Get Supplier Response "404 - Not found":

  • [ ] Schedule these to go once a day at noon during weekdays for now.

  • [ ] Call Create New Supplier and Site (command 1)

  • [ ] Fields to include (See Field Requirements File below): SIN, AddressLine1, City, Province, Country, PostalCode, EmailAddress (Optional/Conditional fields can be left out or left null)

    • [ ] Name Field: Use ALL CAPS. LASTNAME, GIVENNAMES (must have a space after the comma). Hyphens accepted, not dashes (CAS only translation).
    • [ ] AddressLine1: Use first addressline from SIMS. Truncate if ours is longer than supported. Convert or omit special characters (like is done with other integrations).
    • [ ] City: Use as-is
    • [ ] Province: Use abbreviated versions AB,BC,MB,NB,NL,NS,NT,NU,ON,PE,QC,YT
    • [ ] Country: For Canada: CA
    • [ ] Postal Code: ALL CAPS, no space.
    • [ ] Email Address: Use as-is
  • [ ] If successful response to Create New Site & Supplier, then update SIMS CAS table with the returned supplierNumber, SiteCode and any other required info and set isValid=true

  • [ ] If error response, retry for now. Manual intervention may be required and will be dealt with on ticket #3258 image.png

Business Context Supplier Web Service RESTful Client Onboarding v02_01.pdf

Individual Supplier Web Service Field Requirements (All Requests) JAN2023.xlsx

Technical Context

Sample CURL to create

curl --location '${BASEURL}/cfs/supplier/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ${TOKEN}' \
--data-raw '{
    SupplierName: '\''Skywalker, Leia'\'',
    SubCategory: '\''Individual'\'',
    Sin: '\''422233197'\'',
    SupplierAddress: [
    {
        AddressLine1: '\''1012 Douglas St'\'',
        City: '\''Victoria'\'',
        Province: '\''BC'\'',
        Postalcode: '\''V8W 2C3'\'',
        Country: '\''Canada'\'',
        EmailAddress: '\''[email protected]'\'',
    }]
}'

Response:

{"SUPPLIER_NUMBER":"2007638","SUPPLIER_SITE_CODE":"[001] ","CAS-Returned-Messages":"SUCCEEDED"}

Business Context

Command 1 - Create New Supplier and Site Call

SupplierName:

{
    "SupplierName":"SMITH, SUSAN",
    "SubCategory":"Individual",
    "Sin":"",
    "BusinessNumber":"",
    "SupplierAddress":[
       {
           "AddressLine1":"5522 Oyama Lake Rd",
           "AddressLine2":"",
           "AddressLine3":"",
           "City":"Lake Country",
           "Province":"BC",
           "Country":"CA",
           "PostalCode":"V4V2C9",
           "EmailAddress":[email protected],
           "EftAdvicePref": 
       }
    ]
}

Successful Response

{
    "Supplier_Number":"123456789",
    "Supplier_Site_Code":"001",
    "CAS-Returned-Messages":"SUCCESS"
}
**Error Response**
{
    "Supplier_Number":"123456789",
    "Supplier_Site_Code":"001",
    "CAS-Returned-Messages":"Error Message"
}

Technical

  • [ ] While creating the new supplier on CAS ensure the name also has the special characters removed.
  • [x] To handle the " Special characters", extract the logic from method convertRawContent to the string-utils.ts.
    • [x] The method should receive a string and return a string.
    • [x] Add the hyphen/dash conversion. hyphen-minus is the ASCII character 45 while the "dash" is a Unicode character, hence it would make sense to add it to the conversation shared with the SFTP.
    • [ ] Check if the request was successful by inspecting the response property "CAS-Returned-Messages":"SUCCEEDED".
      • [ ] If the value is different than SUCCEEDED log the error message.
  • [x] Create the new status Manual intervention required.
    • [x] For the business AC that leads to Manual Intervention Required, set the is_valid column to false.
  • [ ] Log to the ProcessSummary the individual errors for the students.
    • [ ] Ensure that all the students will have at least one attempt, meaning do not stop processing at the first student error.
    • [ ] If some error is present throw in the scheduler to allow it to be retried.
  • [ ] Expand existing E2E tests. Please add at least the below positive scenario.
    • [ ] Should create a new supplier on CAS and update sims.cas_suppliers table when the student was not found on CAS and the request to create the supplier was successful.
    • [ ] Should set the case supplier record status as 'Manual Intervention Required' when the student does not have the first name.
  • [ ] Breaking the PR.
    • [x] Adjust the "Get Supplier", including the characters translations.
    • [ ] Create the CAS call.

HRAGANBC avatar May 09 '24 21:05 HRAGANBC

@CarlyCotton I would like to request the change of the below AC, from

Hyphens accepted, not dashes (CAS only translation)

to

Hyphens accepted, not dashes.

The point is that "dashes" can also be present on names and it is not an ASCII character hence it would make sense to have it added in the current ASCII conversion table that we use for the SFTP. Please let me know if there is any concern.

andrewsignori-aot avatar Oct 09 '24 23:10 andrewsignori-aot

@andrewsignori-aot Updated the AC. Happy to keep things consistent across SIMS when possible rather than have one-offs.

CarlyCotton avatar Oct 10 '24 15:10 CarlyCotton

Demo

New student created (New Supplier and Site Created)

Basic BCeID used: andrew_signori_cas_1

image.png

New Supplier and Site Creation

Completed on Ministry Portal

image.png

Bull Logs

{
  "jobData": {},
  "returnValue": [
    "Process finalized with success.",
    "Pending suppliers to update found: 1.",
    "Records updated: 1."
  ]
}
Log details
[2024-10-28 18:59:53]INFO: Log details
[2024-10-28 18:59:45]INFO: Executing CAS supplier integration...
[2024-10-28 18:59:45]INFO: Found 1 records to be updated.
[2024-10-28 18:59:53]--INFO: Log details
[2024-10-28 18:59:53]----INFO: Log details
[2024-10-28 18:59:53]------INFO: Log details
[2024-10-28 18:59:45]------INFO: Processing student CAS supplier ID: 119.
[2024-10-28 18:59:47]------INFO: CAS evaluation result status: NotFound.
[2024-10-28 18:59:47]------INFO: No active CAS supplier found. Reason: Supplier not found.
[2024-10-28 18:59:53]------INFO: Created supplier and site on CAS.
[2024-10-28 18:59:53]------INFO: Updated CAS supplier and site for the student.
[2024-10-28 18:59:53]INFO: CAS supplier integration executed.

Dabase Persisted Formats

image.png

New student created (No first name and no Canadian Address)

Basic BCeID used: andrew_signori_cas_2

image.png

Completed on Ministry Portal

image.png

Bull Logs

{
  "jobData": {},
  "returnValue": [
    "Process finalized with success.",
    "Pending suppliers to update found: 1.",
    "Records updated: 1.",
    "Attention, process finalized with success but some errors and/or warnings messages may require some attention.",
    "Error(s): 0, Warning(s): 1, Info: 10"
  ]
}
Log details
[2024-10-28 19:49:56]INFO: Log details
[2024-10-28 19:49:55]INFO: Executing CAS supplier integration...
[2024-10-28 19:49:56]INFO: Found 1 records to be updated.
[2024-10-28 19:49:56]--INFO: Log details
[2024-10-28 19:49:56]----INFO: Log details
[2024-10-28 19:49:56]------INFO: Log details
[2024-10-28 19:49:56]------INFO: Processing student CAS supplier ID: 120.
[2024-10-28 19:49:56]------INFO: CAS evaluation result status: PreValidationsFailed.
[2024-10-28 19:49:56]------WARN: Not possible to retrieve CAS supplier information because some pre-validations were not fulfilled. Reason(s): Given names not present, Non-Canadian address.
[2024-10-28 19:49:56]------INFO: Updated CAS supplier for manual intervention.
[2024-10-28 19:49:56]INFO: CAS supplier integration executed.

New student created (active student present on CAS, and active matching address)

Basic BCeID used: andrew_signori_cas_3

image.png

Completed on Ministry Portal

image.png

Bull Logs

{
  "jobData": {},
  "returnValue": [
    "Process finalized with success.",
    "Pending suppliers to update found: 1.",
    "Records updated: 1."
  ]
}
Log details
[2024-10-28 20:10:25]INFO: Log details
[2024-10-28 20:10:20]INFO: Executing CAS supplier integration...
[2024-10-28 20:10:20]INFO: Found 1 records to be updated.
[2024-10-28 20:10:25]--INFO: Log details
[2024-10-28 20:10:25]----INFO: Log details
[2024-10-28 20:10:25]------INFO: Log details
[2024-10-28 20:10:20]------INFO: Processing student CAS supplier ID: 121.
[2024-10-28 20:10:25]------INFO: CAS evaluation result status: ActiveSupplierAndSiteFound.
[2024-10-28 20:10:25]------INFO: Active CAS supplier and site found.
[2024-10-28 20:10:25]------INFO: Updated CAS supplier for the student.
[2024-10-28 20:10:25]INFO: CAS supplier integration executed.

@CarlyCotton from the above scenarios, which ones would you like to see on a demo? Some, all? If all I can reuse the users and present the UI results and logs. If there is a missing scenario please let me know that I can prepare for tomorrow.

andrewsignori-aot avatar Oct 25 '24 21:10 andrewsignori-aot