Пример #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));
        }
Пример #2
0
        public override CreditResponse Execute()
        {
            base.Execute();

            var amounts = new AmountRequest {
                TransactionAmount = "{0:c}".FormatWith(amount).ToNumeric(),
                TipAmount         = "{0:c}".FormatWith(gratuity).ToNumeric()
            };

            var account = new AccountRequest();

            if (card != null)
            {
                account.AccountNumber = card.Number;
                account.EXPD          = "{0}{1}".FormatWith(card.ExpMonth, card.ExpYear);
                account.CvvCode       = card.Cvv;
            }
            if (allowDuplicates)
            {
                account.DupOverrideFlag = "1";
            }

            // Avs Sub Group
            var avs = new AvsRequest();

            if (address != null)
            {
                avs.ZipCode = address.Zip;
                avs.Address = address.Address;
            }

            // Trace Sub Group
            var trace = new TraceRequest {
                ReferenceNumber = referenceNumber.ToString()
            };

            if (details != null)
            {
                trace.InvoiceNumber = details.InvoiceNumber;
            }
            if (!string.IsNullOrEmpty(authCode))
            {
                trace.AuthCode = authCode;
            }


            var cashier    = new CashierSubGroup();
            var commercial = new CommercialRequest();
            var ecom       = new EcomSubGroup();

            // Additional Info sub group
            var additionalInfo = new ExtDataSubGroup();

            if (requestMultiUseToken)
            {
                additionalInfo[EXT_DATA.TOKEN_REQUEST] = "1";
            }
            if (transactionId.HasValue)
            {
                additionalInfo[EXT_DATA.HOST_REFERENCE_NUMBER] = transactionId.Value.ToString();
            }
            if (token != null)
            {
                additionalInfo[EXT_DATA.TOKEN] = token;
            }
            if (signatureCapture)
            {
                additionalInfo[EXT_DATA.SIGNATURE_CAPTURE] = "1";
            }

            return(service.DoCredit(PAX_TXN_TYPE.AUTH, amounts, account, trace, avs, cashier, commercial, ecom, additionalInfo));
        }