Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { ICAF } from '~/shared/interfaces/caf.interface';
  2. import { CAFStatus, DTEType } from '~/shared/enums/document.enum';
  3.  
  4. export class CAFSimulation {
  5.     // Duplicate CAFS
  6.     public BRASIL_408: string = '[{"id":1,"st":3,"dt":39,"fo":1100,"rt":1100,"rb":101,"ed":"2019-03-15","ca":"2019-03-15 13:06:55","ua":"2019-03-28 16:39:47"},{"id":2,"st":3,"dt":39,"fo":2100,"rt":2100,"rb":1101,"ed":"2019-03-27","ca":"2019-03-27 09:33:17","ua":"2019-04-05 14:30:55"},{"id":3,"st":3,"dt":39,"fo":2100,"rt":2100,"rb":1101,"ed":"2019-03-27","ca":"2019-03-27 09:33:17","ua":"2019-04-01 18:29:59"},{"id":4,"st":2,"dt":39,"fo":2101,"rt":3100,"rb":2101,"ed":"2019-04-01","ca":"2019-04-02 09:04:55","ua":"2019-04-02 09:04:55"},{"id":5,"st":2,"dt":39,"fo":2101,"rt":3100,"rb":2101,"ed":"2019-04-01","ca":"2019-04-02 09:04:55","ua":"2019-04-02 09:04:55"},{"id":6,"st":3,"dt":39,"fo":4100,"rt":4100,"rb":3101,"ed":"2019-04-04","ca":"2019-04-04 11:06:39","ua":"2019-04-13 13:59:44"},{"id":7,"st":3,"dt":39,"fo":5100,"rt":5100,"rb":4101,"ed":"2019-04-08","ca":"2019-04-08 20:13:48","ua":"2019-04-16 15:56:22"},{"id":8,"st":3,"dt":39,"fo":6100,"rt":6100,"rb":5101,"ed":"2019-04-16","ca":"2019-04-16 11:55:47","ua":"2019-04-19 12:51:38"},{"id":9,"st":2,"dt":39,"fo":6101,"rt":7100,"rb":6101,"ed":"2019-04-18","ca":"2019-04-18 12:35:44","ua":"2019-04-18 12:35:44"},{"id":10,"st":3,"dt":39,"fo":7100,"rt":7100,"rb":6101,"ed":"2019-04-18","ca":"2019-04-18 12:35:44","ua":"2019-04-22 19:50:44"},{"id":11,"st":1,"dt":39,"fo":7294,"rt":8100,"rb":7101,"ed":"2019-04-22","ca":"2019-04-22 10:29:28","ua":"2019-04-23 12:00:53"}]';
  7.     public FARMACIA_384: string = '[{"id":2,"st":3,"dt":39,"fo":1100,"rt":1100,"rb":101,"ed":"2019-03-08","ca":"2019-03-08 11:17:26","ua":"2019-03-22 16:23:41"},{"id":3,"st":3,"dt":39,"fo":3100,"rt":3100,"rb":2101,"ed":"2019-03-16","ca":"2019-03-18 12:02:45","ua":"2019-04-18 16:34:05"},{"id":4,"st":3,"dt":39,"fo":3100,"rt":3100,"rb":2101,"ed":"2019-03-16","ca":"2019-03-18 12:02:45","ua":"2019-04-04 12:10:36"},{"id":5,"st":2,"dt":39,"fo":4101,"rt":5100,"rb":4101,"ed":"2019-04-04","ca":"2019-04-04 13:24:56","ua":"2019-04-04 13:24:56"},{"id":6,"st":1,"dt":39,"fo":4785,"rt":5100,"rb":4101,"ed":"2019-04-04","ca":"2019-04-04 13:24:56","ua":"2019-04-30 13:43:48"}]';
  8.     public FARMACIA_387: string = '[{"id":2,"st":3,"dt":39,"fo":2100,"rt":2100,"rb":1101,"ed":"2019-03-08","ca":"2019-03-08 11:16:34","ua":"2019-03-30 14:27:39"},{"id":3,"st":1,"dt":39,"fo":3764,"rt":4100,"rb":3101,"ed":"2019-03-20","ca":"2019-04-01 11:53:12","ua":"2019-04-30 13:37:48"},{"id":4,"st":3,"dt":39,"fo":4100,"rt":4100,"rb":3101,"ed":"2019-03-20","ca":"2019-04-01 11:53:12","ua":"2019-04-18 14:56:05"},{"id":5,"st":2,"dt":39,"fo":7101,"rt":17100,"rb":7101,"ed":"2019-04-27","ca":"2019-04-30 13:49:49","ua":"2019-04-30 13:49:49"},{"id":6,"st":2,"dt":39,"fo":7101,"rt":17100,"rb":7101,"ed":"2019-04-27","ca":"2019-04-30 13:49:49","ua":"2019-04-30 13:49:49"}]';
  9.     public RUKA_432: string = '[{"id":1,"st":3,"dt":39,"fo":1100,"rt":1100,"rb":101,"ed":"2019-03-20","ca":"2019-03-20 11:54:57","ua":"2019-03-29 16:48:42"},{"id":2,"st":3,"dt":39,"fo":2100,"rt":2100,"rb":1101,"ed":"2019-03-30","ca":"2019-03-30 08:16:43","ua":"2019-04-08 11:14:34"},{"id":3,"st":1,"dt":39,"fo":2101,"rt":3100,"rb":2101,"ed":"2019-04-08","ca":"2019-04-08 18:44:47","ua":"2019-04-08 18:44:47"},{"id":4,"st":1,"dt":39,"fo":2191,"rt":3100,"rb":2101,"ed":"2019-04-08","ca":"2019-04-08 18:44:47","ua":"2019-04-30 12:49:04"},{"id":5,"st":3,"dt":39,"fo":3100,"rt":3100,"rb":2101,"ed":"2019-04-08","ca":"2019-04-08 18:44:47","ua":"2019-04-29 17:41:58"},{"id":6,"st":3,"dt":39,"fo":3100,"rt":3100,"rb":2101,"ed":"2019-04-08","ca":"2019-04-08 18:46:17","ua":"2019-04-18 12:50:19"},{"id":7,"st":2,"dt":39,"fo":3101,"rt":13100,"rb":3101,"ed":"2019-04-30","ca":"2019-04-30 12:56:13","ua":"2019-04-30 12:56:13"}]';
  10.  
  11.     constructor() {}
  12.  
  13.     public getCAFS(msg: string): ICAF[] {
  14.         let json = JSON.parse(msg);
  15.  
  16.         let cafs: ICAF[] = [];
  17.        
  18.         for (let i = 0; i < json.length; i++) {
  19.             let c = json[i];
  20.             cafs.push({
  21.                 id: Number(c.id),
  22.                 status: CAFStatus[CAFStatus[Number(c.st)]],
  23.                 dte_type: DTEType[DTEType[Number(c.dt)]],
  24.                 folio: Number(c.fo),
  25.                 range_top: Number(c.rt),
  26.                 range_bot: Number(c.rb),
  27.                 expiration_date: c.ed,
  28.                 created_at: c.ca,
  29.                 updated_at: c.ua,
  30.                 xml: '',
  31.                 private_key: ''
  32.             });
  33.         }
  34.  
  35.         return cafs;
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement