/// <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 KeyedRefundResponse Type /// </summary> public KeyedRefundResponse KeyedRefundTrans(string token, KeyedRefundRequest keyedRefundRequest) { // Header details are available at ApiEndPointConfiguration string methodUrl = ApiEndPointConfiguration.UrlKeyedRefund; //converting request into JSON string var requestJSON = JsonSerializer.GetSeralizedString(keyedRefundRequest); //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 keyedRefundResponse = new KeyedRefundResponse(); keyedRefundResponse = JsonSerializer.DeserializeResponse <KeyedRefundResponse>(tempResponse); //Assign the http error if any JsonSerializer.AssignError(tempResponse, (PayTraceBasicResponse)keyedRefundResponse); //Return the Desearlized object return(keyedRefundResponse); }
public void BuildTransaction(string oAuth) { // Keyed Refund Request KeyedRefundRequest requestKeyedRefund = new KeyedRefundRequest(); // for Keyed Refund Transaction KeyedRefundGenerator keyedRefundGenerator = new KeyedRefundGenerator(); // Assign the values to the key Refund Request. requestKeyedRefund = BuildRequestFromFields(requestKeyedRefund); // To make Keyed Refund Request and store the response var result = keyedRefundGenerator.KeyedRefundTrans(oAuth, requestKeyedRefund); //display the Keyed Refund Response WriteResults(result); }
protected KeyedRefundRequest BuildRequestFromFields(KeyedRefundRequest requestKeyedRefund) { // Build Keyed Refund Request fields from the input source requestKeyedRefund.Amount = 1.99; requestKeyedRefund.ObjCreditCard = new CreditCard(); requestKeyedRefund.ObjCreditCard.CcNumber = "5454545454545454"; requestKeyedRefund.ObjCreditCard.ExpirationMonth = "12"; requestKeyedRefund.ObjCreditCard.ExpirationYear = "2018"; requestKeyedRefund.Csc = "999"; requestKeyedRefund.ObjBillingAddress = new BillingAddress(); requestKeyedRefund.ObjBillingAddress.Name = "Tom Smith"; requestKeyedRefund.ObjBillingAddress.StreetAddress = "8320 E. West St."; requestKeyedRefund.ObjBillingAddress.City = "Spokane"; requestKeyedRefund.ObjBillingAddress.State = "WA"; requestKeyedRefund.ObjBillingAddress.Zip = "85284"; return(requestKeyedRefund); }