Esempio n. 1
0
        internal CreditResponse DoCredit(string txnType, AmountRequest amounts, AccountRequest accounts, TraceRequest trace, AvsRequest avs, CashierSubGroup cashier, CommercialRequest commercial, EcomSubGroup ecom, ExtDataSubGroup extData)
        {
            var response = DoTransaction(PAX_MSG_ID.T00_DO_CREDIT, txnType, amounts, accounts, trace, avs, cashier, commercial, ecom, extData);

            return(new CreditResponse(response));
        }
Esempio n. 2
0
        internal override TerminalResponse ProcessTransaction(TerminalAuthBuilder builder)
        {
            // create sub groups
            var amounts = new AmountRequest();
            var account = new AccountRequest();
            var avs     = new AvsRequest();
            var trace   = new TraceRequest {
                ReferenceNumber = builder.ReferenceNumber.ToString()
            };
            var cashier    = new CashierSubGroup();
            var commercial = new CommercialRequest();
            var ecom       = new EcomSubGroup();
            var extData    = new ExtDataSubGroup();

            // amounts sub group
            amounts.TransactionAmount = "{0:c}".FormatWith(builder.Amount).ToNumeric();
            amounts.CashBackAmount    = "{0:c}".FormatWith(builder.CashBackAmount).ToNumeric();
            amounts.TipAmount         = "{0:c}".FormatWith(builder.Gratuity).ToNumeric();
            amounts.TaxAmount         = "{0:c}".FormatWith(builder.TaxAmount).ToNumeric();

            // account sub group
            if (builder.PaymentMethod != null)
            {
                if (builder.PaymentMethod is CreditCardData)
                {
                    var card = builder.PaymentMethod as CreditCardData;
                    if (string.IsNullOrEmpty(card.Token))
                    {
                        account.AccountNumber = card.Number;
                        account.EXPD          = "{0}{1}".FormatWith(card.ExpMonth, card.ExpYear);
                        if (builder.TransactionType != TransactionType.Verify && builder.TransactionType != TransactionType.Refund)
                        {
                            account.CvvCode = card.Cvn;
                        }
                    }
                    else
                    {
                        extData[EXT_DATA.TOKEN] = card.Token;
                    }
                }
                else if (builder.PaymentMethod is TransactionReference)
                {
                    var reference = builder.PaymentMethod as TransactionReference;
                    if (!string.IsNullOrEmpty(reference.AuthCode))
                    {
                        trace.AuthCode = reference.AuthCode;
                    }
                    if (!string.IsNullOrEmpty(reference.TransactionId))
                    {
                        extData[EXT_DATA.HOST_REFERENCE_NUMBER] = reference.TransactionId;
                    }
                }
                else if (builder.PaymentMethod is GiftCard)
                {
                    var card = builder.PaymentMethod as GiftCard;
                    account.AccountNumber = card.Number;
                }
                else if (builder.PaymentMethod is EBTCardData)
                {
                    var card = builder.PaymentMethod as EBTCardData;
                }
            }
            if (builder.AllowDuplicates)
            {
                account.DupOverrideFlag = "1";
            }

            // Avs Sub Group
            if (builder.Address != null)
            {
                avs.ZipCode = builder.Address.PostalCode;
                avs.Address = builder.Address.StreetAddress1;
            }

            // Trace Sub Group
            trace.InvoiceNumber = builder.InvoiceNumber;

            // Commercial Group
            commercial.CustomerCode = builder.CustomerCode;
            commercial.PoNumber     = builder.PoNumber;
            commercial.TaxExempt    = builder.TaxExempt;
            commercial.TaxExemptId  = builder.TaxExemptId;

            // Additional Info sub group
            if (builder.RequestMultiUseToken)
            {
                extData[EXT_DATA.TOKEN_REQUEST] = "1";
            }

            if (builder.SignatureCapture)
            {
                extData[EXT_DATA.SIGNATURE_CAPTURE] = "1";
            }

            string transType = MapTransactionType(builder.TransactionType, builder.RequestMultiUseToken);

            switch (builder.PaymentMethodType)
            {
            case PaymentMethodType.Credit:
                return(DoCredit(transType, amounts, account, trace, avs, cashier, commercial, ecom, extData));

            case PaymentMethodType.Debit:
                return(DoDebit(transType, amounts, account, trace, cashier, extData));

            case PaymentMethodType.Gift:
                var messageId = builder.Currency == CurrencyType.CURRENCY ? PAX_MSG_ID.T06_DO_GIFT : PAX_MSG_ID.T08_DO_LOYALTY;
                return(DoGift(messageId, transType, amounts, account, trace, cashier, extData));

            case PaymentMethodType.EBT:
                if (builder.Currency != null)
                {
                    account.EbtType = builder.Currency.ToString().Substring(0, 1);
                }
                return(DoEBT(transType, amounts, account, trace, cashier));

            default:
                throw new UnsupportedTransactionException();
            }
        }
Esempio n. 3
0
 internal IDeviceMessage BuildCredit(string txnType, AmountRequest amounts, AccountRequest accounts, TraceRequest trace, AvsRequest avs, CashierSubGroup cashier, CommercialRequest commercial, EcomSubGroup ecom, ExtDataSubGroup extData)
 {
     return(BuildRequest(PAX_MSG_ID.T00_DO_CREDIT, txnType, amounts, accounts, trace, avs, cashier, commercial, ecom, extData));
 }