cancel
Showing results for 
Search instead for 
Did you mean: 

C# SDK needs to be finished or better documented

In particular I'm talking about the AuthorizationRequest class which is in the AuthorizeNET project, AIM/Requests/AuthorizationRequest.cs file around line 47

 

One of the constructor overloads isn't finished.  The code is currently:

 

/// <summary>
/// Loader for use with form POSTS from web
/// </summary>
/// <param name="post"></param>
public AuthorizationRequest(NameValueCollection post) {
 this.SetApiAction(RequestAction.AuthorizeAndCapture);
 this.Queue(ApiFields.CreditCardNumber, post[ApiFields.CreditCardNumber]);
 this.Queue(ApiFields.CreditCardExpiration, post[ApiFields.CreditCardExpiration]);
 this.Queue(ApiFields.Amount, post[ApiFields.Amount]);
}

The constructor is supposed to build a full request based off of post variables.  However, it ONLY sets the card number, expiration, and amount fields.

 

All of the other fields, such as the billing address fields which are required for AVS checks, are ignored. 

 

The docs on this constructor basically says that you only have to pass in the name value collection and the object will set all of the fields.  Obviously that isn't accurate.

 

I would expect one of two things to occur.

1. Complete the code for the constructor.  Make it aware of all of the "x_" fields and properly instantiate everything it needs internally to work; or,

 

2. Update the documents (including the constructor summary) to state exactly what it does do, or in this case, what it doesn't do. 

 

The first item is much preferred over the second.  If you choose to go with the second option, please update your examples to show the additional fields being set.

 

Thank you, 

clively
Contributor
3 REPLIES 3

Hey clively,

 

Thanks for the feedback on the C# SDK. I have passed your feedback on to our development teams so they can keep that all in mind as they make updates to the current code.

 

Thanks,

 

Michelle

Developer Community Manager

Michelle
All Star

I agree with this person's post, and have found the availability of information about this class to be frustratingly limited.  I hope that this forum has a fairly active group of people who can help me get the answers I need, that seem to be unavailable through any of the documentation I can find.

I have also run into this problem, instead of waiting for a version update (i have api v3.1), I made this "Plug n Play" method that should help others that have also came across this lack of develpment.

 

IGatewayRequest request = new AuthorizationRequest(post);
request = PopulateRequest(post, request);

 

//here is the code that makes up the PopulateRequest method

 

         private IGatewayRequest PopulateRequest(FormCollection fc, IGatewayRequest request)
        {
            request.AddCustomer(fc["x_cust_id"], fc["x_first_name"], fc["x_last_name"], fc["x_address"], fc["x_state"], fc["x_zip"]);
            request.City = fc["x_city"];
            request.Type = fc["x_type"];
            request.AddShipping(fc["x_cust_id"], fc["x_ship_to_first_name"], fc["x_ship_to_last_name"], fc["x_ship_to_address"], fc["x_ship_to_state"], fc["x_ship_to_zip"]);
            request.ShipToCity = fc["x_ship_to_city"];
            request.RecurringBilling = fc["x_recurring_billing"];
            
            return request;
        }

 

Also note: that the AddShipping and AddCustomer methods do not include a construstor for the city, making these methods incomplete.

 

Hope this helps...

-Jake

JeskeJL02
Member