コード例 #1
0
        protected CreateCustomerProfileRequest BuildRequestFromFields(CreateCustomerProfileRequest CreateCustomerProfileRequest)
        {
            // Build Keyed Sale Request fields from the input source

            //Provide unique customer ID everytime for successful request
            CreateCustomerProfileRequest.CustomerId = "customerTest2Demo";

            CreateCustomerProfileRequest.ObjCreditCard                 = new CreditCard();
            CreateCustomerProfileRequest.ObjCreditCard.CcNumber        = "5454545454545454";
            CreateCustomerProfileRequest.ObjCreditCard.ExpirationMonth = "12";
            CreateCustomerProfileRequest.ObjCreditCard.ExpirationYear  = "2020";

            CreateCustomerProfileRequest.ObjBillingAddress               = new BillingAddress();
            CreateCustomerProfileRequest.ObjBillingAddress.Name          = "Mike Smith";
            CreateCustomerProfileRequest.ObjBillingAddress.StreetAddress = "8230 E.Indiana St.";
            CreateCustomerProfileRequest.ObjBillingAddress.City          = "Spokane";
            CreateCustomerProfileRequest.ObjBillingAddress.State         = "WA";
            CreateCustomerProfileRequest.ObjBillingAddress.Zip           = "85284";

            // optionl unless you have Discretionary data required.
            //CreateCustomerProfileRequest.discretionary_data = new CustomerDiscretionaryData ();
            //CreateCustomerProfileRequest.discretionary_data.TestingField = " Testing Discretionary Data 123";
            //CreateCustomerProfileRequest.discretionary_data.Testing_DisData = "Testing_DisData 123";

            return(CreateCustomerProfileRequest);
        }
コード例 #2
0
        public void BuildTransaction(string oAuth)
        {
            // Create Customer Profile Request
            CreateCustomerProfileRequest requestCreateCustomer = new CreateCustomerProfileRequest();

            // for Create customer Request execuation
            CreateCustomerProfileGenerator CreateCustomerProfileGenerator = new CreateCustomerProfileGenerator();

            // Assign the values to the Create Customer Request.
            requestCreateCustomer = BuildRequestFromFields(requestCreateCustomer);

            // To make a Create Customer Profile Request and store the response
            var result = CreateCustomerProfileGenerator.CreateCustomerProfileTrans(oAuth, requestCreateCustomer);

            //display the Create Customer Profile Response
            WriteResults(result);
        }
コード例 #3
0
        /// <summary>
        /// Method for builiding Transaction with Json Request,call the actual transaction execution method and call for Deseralize Json
        /// and Return the object.
        /// Returns the CreateCustomerProfileResponse Type
        /// </summary>
        public CreateCustomerProfileResponse CreateCustomerProfileTrans(string token, CreateCustomerProfileRequest createCustomerProfileRequest)
        {
            // Header details are available at Authentication header page.
            string methodUrl = ApiEndPointConfiguration.UrlCreateCustomer;

            //converting request into JSON string
            var requestJSON = JsonSerializer.GetSeralizedString(createCustomerProfileRequest);

            //Optional - Display Json Request
            //System.Web.HttpContext.Current.Response.Write ("<br>" + "Json Request: " + requestJSON + "<br>");

            //call for actual request and response
            var payTraceResponse = new PayTraceResponse();
            var tempResponse     = payTraceResponse.ProcessTransaction(methodUrl, token, requestJSON);

            //Create and assign the deseralized object to appropriate response type
            var createCustomerProfileResponse = new CreateCustomerProfileResponse();

            createCustomerProfileResponse = JsonSerializer.DeserializeResponse <CreateCustomerProfileResponse>(tempResponse);

            //Assign the http error if any
            JsonSerializer.AssignError(tempResponse, (PayTraceBasicResponse)createCustomerProfileResponse);

            //Return the Desearlized object
            return(createCustomerProfileResponse);
        }