Advertisement
Kikku80

Untitled

Aug 14th, 2019
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 8.20 KB | None | 0 0
  1. using EMS.Processor.Processor.Data;
  2. using EMS.Processor.Database;
  3. using MongoDB.Bson.Serialization.Attributes;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.ComponentModel;
  7. using EMS.Processor.RPC.Data;
  8.  
  9. namespace EMS.Processor.IDatabase
  10. {
  11.     public interface ITransaction
  12.     {
  13.         /// <summary>
  14.         /// Acquirer Reference Number. This uniquely identifies a transaction
  15.         /// Transaction Id
  16.         /// </summary>
  17.         string TransactionId { get; set; }
  18.  
  19.         string ProcessorClusterId { get; set; }
  20.  
  21.         string ARN { get; }
  22.  
  23.         string RRN { get; set; }
  24.  
  25.         string ParentTransactionId { get; set; }
  26.  
  27.         string InvoiceNumber { get; set; }
  28.  
  29.         uint? BatchNumber { get; set; }
  30.  
  31.         MessageTransactionType TransactionType { get; set; }
  32.  
  33.         string STAN { get; set; }
  34.  
  35.         TransactionSourceType SourceType { get; set; }
  36.  
  37.         string Source { get; set; }
  38.  
  39.         EcommerceRequest EcommerceRequest { get; set; }
  40.  
  41.         PreAuthInfo PreAuthInfo { get; set; }
  42.  
  43.         long Amount { get; set; }
  44.  
  45.         ushort CurrencyCode { get; set; }
  46.  
  47.         DateTime TransactionDateTime { get; set; }
  48.  
  49.         TransactionVendorOptions Vendor { get; set; }
  50.  
  51.         Cardholder Cardholder { get; set; }
  52.  
  53.         TransactionLifeCycle LifeCycle { get; set; }
  54.  
  55.         TransactionStatus Status { get; set; }
  56.  
  57.         List<StatusUpdate> StatusHistory { get; set; }
  58.        
  59.         BinaryISOResponse ISOBinaryResponse { get; set; }
  60.  
  61.         CardSchemeMessageProperties CardSchemeRequestMessage { get; set; }
  62.  
  63.         string AuthorizationPlatformId { get; set; }
  64.  
  65.         string AuthorizationIdentificationResponse { get; set; }
  66.  
  67.         bool isPendingClearing { get; }
  68.  
  69.         string ExceptionMessage { get; set; }
  70.  
  71.         List<string> PartialReversals { get; set; }
  72.  
  73.         PINEntryType PINType { get; set; }
  74.  
  75.         /// <summary>
  76.         /// Indicates which key from HSM is used to encrypt transaction data
  77.         /// </summary>
  78.         string DatabaseEncryptionKey { get; set; }
  79.  
  80.         DCCRequest DCC { get; set; }
  81.     }
  82.  
  83.     /*  TRANSACTION LIFECYCLE - STATUS EXPLAINED
  84.      *  
  85.      *  AuthorizationMessage:
  86.      *                      - NotApproved
  87.      *                      - POSPendingSettlement
  88.      *                      - PendingPostAuthorization
  89.      *                      - Captured
  90.      *                      - Reversed
  91.      *                      
  92.      *  FirstPresentment:
  93.      *                      - ProcessForClearing
  94.      *                      - SubmittedForClearing
  95.      *                      - Captured
  96.      *                      - Chargeback
  97.      *                      - FileRetrieval
  98.      *                      - ChargebackAccepted
  99.      *                      
  100.      *  SecondPresentment:
  101.      *                      - ProcessForClearing
  102.      *                      - SubmittedForClearing
  103.      *                      - Captured
  104.      *                      - ArbitrationChargeback
  105.      *                      
  106.      */
  107.  
  108.     [Flags]
  109.     public enum TransactionLifeCycle : int
  110.     {
  111.         [Description("Transaction at initial stage, auth message before going for clearing")]
  112.         AuthorizationMessage = 1,
  113.  
  114.         [Description("First presentment lifecycle state")]
  115.         FirstPresentment = 2,
  116.  
  117.         [Description("Second presentment lifecycle state")]
  118.         SecondPresentment = 4,
  119.        
  120.         [Description("Transaction failed, due to an exception")]
  121.         Exception = 8
  122.                
  123.     }
  124.  
  125.     [Flags]
  126.     public enum TransactionStatus : int
  127.     {
  128.         [Description("Transaction was not approved, transaction rejected by auth response")]
  129.         NotApproved = 1,
  130.  
  131.         [Description("Transaction is still pending waiting to be settled and then go for clearing. This status is only valid for POS transaction")]
  132.         POSPendingSettlement = 2,
  133.  
  134.         [Description("Pre-authorization is pending post-authorization to be marked for clearing")]
  135.         PendingPostAuthorization = 4,
  136.  
  137.         [Description("Transaction captured, cleared")]
  138.         Captured = 8,
  139.  
  140.         [Description("Transaction reversed, void")]
  141.         Reversed = 16,
  142.  
  143.         [Description("Transaction can be processed for clearing")]
  144.         ProcessForClearing = 32,
  145.  
  146.         [Description("Submitted for clearing")]
  147.         SubmittedForClearing = 64,
  148.  
  149.         [Description("Transaction earmarked as charge back")]
  150.         Chargeback = 128,
  151.  
  152.         [Description("Chargeback accepted by merchant")]
  153.         ChargebackAccepted = 256,
  154.        
  155.         [Description("Transaction decided by arbitration by authorization platform in favor of cardholder")]
  156.         Arbitration = 512,
  157.  
  158.         [Description("File retrieval requested before issuing a chargeback")]
  159.         FileRetrieval = 1024,
  160.  
  161.         [Description("MasterCard Advice message for Post auth was not approved")]
  162.         PostAuthNotApproved = 2048,
  163.        
  164.         [Description("Transaction processing failed during Clearing cycle")]
  165.         FailedDuringClearing = 4096,
  166.        
  167.         [Description("Transaction has been set as Represented")]
  168.         ChargebackRepresented = 8192
  169.     }
  170.  
  171.     public class BinaryISOResponse
  172.     {
  173.         [BsonIgnoreIfNull]
  174.         public byte[] binaryMessage { get; set; }
  175.  
  176.         [BsonIgnoreIfDefault]
  177.         public string ResponseCode { get; set; }
  178.  
  179.     }
  180.  
  181.     public class StatusUpdate
  182.     {
  183.         [BsonIgnoreIfNull]
  184.         public TransactionStatus? Status { get; set; }
  185.  
  186.         [BsonIgnoreIfNull]
  187.         public TransactionLifeCycle? LifeCycle { get; set; }
  188.  
  189.         public DateTime When { get; set; }
  190.     }
  191.  
  192.     public class CardSchemeMessageProperties
  193.     {
  194.         [BsonIgnoreIfNull]
  195.         public AdditionalPOSInformation AdditionalPosInformation { get; set; }
  196.  
  197.         [BsonIgnoreIfNull]
  198.         public Processor.Data.POSEntryMode POSEntryMode { get; set; }
  199.  
  200.         [BsonIgnoreIfNull]
  201.         public POSData POSData { get; set; }
  202.        
  203.         [BsonIgnoreIfNull]
  204.         public POSDataCode POSDataCode { get; set; }
  205.  
  206.         [BsonIgnoreIfDefault]
  207.         public string POSPINCaptureCode { get; set; }
  208.  
  209.         public ProcessingCode ProcessingCode { get; set; }
  210.     }
  211.  
  212.     public class InvalidTransactionException : Exception
  213.     {
  214.         public InvalidTransactionException(string message)
  215.             : base(message)
  216.         {
  217.  
  218.         }
  219.  
  220.  
  221.     }
  222.  
  223.     public class InvalidParentSaleTransactionException : InvalidTransactionException
  224.     {
  225.         public InvalidParentSaleTransactionException(string message) : base (message)
  226.         {
  227.  
  228.         }
  229.     }
  230.  
  231.     public class POSParentAlreadyCapturedException : InvalidTransactionException
  232.     {
  233.         public POSParentAlreadyCapturedException(string message)
  234.             : base(message)
  235.         {
  236.  
  237.         }
  238.     }
  239.     public class CreditParentTransactionNotCapturedException : InvalidTransactionException
  240.     {
  241.         public CreditParentTransactionNotCapturedException(string message)
  242.             : base(message)
  243.         {
  244.  
  245.         }
  246.     }
  247.  
  248.     public class PartialCreditParentTransactionNotCapturedException : CreditParentTransactionNotCapturedException
  249.     {
  250.         public PartialCreditParentTransactionNotCapturedException(string message) : base(message)
  251.         {
  252.  
  253.         }
  254.     }
  255.  
  256.     public class InvalidFetchTransactionException : InvalidTransactionException
  257.     {
  258.         public InvalidFetchTransactionException(string message, string transactionId)
  259.             : base(message)
  260.         {
  261.             TransactionId = transactionId;
  262.         }
  263.  
  264.         public InvalidFetchTransactionException(string message) : base(message)
  265.         {
  266.             TransactionId = string.Empty;
  267.         }
  268.         public string TransactionId { get; set; }
  269.     }
  270.  
  271.     public class PreAuthInfo
  272.     {
  273.         public bool isPreAuthPosted { get; set; }
  274.  
  275.         public long originalPreAuthAmount { get; set; }
  276.  
  277.         public DateTime TransactionDateTime { get; set; }
  278.     }
  279.  
  280.     /// <summary>
  281.     /// Inicates type of PIN whether Online, Offline or not available
  282.     /// </summary>
  283.     public enum PINEntryType
  284.     {
  285.         NotAvailable = 0, Online = 1, Offline = 2
  286.     }
  287. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement