0

I am using WCF service from this link:

http://www.paymentsgateway.com/developerDocumentation/Integration/webservices/merchantservice.aspx#authentication

Now here if you scroll down this link they have given an eg of how to create a client:

    private void CreateClient(int mid)
{
    ClientRecord client = new ClientRecord();
    client.MerchantID = MerchantID;
    client.FirstName = "Bob";
    client.LastName = "Smith";
    //other code describing client omitted

    try
    {
        using (ClientServiceClient proxy = new ClientServiceClient())
        {
            int id = proxy.createClient(Authenticate.GetClientAuthTicket(txtID.Text.Trim(), txtKey.Text.Trim()), client);
            Response.Write("Created Client ID = " + id.ToString());
        }
    }
    catch (Exception e)
    {
      Response.Write(e.Message);
    }
}

Now I dont understand what is this: ClientServiceClient??? I created the implementation like this:

 public static PaymentsGatewayTest.Authentication GetClientAuthTicket (string APILogin, string key)
    {
        PaymentsGatewayTest.Authentication ticket = new PaymentsGatewayTest.Authentication();
        ticket.APILoginID = APILogin;
        ticket.UTCTime = DateTime.UtcNow.Ticks.ToString();
        ticket.TSHash = GenerateTSHash(ticket.APILoginID + "|" + ticket.UTCTime, key.Trim());
        return ticket;
    }

         private void CreateClient(int mid)
    {
        ClientRecord client = new ClientRecord();
        client.MerchantID = 11245;
        client.FirstName = "Bob";
        client.LastName = "Smith";
        //other code describing client omitted

        try
        {
            using (PaymentsAuthClient proxy = new PaymentsAuthClient())
            {

                int id = proxy.createClient(Authenticate.GetClientAuthTicket("", "", client));
                //Response.Write("Created Client ID = " + id.ToString());
            }
        }
        catch (Exception e)
        {
            //Response.Write(e.Message);
        }
    }

I have create a Singleton class called PaymentsAuthClient, but this does not seems to work. What I am doing wrong here???

Thank you for your help in adv :)

1
  • "but this does not seems to work" & what happens? Commented May 17, 2011 at 3:26

1 Answer 1

2

If you follow the links to the sample source:

http://www.paymentsgateway.com/community/codeSamples/singlepostpage/10-05-05/C_Web_Service_Code_Sample.aspx

You'll see that they have a Service Reference to the client web service, and the ClientServiceClient is autogenerated by Visual studio from the reference.

Their example is a service reference to :

https://sandbox.paymentsgateway.net/WS/Client.svc

If you look in the reference.cs file in the ServiceTestClient\Service References\ClientService folder, you'll see that that the client is called:

.....yournamespace.....ClientService.ClientServiceClient

the service name is the namespace so I think you probably need:

 .....yournamespace.....PaymentsAuthClient.ClientServiceClient
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Preet, I also created the same way. My service reference name is: PaymentsAuthClient. So what I am missing here?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.