Beispiel #1
0
            ///<summary>Builds the receipt string for a web service transaction.
            ///This method assumes ccExpYear is a 4 digit integer.</summary>
            public void BuildReceiptString(string ccNum, int ccExpMonth, int ccExpYear, string nameOnCard, long clinicNum, bool wasSwiped = false)
            {
                string result = "";
                int    xleft  = 0;
                int    xright = 15;

                result += Environment.NewLine;
                result += CreditCardUtils.AddClinicToReceipt(clinicNum);
                //Print body
                result += "Date".PadRight(xright - xleft, '.') + DateTime.Now.ToString() + Environment.NewLine;
                result += Environment.NewLine;
                result += "Trans Type".PadRight(xright - xleft, '.') + this.TransType.ToString() + Environment.NewLine;
                result += Environment.NewLine;
                result += "Transaction #".PadRight(xright - xleft, '.') + this.RefNumber + Environment.NewLine;
                if (!string.IsNullOrWhiteSpace(nameOnCard))
                {
                    result += "Name".PadRight(xright - xleft, '.') + nameOnCard + Environment.NewLine;
                }
                result += "Account".PadRight(xright - xleft, '.');
                for (int i = 0; i < ccNum.Length - 4; i++)
                {
                    result += "*";
                }
                if (!string.IsNullOrWhiteSpace(ccNum))
                {
                    result += ccNum.Substring(ccNum.Length - 4) + Environment.NewLine;              //last 4 digits of card number only.
                }
                if (ccExpMonth >= 0 && ccExpYear >= 0)
                {
                    result += "Exp Date".PadRight(xright - xleft, '.') + ccExpMonth.ToString().PadLeft(2, '0') + (ccExpYear % 100) + Environment.NewLine;
                }
                result += "Entry".PadRight(xright - xleft, '.') + (wasSwiped ? "Swiped" : "Manual") + Environment.NewLine;
                result += "Auth Code".PadRight(xright - xleft, '.') + this.AuthCode + Environment.NewLine;
                result += "Result".PadRight(xright - xleft, '.') + this.Status + Environment.NewLine;
                result += Environment.NewLine + Environment.NewLine + Environment.NewLine;
                if (this.TransType.In(PaySimple.TransType.RETURN, PaySimple.TransType.VOID))
                {
                    result += "Total Amt".PadRight(xright - xleft, '.') + (this.Amount * -1) + Environment.NewLine;
                }
                else
                {
                    result += "Total Amt".PadRight(xright - xleft, '.') + this.Amount + Environment.NewLine;
                }
                if (this.TransType == TransType.SALE)
                {
                    result += Environment.NewLine + Environment.NewLine + Environment.NewLine;
                    result += "I agree to pay the above total amount according to my card issuer/bank agreement.";
                }
                this.TransactionReceipt = result;
            }
Beispiel #2
0
        public static string BuildReceiptString(PayConnectService.transType transType, string refNum, string nameOnCard, string cardNumber,
                                                string magData, string authCode, string statusDescription, List <string> messages, decimal amount, int sigResponseStatusCode, long clinicNum)
        {
            string result = "";

            cardNumber = cardNumber ?? "";         //Prevents null reference exceptions when PayConnectPortal transactions don't have an associated card number
            int xmin   = 0;
            int xleft  = xmin;
            int xright = 15;
            int xmax   = 37;

            result += Environment.NewLine;
            result += CreditCardUtils.AddClinicToReceipt(clinicNum);
            //Print body
            result += "Date".PadRight(xright - xleft, '.') + DateTime.Now.ToString() + Environment.NewLine;
            result += Environment.NewLine;
            result += "Trans Type".PadRight(xright - xleft, '.') + transType + Environment.NewLine;
            result += Environment.NewLine;
            result += "Transaction #".PadRight(xright - xleft, '.') + refNum + Environment.NewLine;
            result += "Name".PadRight(xright - xleft, '.') + nameOnCard + Environment.NewLine;
            result += "Account".PadRight(xright - xleft, '.');
            for (int i = 0; i < cardNumber.Length - 4; i++)
            {
                result += "*";
            }
            if (cardNumber.Length >= 4)
            {
                result += cardNumber.Substring(cardNumber.Length - 4) + Environment.NewLine;          //last 4 digits of card number only.
            }
            result += "Card Type".PadRight(xright - xleft, '.') + CreditCardUtils.GetCardType(cardNumber) + Environment.NewLine;
            result += "Entry".PadRight(xright - xleft, '.') + (String.IsNullOrEmpty(magData) ? "Manual" : "Swiped") + Environment.NewLine;
            result += "Auth Code".PadRight(xright - xleft, '.') + authCode + Environment.NewLine;
            result += "Result".PadRight(xright - xleft, '.') + statusDescription + Environment.NewLine;
            if (messages != null)
            {
                string label = "Message";
                foreach (string m in messages)
                {
                    result += label.PadRight(xright - xleft, '.') + m + Environment.NewLine;
                    label   = "";
                }
            }
            result += Environment.NewLine + Environment.NewLine + Environment.NewLine;
            if (transType.In(PayConnectService.transType.RETURN, PayConnectService.transType.VOID))
            {
                result += "Total Amt".PadRight(xright - xleft, '.') + (amount * -1) + Environment.NewLine;
            }
            else
            {
                result += "Total Amt".PadRight(xright - xleft, '.') + amount + Environment.NewLine;
            }
            result += Environment.NewLine + Environment.NewLine + Environment.NewLine;
            result += "I agree to pay the above total amount according to my card issuer/bank agreement." + Environment.NewLine;
            result += Environment.NewLine + Environment.NewLine + Environment.NewLine + Environment.NewLine + Environment.NewLine;
            if (sigResponseStatusCode != 0)
            {
                result += "Signature X".PadRight(xmax - xleft, '_');
            }
            else
            {
                result += "Electronically signed";
            }
            return(result);
        }