EDI Setup and Configuration: Difference between revisions

From Bitnami MediaWiki
Jump to navigation Jump to search
(Created page with "<strong>EDI Setup and Configuration</strong> {| class="wikitable" |- ! Customer ! Username ! Password |- | This is not a customer | ftp.kiwana | aC{^uo |- | ninodaversa.com | ftp.ninidaversa | LZ6<1[ |- | trinitymetalsgroup.com | ftp.trinity | [y^C$] |}")
 
No edit summary
Line 1: Line 1:
<strong>EDI Setup and Configuration</strong>
<strong>EDI Setup and Configuration</strong>
<strong>Production FTP server.</strong> Connect to sftp://ftp.kiwanatechnologies.com (IP address: 68.68.1.250), using port 22 (default port for SFTP), with the following accounts:


{| class="wikitable"  
{| class="wikitable"  
Line 18: Line 20:
| ftp.trinity
| ftp.trinity
| [y^C$]
| [y^C$]
|}
Each customer’s FTP is isolated from each other. See Customers section.
<strong>Customer setup.</strong> The FTP should have four folders: archive, incoming, logs, and outgoing.
<strong>EDI import from Azure Logic App workflow.</strong> EDI import is done by creating an Azure Logic App workflow. Go to the Azure portal, go to kiwana-logicapp-sandbox Logic App resource, go to Workflows on the left menu, and you should see a list of workflows where each workflow is for importing EDI received from each customer.
<strong>Create Logic App workflow.</strong> Before we create the Logic App workflow, we will need the encrypted string of the customer’s domain name. In Novus-Server Visual Studio solution, open up Startup class in Novus.IdentityServer project. At the end of Configure() method, temporarily add the following code and change domain_name to the customer’s domain name e.g. mrdairy.com:
var oneOffMethods = new StartupOneOffMethods(app);
Debug.WriteLine(oneOffMethods.AesEncrypt("domain_name").encryptedString);
Save and run IdentityServer in debug mode and remember the result of the WriteLine().
In the kiwana-logicapp-sandbox Logic App resource, click Add, enter a workflow name (e.g. customername-scan-edi), select Stateful for State type, and click Create. Go to the newly created workflow and go to Designer.
Click Choose an operation, select Recurrence trigger, set Frequency to Minute, and set Interval to 1, go to Settings, turn on Limit, slide Degree of Parallelism to 1, and click Done. Add a new step > Add an action, select HTTP action, select POST method, enter URI https://novusapi.kiwanatechnologies.com/api/edi/scan, add header Content-Type with value application/json, add header Novus-Domain with value of the encrypted domain name, and add header Novus-Environment with value Production.
The JSON body will consist of passing a database ID of a FTP connection and a file path where the EDI files in the FTP are. Use the customer’s Shell database to insert the FTP connection. Connection types are: VAN (“Value-added network”) or FT (“File Transfer”). The password is AES encrypted like the customer’s domain name.
INSERT INTO ftp_connection (connection_type,connection_id,protocol,username,password,hostname,port,created_on,created_by,version) VALUES (
  'VAN', -- connection_type,
  NULL, -- connection_id,
  'SFTP', -- protocol,
  'ftp.ninodaversa', -- username,
  '+RW+W6HIFqfpH4zUb4sBsw==', -- password,
  '68.68.1.250', -- hostname,
  22, -- port,
  GETUTCDATE(), -- created_on,
  'developer', -- created_by,
  0 -- version
);
In the Body textarea, enter the following JSON with the connection_key of the ftp_connection record:
{​​​​​​​​curl
  "ConnectionKey": 1,
  "FilePath": "incoming"
}​​​​​​​​
Go back to the Overview of the Logic App resource and go to the Run History tab. Wait a bit and then refresh the page to ensure that the jobs are succeeding (even though there’s no EDIs in the incoming folder).
<strong>Example cURL command.</strong> The following is an example cURL command that calls the Novus back end locally running in Visual Studio just like the Logic App workflow, for debugging purposes. Ensure IdentityServer is also running and connected to production database. The below is for DAversa customer:
curl -v -H 'Novus-Domain:UDjRzPrdinoVcPIFE7XoqQ==' -H 'Novus-Environment:Production' -H 'Content-Type:application/json' -d '{​​​​​​​​​​​​​​​​​​​​​​​"FilePath":"incoming","ConnectionKey":1}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​' http://localhost:5001/api/edi/scan
<strong>EDI import back-end logic.</strong> The ConnectionKey is used to get the ftp_connection record to connect to the SFTP server. The list of files is retrieved for the given directory specified in FilePath. For each file, the EDI file is parsed to get the segment terminator to split up the segments. To get the EDI_Trading_Partner record, the logic extracts information from the ISA and GS segments e.g.
ISA*00*          *00*          *XX*LONGOBROS-ST      *00*4166383271-RT     *210803*0641*U*00401*002387678*0*T*>
GS*PO*LONGOBRO-GST*4166383271-GRT*20210803*0641*2287092*X*004010VICS
{| class="wikitable"
|-
! Element
! Description
! Example Value
|-
| ISA-5
| Sender ID Qualifier
| XX
|-
| ISA-6
| Sender ID
| 15-18 characters padded by spaces e.g. “LONGOBROS-ST      ”
|-
| ISA-7
| Receiver ID Qualifier
| 00
|-
| ISA-8
| Receiver ID
| 15-18 characters padded by spaces e.g. “4166383271-RT    ”
|-
| ISA-15
| Usage Indicator. “P” for production, “T” for testing.
| T
|-
| GS-2
| GS Sender ID or Application Sender’s Code
| Usually the same as ISA-6, but could also refer to a specific department within sender e.g. “LONGOBRO-GST”
|-
| GS-3
| GS Receiver ID or Application Receiver’s Code
| Usually the same as ISA-8, but could also refer to a specific department within receiver e.g. “4166383271-GRT”
|}
|}

Revision as of 18:41, 21 September 2023

EDI Setup and Configuration

Production FTP server. Connect to sftp://ftp.kiwanatechnologies.com (IP address: 68.68.1.250), using port 22 (default port for SFTP), with the following accounts:

Customer Username Password
This is not a customer ftp.kiwana aC{^uo
ninodaversa.com ftp.ninidaversa LZ6<1[
trinitymetalsgroup.com ftp.trinity [y^C$]

Each customer’s FTP is isolated from each other. See Customers section.

Customer setup. The FTP should have four folders: archive, incoming, logs, and outgoing.

EDI import from Azure Logic App workflow. EDI import is done by creating an Azure Logic App workflow. Go to the Azure portal, go to kiwana-logicapp-sandbox Logic App resource, go to Workflows on the left menu, and you should see a list of workflows where each workflow is for importing EDI received from each customer.

Create Logic App workflow. Before we create the Logic App workflow, we will need the encrypted string of the customer’s domain name. In Novus-Server Visual Studio solution, open up Startup class in Novus.IdentityServer project. At the end of Configure() method, temporarily add the following code and change domain_name to the customer’s domain name e.g. mrdairy.com:

var oneOffMethods = new StartupOneOffMethods(app);

Debug.WriteLine(oneOffMethods.AesEncrypt("domain_name").encryptedString);

Save and run IdentityServer in debug mode and remember the result of the WriteLine().

In the kiwana-logicapp-sandbox Logic App resource, click Add, enter a workflow name (e.g. customername-scan-edi), select Stateful for State type, and click Create. Go to the newly created workflow and go to Designer.

Click Choose an operation, select Recurrence trigger, set Frequency to Minute, and set Interval to 1, go to Settings, turn on Limit, slide Degree of Parallelism to 1, and click Done. Add a new step > Add an action, select HTTP action, select POST method, enter URI https://novusapi.kiwanatechnologies.com/api/edi/scan, add header Content-Type with value application/json, add header Novus-Domain with value of the encrypted domain name, and add header Novus-Environment with value Production.

The JSON body will consist of passing a database ID of a FTP connection and a file path where the EDI files in the FTP are. Use the customer’s Shell database to insert the FTP connection. Connection types are: VAN (“Value-added network”) or FT (“File Transfer”). The password is AES encrypted like the customer’s domain name.

INSERT INTO ftp_connection (connection_type,connection_id,protocol,username,password,hostname,port,created_on,created_by,version) VALUES (

  'VAN', -- connection_type,

  NULL, -- connection_id,

  'SFTP', -- protocol,

  'ftp.ninodaversa', -- username,

  '+RW+W6HIFqfpH4zUb4sBsw==', -- password,

  '68.68.1.250', -- hostname,

  22, -- port,

  GETUTCDATE(), -- created_on,

  'developer', -- created_by,

  0 -- version

);

In the Body textarea, enter the following JSON with the connection_key of the ftp_connection record:

{​​​​​​​​curl

  "ConnectionKey": 1,

  "FilePath": "incoming"

}​​​​​​​​

Go back to the Overview of the Logic App resource and go to the Run History tab. Wait a bit and then refresh the page to ensure that the jobs are succeeding (even though there’s no EDIs in the incoming folder).

Example cURL command. The following is an example cURL command that calls the Novus back end locally running in Visual Studio just like the Logic App workflow, for debugging purposes. Ensure IdentityServer is also running and connected to production database. The below is for DAversa customer:

curl -v -H 'Novus-Domain:UDjRzPrdinoVcPIFE7XoqQ==' -H 'Novus-Environment:Production' -H 'Content-Type:application/json' -d '{​​​​​​​​​​​​​​​​​​​​​​​"FilePath":"incoming","ConnectionKey":1}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​' http://localhost:5001/api/edi/scan

EDI import back-end logic. The ConnectionKey is used to get the ftp_connection record to connect to the SFTP server. The list of files is retrieved for the given directory specified in FilePath. For each file, the EDI file is parsed to get the segment terminator to split up the segments. To get the EDI_Trading_Partner record, the logic extracts information from the ISA and GS segments e.g.

ISA*00*          *00*          *XX*LONGOBROS-ST      *00*4166383271-RT     *210803*0641*U*00401*002387678*0*T*>

GS*PO*LONGOBRO-GST*4166383271-GRT*20210803*0641*2287092*X*004010VICS

Element Description Example Value
ISA-5 Sender ID Qualifier XX
ISA-6 Sender ID 15-18 characters padded by spaces e.g. “LONGOBROS-ST ”
ISA-7 Receiver ID Qualifier 00
ISA-8 Receiver ID 15-18 characters padded by spaces e.g. “4166383271-RT ”
ISA-15 Usage Indicator. “P” for production, “T” for testing. T
GS-2 GS Sender ID or Application Sender’s Code Usually the same as ISA-6, but could also refer to a specific department within sender e.g. “LONGOBRO-GST”
GS-3 GS Receiver ID or Application Receiver’s Code Usually the same as ISA-8, but could also refer to a specific department within receiver e.g. “4166383271-GRT”