/* ------------------------------------------------------------------ */
/* This information contained within this file is the intellectual    */
/* property of:                                                       */
/*                                                                    */
/* At Your Fingertips Informational Systems, Inc.                     */
/* 23325 Haynes                                                       */
/* Farmington Hills, MI 48336                                         */
/* (810) 471-1585                                                     */
/*                                                                    */
/* (C) Copyright 1994, At Your Fingertips Informational Systems, Inc. */
/* All rights reserved.                                               */
/* ------------------------------------------------------------------ */


/* ------------------------------------------------------------------ */
/* Define the Transaction Types                                       */
/* ------------------------------------------------------------------ */
#define APPROVAL               1
#define INCREMENTAL            2
#define PARTIALREVERSAL        3
#define SALE                   5
#define CREDIT                 6
#define TEST                   7
#define CHECKAPPROVAL          8
#define SETTLEMENT             9

/* ------------------------------------------------------------------ */
/* Define the Credit Card Validation Structure                        */
/* ------------------------------------------------------------------ */
typedef  struct CCVUSER
{
    SHORT TransactionType;             /* 1 - Approval                              */
                                       /* 2 - Incremental Request                   */
                                       /* 3 - Partial Reversal                      */
                                       /* 4 - Reserved                              */
                                       /* 5 - Sale                                  */
                                       /* 6 - Credit                                */
                                       /* 7 - Test                                  */
                                       /* 8 - Check Approval                        */
                                       /* 9 - Settlement                            */

    union CreditCard                   /* Transaction types 1-6                        */
    {
        CHAR   *CardInfo;              /* Pointer to Card Number, Field Separator, and
                                                        exp date  OR  Stripe Data */
        CHAR   TransactionDate[4];     /* MMDD / '0000' for Todays Date           */
        CHAR   InvoiceNumber[10];      /* User-reference field */
        double TipAmount[7];           /* Subset of Amount identified as gratuity */
        double Amount[7];              /* Total final transaction amount, including
                                          tip, if any. */
        BYTE   CustomerPresentFlag;    /* '0' - Customer persent */
                                       /* '1' - Customer not present  */
        BYTE   TerminalCapability;     /* '0' - POS system has magstripe
                                        reader/equipment */
                                       /* '3' - POS system has no magstripe
                                          reader/equipment */
        /* -------------------- Responses -------------------------- */
        CHAR HostErrorCode[2];        /* '00'                                      */
        CHAR ResponseCode[2];         /* 'AA' - Approved                           */
                                      /* 'ND' - Declined                           */
                                      /* 'NR' - Referred (Call Voice Center)       */
        CHAR AuthorizationCode[6];    /* Present only with 'AA' response           */
    } CreditCard;



    union CheckApprovalRequest         /* Transaction type '8'                       */
    {
        CHAR   IDType[2];              /* '00'-'99' verified valid per Check
                                          ID Table                                   */
        CHAR   Number[24];             /* Left justified, spaced filled; no
                                          imbedded spaces or symbols NOTE:
                                          should this data reach a length greater
                                          than 19 digits, any submitted Check
                                          Sequence Number will be ignored.           */
        CHAR   DateofBirth[6];         /* '000000' or 'MMDDYY'                       */
        double Amount[7];
        CHAR   CheckSequenceNum[4];    /* nnnn', as found on check. ('0000' is
                                          valid, and will be treated as if no
                                          sequence number was submitted.  */
        /* -------------------- Responses ----------------------------- */
        CHAR HostErrorCode[2];       /* '00' means no error             */
        CHAR Response[24];           /* Host generated response text    */
    } CheckApprovalRequest;


    struct ExtendedData
    {
        SHORT ExtendedCode;           /* 0  No extended data
                                         4  (Lodging Data)
                                         6  (Auto Rental)
                                         1  (Fleet Data)
                                        12  (Address Verification)          */

        union Lodging
        {
            BYTE PrimaryChargeType;       /* '1' = Lodging                  */
                                          /* '2' = Restaurant               */
                                          /* '3' = Gift Shop                */
            CHAR CheckInDate[6];          /* MMDDYY (zeroes if not Primary Charge Type 1) */
            CHAR CheckOutDate[6];         /* MMDDYY (zeroes if not Primary Charge Type 1) */
            BYTE SpecialProgramCode;      /* '1'=No Special Code */
                                          /* '2'=Assured Reservation/No Show */
                                          /* '3'=Advance Deposit */
                                          /* '4'=Delayed Charge */
                                          /* '5'=Express Check Out Service */
                                          /* '6'=Assured Reservation/Normal */
                                          /* '0'=Not Primary Charge Type 1 */
            CHAR ExtraChargeCode[5];      /* Up to 6 1-digit codes, each a partial or
                                             complete explanation of why charged amount
                                             differs from receipt cardholder received
                                             at checkout:
                                             '0'-No extra/Filler
                                             '2'-Restaurant
                                             '3'-Gift Shop
                                             '4'-MiniBar
                                             '5'-Telephone
                                             '7'-Laundry
                                             '6'-Other Reasons */
        } Lodging;


        union AutoRental
        {
            CHAR RentalAgreementNum[9];   /* Contract invoice reference */
            CHAR AuditAdjustment[7];      /* Charges added after check in */
            CHAR RentalCity[18];          /* Where car was picked up */
            CHAR RentalState[2];          /* Where car was picked up */
            CHAR RentalDate[6];           /* YYMMDD when car was picked up */
            CHAR RentalTime[4];           /* HHMM when car was picked up */
            CHAR ReturnCity[18];          /* Where car was checked in */
            CHAR ReturnState[2];          /* Where car was checked in */
            CHAR ReturnDate[6];           /* YYMMDD when car was checked in */
            CHAR ReturnTime[4];           /* HHMM when car was checked in */
            CHAR RenterName[20];          /* As typically written (first name first) */
            BYTE NoShowIndicator;         /* '2'-No Show Charge */
                                          /* '0'-Normal Charge */
            CHAR ExtraChargeCode[5];      /* Up to 6 1 digit codes, each a partial or
                                             complete explanation of why charged
                                             amount differs from receipt cardholder
                                             received at time of rental return:
                                             '0'-Filler/No Extras
                                             '1'-Refueling
                                             '2'-Extra Mileage
                                             '3'-Late Return
                                             '4'-One Way Fee */
        } AutoRental;


        union Fleet
        {
            CHAR   VehicleNumber[5];
            CHAR   DriverID[6];            /* Left-justified, fill with '>' (Hex 3E,
                                              Decimal 62) '000000' if not available
                                              E.g.:  '123456' or
                                                     '1234>>' */
            CHAR   OdometerReading[6];
            CHAR   ProductCode1[2];        /* 01-11,21,26,30,40           */
            CHAR   ProductCode2[2];        /* 21,26,30,40                 */
            CHAR   ProductCode3[2];        /* 21,26,30,40                 */
            double TotalAmount1;
            double TotalAmount2;
            double TotalAmount3;
            double UnitPrice;              /* Right-justified, zero-filled. Three
                                              assumed decimal places.
                                              nnnnn (if fuel product)
                                              00000 (if non fuel) */
            BYTE   ServiceType;            /* '0'-No fuel service
                                              '1'-Self service
                                              '2'-Full service */
            double SalesTax;
            CHAR   ReferenceNumber[5];     /* Job code */
        } Fleet;


        union AddressVerification
        {
            CHAR ZipCode[9];             /* Left-justified, space-filled. */
            CHAR StreetAddress[20];      /* Left-justified, space-filled. */
            /* -------------------- Responses --------------------------- */
            BYTE AddressMatch;           /* 'Y'-Match */
                                         /* 'N'-No Match */
                                         /* 'X' or ' ' -Service Unavailable/Not Applicable */
            BYTE ZIPCodeMatch;           /* 'Y'-Match */
                                         /* 'N'-No Match */
                                         /* 'X' or ' ' -Service Unavailable/Not Applicable */
        } AddressVerification;
    } ExtendedData;
} CCVUSER;

typedef CCVUSER *PCCVUSER;
