SIMS icon indicating copy to clipboard operation
SIMS copied to clipboard

CAS Integration 3B - Create New Site (Supplier found, Multiple Sites / No matching address)

Open CarlyCotton opened this issue 1 year ago • 0 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 receive a successful response from a Get Supplier call, we need to assign that Supplier Number to the student and either use an existing Site or create a new one. We should use an existing site if the addressline/postal code match to avoid duplication.

Acceptance Criteria:

  • If a Get Supplier Response is Successful and returns a Supplier that is NOT Active ignore for now see CAS4 #3258

  • [ ] If a Get Supplier Response is Successful and returns Active Supplier and NO active Sites, Create New Site

  • [ ] If a Get Supplier Response is Successful and returns Active Supplier and ONE active Site, Compare the Response AddressLine1 and Postal Code to SIMS address (Compare against the Addressline and Postalcode as we would be submitting and NOT case sensitive. Truncated and translated / No space in postal code):

    • [ ] Match FOUND: Save/Use that site.
    • [ ] NO Match: Create New Site
  • [ ] If a Get Supplier Response is Successful and returns Active Supplier and MULTIPLE active Sites, Search through active sites to look for addressline 1/postal code match:

    • [ ] Match FOUND: Save/Use that site.
    • [ ] NO Match: Create New Site

Create New Site

  • [ ] Only use the Create New Site based on the two GET conditions:
    • Get Supplier Response is Successful and returns Active Supplier and ONE active Site which doesn't have an address match
    • Get Supplier Response is Successful and returns Active Supplier and MULTIPLE active Sites, none of them have a matching address
  • [ ] Fields to include (See Field Requirements File below): SupplierNumber, AddressLine1, City, Province, Country, PostalCode, EmailAddress (Optional/Conditional fields can be left out or left null)
    • [ ] 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
    • [ ] Postal Code: ALL CAPS, no space.
    • [ ] Email Address: Use as-is
  • [ ] If successful response to Create New Site, then update SIMS CAS table with the prior Get Supplier 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

Business Context Supplier Web Service RESTful Client Onboarding v02_01.pdf

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

image.png

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

** Create Site for Existing Supplier**

{
 "SupplierNumber":"2002492",
 "SupplierAddress":[
 {
 "AddressLine1":"3350 CLEARBROOK RD",
 "AddressLine2":"",
 "AddressLine3":"",
 "City":"ABBOTSFORD",
 "Province":"BC",
 "Country":"CA",
 "PostalCode":"V2T4T4",
 "EmailAddress":"[email protected]",
 "EftAdvicePref":"E"
} 
]
}

Success 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"
}
image.png

CarlyCotton avatar Sep 23 '24 17:09 CarlyCotton