コード例 #1
0
        /// <summary>
        /// Sends reading command using ABECS in case of a magnetic stripe card.
        /// Unexpected behavior if amount is too large (over quadrillion).
        /// </summary>
        /// <param name="pinpadCommunication"></param>
        /// <param name="pan">Primary Account Number printed on the card.</param>
        /// <param name="amount">Transaction amount.</param>
        /// <returns>ABECS GPN command response.</returns>
        private GpnResponse SendGpn(IPinpadCommunication pinpadCommunication, string pan, decimal amount)
        {
            GpnRequest request = new GpnRequest();

            // Assembling GPN command.
            request.GPN_METHOD.Value = new CryptographyMethod(KeyManagementMode.DerivedUniqueKeyPerTransaction,
                                                              CryptographyMode.TripleDataEncryptionStandard);
            request.GPN_KEYIDX.Value = (int)StoneIndexCode.EncryptionKey;
            request.GPN_WKENC.Value  = new HexadecimalData("");
            request.GPN_PAN.Value    = pan;

            // Assembling GPN mandatory entries to GPN command.
            GpnPinEntryRequest pinEntry = new GpnPinEntryRequest();

            pinEntry.GPN_MIN.Value            = PinReader.PASSWORD_MINIMUM_LENGTH;
            pinEntry.GPN_MAX.Value            = PinReader.PASSWORD_MAXIMUM_LENGTH;
            pinEntry.GPN_MSG.Value.Padding    = DisplayPaddingType.Left;
            pinEntry.GPN_MSG.Value.FirstLine  = this.GetAmountLabel(amount);
            pinEntry.GPN_MSG.Value.SecondLine = PASSWORD_LABEL;

            // Adds the entry to list of entries supported by a GPN command.
            request.GPN_ENTRIES.Value.Add(pinEntry);

            GpnResponse response = pinpadCommunication.SendRequestAndReceiveResponse <GpnResponse>(request);

            return(response);
        }
コード例 #2
0
        // Used internally
        /// <summary>
        /// Sends reading command using ABECS when card have a chip.
        /// </summary>
        /// <param name="pinpadCommunication">Pinpad communication, through which the communication with the pinpad is made.</param>
        /// <param name="amount">Transaction amount.</param>
        /// <returns>ABECS GOC command response.</returns>
        private GocResponse SendGoc(IPinpadCommunication pinpadCommunication, decimal amount)
        {
            GocRequest request = new GocRequest();

            request.GOC_AMOUNT.Value   = Convert.ToInt64(amount * 100);
            request.GOC_CASHBACK.Value = 0;
            request.GOC_EXCLIST.Value  = false;
            request.GOC_CONNECT.Value  = true;
            request.GOC_METHOD.Value   = new CryptographyMethod(KeyManagementMode.DerivedUniqueKeyPerTransaction,
                                                                CryptographyMode.TripleDataEncryptionStandard);
            request.GOC_KEYIDX.Value   = (int)StoneIndexCode.EncryptionKey;
            request.GOC_WKENC.Value    = new HexadecimalData("00000000000000000000000000000000");
            request.GOC_RISKMAN.Value  = false;
            request.GOC_FLRLIMIT.Value = new HexadecimalData("00000000");
            request.GOC_TPBRS.Value    = 0;
            request.GOC_TVBRS.Value    = new HexadecimalData("00000000");
            request.GOC_MTPBRS.Value   = 0;
            request.GOC_TAGS1.Value    = new HexadecimalData(EmvTag.GetEmvTagsRequired());
            request.GOC_TAGS2.Value    = new HexadecimalData(string.Empty);

            GocResponse response = pinpadCommunication.SendRequestAndReceiveResponse <GocResponse>(request);

            return(response);
        }