コード例 #1
0
        public ANetApiResponse TestGetAcceptCustomerProfilePage()
        {
            var response        = (createCustomerProfileResponse)CreateCustomerProfile.Run(apiLoginId, transactionKey, GetEmail());
            var profileResponse = GetAcceptCustomerProfilePage.Run(apiLoginId, transactionKey, response.customerProfileId);

            DeleteCustomerProfile.Run(apiLoginId, transactionKey, response.customerProfileId);

            return(profileResponse);
        }
コード例 #2
0
        public ActionResult <AcceptResponse> AcceptCustomer(string apiLoginId, string apiTransactionKey, string customerId, string iFrameCommunicatorUrl)
        {
            AcceptResponse objAcceptResponse = new AcceptResponse();

            try
            {
                ProxyMethod();

                // generates a token by calling the sample code API
                ANetApiResponse response = GetAcceptCustomerProfilePage.Run(apiLoginId, apiTransactionKey, customerId, iFrameCommunicatorUrl);


                if (response != null)
                {
                    if (response.messages.resultCode.ToString().ToLower() == "ok")
                    {
                        objAcceptResponse.status       = true;
                        objAcceptResponse.successValue = ((getHostedProfilePageResponse)response).token;
                    }
                    else
                    {
                        objAcceptResponse.status       = false;
                        objAcceptResponse.errorMessage = "Failed to get hosted payment page Error: " +
                                                         response.messages.message[0].code + "  " +
                                                         response.messages.message[0].text;
                    }
                }
                else
                {
                    objAcceptResponse.status = false;
                    return(NotFound());
                }
            }
            catch (Exception e)
            {
                objAcceptResponse.status = false;

                objAcceptResponse.errorMessage = "Error occured while executing payment. " + e.Message;
            }


            return(objAcceptResponse);
        }
コード例 #3
0
        public ActionResult <AcceptResponse> AcceptCustomer(string apiLoginId, string apiTransactionKey, string customerId)
        {
            AcceptResponse objAcceptResponse = new AcceptResponse();

            try
            {
                ProxyMethod();

                ANetApiResponse response = GetAcceptCustomerProfilePage.Run(apiLoginId, apiTransactionKey, customerId);


                if (response != null)
                {
                    if (response.messages.resultCode.ToString() == "Ok")
                    {
                        objAcceptResponse.Status = true;
                        objAcceptResponse.Value  = "";
                        //((AuthorizeNet.Api.Contracts.V1.getHostedPaymentPageResponse)response).token;
                    }
                    else
                    {
                        objAcceptResponse.Status  = false;
                        objAcceptResponse.Message = "Failed to get hosted payment page Error: " +
                                                    response.messages.message[0].code + "  " +
                                                    response.messages.message[0].text;
                    }
                }
                else
                {
                    objAcceptResponse.Status = false;
                    return(NotFound());
                }
            }
            catch (Exception e)
            {
                objAcceptResponse.Status = false;

                objAcceptResponse.Message = "Error occured while executing payment. " + e.Message;
            }


            return(objAcceptResponse);
        }