Example #1
0
        protected KeyedSaleRequest BuildRequestFromFields(KeyedSaleRequest requestKeyedSale)
        {
            // Build Keyed Sale Request fields from the input source

            requestKeyedSale.Amount = 4.50;

            requestKeyedSale.ObjCreditCard                 = new CreditCard();
            requestKeyedSale.ObjCreditCard.CcNumber        = "4111111111111111";
            requestKeyedSale.ObjCreditCard.ExpirationMonth = "12";
            requestKeyedSale.ObjCreditCard.ExpirationYear  = "2019";

            // Commented assignments lines will give an error response
            //requestKeyedSale.credit_card.expiration_month = "13";
            //requestKeyedSale.credit_card.expiration_year = "2011";
            requestKeyedSale.Csc = "999";

            requestKeyedSale.ObjBillingAddress               = new BillingAddress();
            requestKeyedSale.ObjBillingAddress.Name          = "Mike Smith";
            requestKeyedSale.ObjBillingAddress.StreetAddress = "8320 E. West St.";
            requestKeyedSale.ObjBillingAddress.City          = "Spokane";
            requestKeyedSale.ObjBillingAddress.State         = "WA";
            requestKeyedSale.ObjBillingAddress.Zip           = "85284";

            return(requestKeyedSale);
        }
Example #2
0
        public KeyedSaleResponse KeyedAuthorizationTrans(string token, KeyedSaleRequest keyedSaleRequest)
        {
            /// <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 KeyedSaleResponse Type
            /// </summary>

            // Header details are available at Authentication header page.
            string methodUrl = ApiEndPointConfiguration.UrlKeyedAuthorization;

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

            //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 keyedSaleResponse = new KeyedSaleResponse();

            keyedSaleResponse = JsonSerializer.DeserializeResponse <KeyedSaleResponse>(tempResponse);

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

            //Return the Desearlized object
            return(keyedSaleResponse);
        }
Example #3
0
        public void BuildTransaction(string oAuth)
        {
            // Key Sale Request
            KeyedSaleRequest requestKeyedSale = new KeyedSaleRequest();

            //KeySale Transaction Generator
            KeyedSaleGenerator keyedSaleGenerator = new KeyedSaleGenerator();

            // Assign the values to the key Sale Request.
            requestKeyedSale = BuildRequestFromFields(requestKeyedSale);

            // To make Keyed Sale Request and store the response
            var result = keyedSaleGenerator.KeyedSaleTrans(oAuth, requestKeyedSale);

            //display the Keyed Sale Response
            WriteResults(result);
        }