• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 266
  • Last Modified:

Replace String with X's

This is the problem:
Normally on a receipt given back to a customer you want the first 12 numbers of the CC to read X's and only allow the last 4 digits to appear on the receipt.
I have a textbox named txtlog. It holds information passed back to it from a third party DLL for a credit card payment gateway. The CC is Dim CC as string, although the data is credit card numbers.

The sub reads:
Private Sub mnuPurchase_Click()
    LogStartFunction ("XCharge")
    If (XCTran.PromptCreditCardEntry(ccTransact.hwnd, "Credit Card Purchase Information", False, _
                False, False, Swipe, Track1, Track2, CC, CCTypeName, ExpirationMonth, _
                ExpirationYear, CardHolderName, ZIP, Address, CVV)) Then
               
      If (XCTran.XCPurchase(ccTransact.hwnd, txtTranFolder.Text, "Purchase", _
                chkShowStatus.Value, chkShowResult.Value, txtClerk.Text, txtRcpt.Text, CC, _
                ExpirationYear + ExpirationMonth, Swipe, txtAmt.Text, ZIP, _
                Address, CVV, ErrorMsg, ApprovalCode, AVSResult, CVVResult)) Then
            LogText ("ApprovalCode = " + ApprovalCode)
            LogText ("CC = " + CCTypeName)
            LogText ("CC = " + CC)
            LogText ("TicketID= " + txtRcpt.Text)
            LogText ("Purchase Amount= " + txtAmt.Text)
       Else
           LogText ("XCPurchase Unsuccessfull - " + ErrorMsg)
       End If
    Else
       LogText ("PromptCreditCardEntry Unsuccessfull")
   End If
    end sub
----------------------------------
When the result of the CC purchase is successfull, the txtlog.text shows the results .

The LogText ("CC= " +CC) shows the full CC number when I print out the  printer command
Printer.Print "CCReceipt"; txtLog.Text since it prints out the txtlog.text which shows the full CC number.
What can I do so that the first 12 digits of the CC number will appear as X's?

Can anyone help me?
0
mindserve
Asked:
mindserve
  • 2
1 Solution
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
Printer.Print "XXXX-XXXX-XXXX-" & Right(Trim(txtlog.text), 4)
0
 
JR2003Commented:
Dim sTmp as string
sTmp = txtLog.Text
Mid(sTmp , 1, 12) = "XXXXXXXXXX"
Printer.Print sTmp
0
 
mindserveAuthor Commented:
Maybe this will look clearer:
This is what prints out. It is all in the txtlog.text after the user completes a CC transaction.

ApprovalCode=00089
CC=MasterCard
CC=5499990123456781 ( this is not a valid CC number)
TicketID=11677
Purchase Amount=8.00


The CC is printed from the:
LogText ("CC = " + CC)
In the Sub MnuPurchase.
So this is what prints out. All of it....
All I need to do is to get the Crecit card numbers to print out only 12 X's and then the last 4 digits.
Should this be in the print command or go back to the source which is the Sub mnupurchase where it originated?
The second code produced just X's.

0
 
JR2003Commented:
Instead of the line:
LogText ("CC = " + CC)
 
Have these lines:
Dim sTmp as string
sTmp = CC
Mid(sTmp , 1, 12) = "XXXXXXXXXX"
LogText ("CC = " + sTmp )

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now