Skip to content

Commit 08fb2db

Browse files
author
Sunny Raj Rathod
committed
Merge pull request AuthorizeNet#138 from AuthorizeNet/future
Future to master
2 parents 0908228 + 9e30185 commit 08fb2db

10 files changed

+164
-3
lines changed

Authorize.NET/AIM/Gateway.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using System.Collections.Specialized;
1111
using System.Xml.Serialization;
1212
using System.Xml;
13+
using AuthorizeNet.Util;
1314

1415
namespace AuthorizeNet {
1516

@@ -58,6 +59,14 @@ protected string SendRequest(string serviceUrl, IGatewayRequest request) {
5859
webRequest.ContentLength = postData.Length;
5960
webRequest.ContentType = "application/x-www-form-urlencoded";
6061

62+
//set the http connection timeout
63+
var httpConnectionTimeout = AuthorizeNet.Environment.getIntProperty(Constants.HttpConnectionTimeout);
64+
webRequest.Timeout = (httpConnectionTimeout != 0 ? httpConnectionTimeout : Constants.HttpConnectionDefaultTimeout);
65+
66+
//set the time out to read/write from stream
67+
var httpReadWriteTimeout = AuthorizeNet.Environment.getIntProperty(Constants.HttpReadWriteTimeout);
68+
webRequest.ReadWriteTimeout = (httpReadWriteTimeout != 0 ? httpReadWriteTimeout : Constants.HttpReadWriteDefaultTimeout);
69+
6170
// post data is sent as a stream
6271
StreamWriter myWriter = null;
6372
myWriter = new StreamWriter(webRequest.GetRequestStream());

Authorize.NET/Api/Contracts/V1/AnetApiSchema.generated.cs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ public partial class customerPaymentProfileMaskedType : customerPaymentProfileBa
248248

249249
/// <remarks/>
250250
public string taxId;
251+
252+
/// <remarks/>
253+
[System.Xml.Serialization.XmlArrayItemAttribute("subscriptionId", IsNullable=false)]
254+
public string[] subscriptionIds;
251255
}
252256

253257
/// <remarks/>
@@ -3051,6 +3055,33 @@ protected void RaisePropertyChanged(string propertyName) {
30513055
}
30523056
}
30533057

3058+
/// <remarks/>
3059+
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
3060+
[System.SerializableAttribute()]
3061+
[System.Diagnostics.DebuggerStepThroughAttribute()]
3062+
[System.ComponentModel.DesignerCategoryAttribute("code")]
3063+
[System.Xml.Serialization.XmlTypeAttribute(Namespace="AnetApi/xml/v1/schema/AnetApiSchema.xsd")]
3064+
public partial class customerProfileIdType : object, System.ComponentModel.INotifyPropertyChanged {
3065+
3066+
/// <remarks/>
3067+
public string customerProfileId;
3068+
3069+
/// <remarks/>
3070+
public string customerPaymentProfileId;
3071+
3072+
/// <remarks/>
3073+
public string customerAddressId;
3074+
3075+
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
3076+
3077+
protected void RaisePropertyChanged(string propertyName) {
3078+
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
3079+
if ((propertyChanged != null)) {
3080+
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
3081+
}
3082+
}
3083+
}
3084+
30543085
/// <remarks/>
30553086
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
30563087
[System.SerializableAttribute()]
@@ -3137,6 +3168,9 @@ public partial class ARBSubscriptionType : object, System.ComponentModel.INotify
31373168
/// <remarks/>
31383169
public nameAndAddressType shipTo;
31393170

3171+
/// <remarks/>
3172+
public customerProfileIdType profile;
3173+
31403174
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
31413175

31423176
protected void RaisePropertyChanged(string propertyName) {
@@ -3461,6 +3495,9 @@ public partial class ARBCreateSubscriptionResponse : ANetApiResponse {
34613495

34623496
/// <remarks/>
34633497
public string subscriptionId;
3498+
3499+
/// <remarks/>
3500+
public customerProfileIdType profile;
34643501
}
34653502

34663503
/// <remarks/>
@@ -3487,6 +3524,9 @@ public partial class ARBUpdateSubscriptionRequest : ANetApiRequest {
34873524
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="AnetApi/xml/v1/schema/AnetApiSchema.xsd")]
34883525
[System.Xml.Serialization.XmlRootAttribute(Namespace="AnetApi/xml/v1/schema/AnetApiSchema.xsd", IsNullable=false)]
34893526
public partial class ARBUpdateSubscriptionResponse : ANetApiResponse {
3527+
3528+
/// <remarks/>
3529+
public customerProfileIdType profile;
34903530
}
34913531

34923532
/// <remarks/>
@@ -3691,6 +3731,12 @@ public partial class createCustomerProfileFromTransactionRequest : ANetApiReques
36913731

36923732
/// <remarks/>
36933733
public string transId;
3734+
3735+
/// <remarks/>
3736+
public customerProfileBaseType customer;
3737+
3738+
/// <remarks/>
3739+
public string customerProfileId;
36943740
}
36953741

36963742
/// <remarks/>
@@ -3717,6 +3763,10 @@ public partial class getCustomerProfileResponse : ANetApiResponse {
37173763

37183764
/// <remarks/>
37193765
public customerProfileMaskedType profile;
3766+
3767+
/// <remarks/>
3768+
[System.Xml.Serialization.XmlArrayItemAttribute("subscriptionId", IsNullable=false)]
3769+
public string[] subscriptionIds;
37203770
}
37213771

37223772
/// <remarks/>
@@ -3782,6 +3832,10 @@ public partial class getCustomerShippingAddressResponse : ANetApiResponse {
37823832

37833833
/// <remarks/>
37843834
public customerAddressExType address;
3835+
3836+
/// <remarks/>
3837+
[System.Xml.Serialization.XmlArrayItemAttribute("subscriptionId", IsNullable=false)]
3838+
public string[] subscriptionIds;
37853839
}
37863840

37873841
/// <remarks/>

Authorize.NET/Api/Contracts/V1/RequestFactoryWithSpecified.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,12 +714,21 @@ public static void paymentScheduleType(paymentScheduleType argument)
714714
if (0 <= argument.trialOccurrences) { argument.trialOccurrencesSpecified = true; }
715715
}
716716
}
717+
717718
public static void paymentScheduleTypeInterval(paymentScheduleTypeInterval argument)
718719
{
719720
if (null != argument)
720721
{
721722
}
722723
}
724+
725+
public static void customerProfileIdType(customerProfileIdType argument)
726+
{
727+
if (null != argument)
728+
{
729+
}
730+
}
731+
723732
public static void ARBSubscriptionType(ARBSubscriptionType argument)
724733
{
725734
if (null != argument)
@@ -732,6 +741,7 @@ public static void ARBSubscriptionType(ARBSubscriptionType argument)
732741
customerType(argument.customer);
733742
nameAndAddressType(argument.billTo);
734743
nameAndAddressType(argument.shipTo);
744+
customerProfileIdType(argument.profile);
735745
}
736746
}
737747

@@ -842,6 +852,7 @@ public static void ARBCreateSubscriptionResponse(ARBCreateSubscriptionResponse a
842852
{
843853
if (null != argument)
844854
{
855+
customerProfileIdType(argument.profile);
845856
}
846857
}
847858
public static void ARBUpdateSubscriptionRequest(ARBUpdateSubscriptionRequest argument)
@@ -855,6 +866,7 @@ public static void ARBUpdateSubscriptionResponse(ARBUpdateSubscriptionResponse a
855866
{
856867
if (null != argument)
857868
{
869+
customerProfileIdType(argument.profile);
858870
}
859871
}
860872
public static void ARBCancelSubscriptionRequest(ARBCancelSubscriptionRequest argument)
@@ -927,6 +939,7 @@ public static void createCustomerProfileFromTransactionRequest(createCustomerPro
927939
{
928940
if (null != argument)
929941
{
942+
customerProfileBaseType(argument.customer);
930943
}
931944
}
932945
public static void getCustomerProfileRequest(getCustomerProfileRequest argument)

Authorize.NET/Api/Contracts/V1/RequestFactoryWithSpecified.generated.org

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,12 @@ transRetailInfoType() {
705705
profileTransVoidType(argument);
706706
}
707707
}
708+
public static void customerProfileIdType(customerProfileIdType argument)
709+
{
710+
if(null != argument)
711+
{
712+
}
713+
}
708714
public static void customerType(customerType argument)
709715
{
710716
if(null != argument)
@@ -725,6 +731,7 @@ transRetailInfoType() {
725731
customerType(argument.customer);
726732
nameAndAddressType(argument.billTo);
727733
nameAndAddressType(argument.shipTo);
734+
customerProfileIdType(argument.profile);
728735
}
729736
}
730737
public static void paymentDetails(paymentDetails argument)
@@ -812,6 +819,7 @@ transRetailInfoType() {
812819
{
813820
if(null != argument)
814821
{
822+
customerProfileIdType(argument.profile);
815823
}
816824
}
817825
public static void ARBUpdateSubscriptionRequest(ARBUpdateSubscriptionRequest argument)
@@ -825,6 +833,7 @@ transRetailInfoType() {
825833
{
826834
if(null != argument)
827835
{
836+
customerProfileIdType(argument.profile);
828837
}
829838
}
830839
public static void ARBCancelSubscriptionRequest(ARBCancelSubscriptionRequest argument)
@@ -897,6 +906,7 @@ transRetailInfoType() {
897906
{
898907
if(null != argument)
899908
{
909+
customerProfileBaseType(argument.customer);
900910
}
901911
}
902912
public static void getCustomerProfileRequest(getCustomerProfileRequest argument)

Authorize.NET/CIM/CustomerGateway.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ public class CustomerGateway : ICustomerGateway {
2020
/// <param name="apiLogin">The API login.</param>
2121
/// <param name="transactionKey">The transaction key.</param>
2222
/// <param name="mode">Test or Live.</param>
23-
public CustomerGateway(string apiLogin, string transactionKey, ServiceMode mode) {
23+
/// <param name="validationMode">None, Test, or Live.</param>
24+
public CustomerGateway(string apiLogin, string transactionKey, ServiceMode mode, validationModeEnum? validationMode = null)
25+
{
2426

2527
if (mode == ServiceMode.Live) {
2628
_gateway = new HttpXmlUtility(ServiceMode.Live, apiLogin, transactionKey);
@@ -29,6 +31,10 @@ public CustomerGateway(string apiLogin, string transactionKey, ServiceMode mode)
2931
_gateway = new HttpXmlUtility(ServiceMode.Test, apiLogin, transactionKey);
3032
_mode = validationModeEnum.testMode;
3133
}
34+
if (validationMode.HasValue)
35+
{
36+
_mode = validationMode.Value;
37+
}
3238
}
3339
/// <summary>
3440
/// Initializes a new instance of the <see cref="CustomerGateway"/> class.

Authorize.NET/Environment.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class Environment {
2121
public static readonly Environment PRODUCTION = new Environment("https://secure2.authorize.net","https://api2.authorize.net","https://cardpresent.authorize.net");
2222
public static readonly Environment LOCAL_VM = new Environment(null, null, null);
2323
public static readonly Environment HOSTED_VM = new Environment(null, null, null);
24-
public static readonly Environment CUSTOM = new Environment(null, null, null);
24+
public static Environment CUSTOM = new Environment(null, null, null);
2525

2626
private String _baseUrl;
2727
private String _xmlBaseUrl;

Authorize.NET/Util/Constants.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,14 @@ public static class Constants {
1818

1919
public const string PropApiLoginid = "api.login.id";
2020
public const string PropTransactionKey = "transaction.key";
21-
public const string PropMd5Hashkey = "md5.hash.key";
21+
public const string PropMd5Hashkey = "md5.hash.key";
22+
23+
public const string HttpConnectionTimeout = "http.connectionTimeout";
24+
public const string HttpReadWriteTimeout = "http.readWriteTimeout";
25+
26+
public const int HttpConnectionDefaultTimeout = 30000;
27+
public const int HttpReadWriteDefaultTimeout = 30000;
28+
2229
}
2330
#pragma warning restore 1591
2431
}

Authorize.NET/Util/HttpUtility.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ public static ANetApiResponse PostData<TQ, TS>(AuthorizeNet.Environment env, TQ
4646
webRequest.KeepAlive = true;
4747
webRequest.Proxy = SetProxyIfRequested(webRequest.Proxy);
4848

49+
//set the http connection timeout
50+
var httpConnectionTimeout = AuthorizeNet.Environment.getIntProperty(Constants.HttpConnectionTimeout);
51+
webRequest.Timeout = (httpConnectionTimeout != 0 ? httpConnectionTimeout : Constants.HttpConnectionDefaultTimeout);
52+
53+
//set the time out to read/write from stream
54+
var httpReadWriteTimeout = AuthorizeNet.Environment.getIntProperty(Constants.HttpReadWriteTimeout);
55+
webRequest.ReadWriteTimeout = (httpReadWriteTimeout != 0 ? httpReadWriteTimeout : Constants.HttpReadWriteDefaultTimeout);
56+
4957
var requestType = typeof (TQ);
5058
var serializer = new XmlSerializer(requestType);
5159
using (var writer = new XmlTextWriter(webRequest.GetRequestStream(), Encoding.UTF8))

Authorize.NET/Utility/AnetApiSchema.generated.cs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ public partial class customerPaymentProfileMaskedType : customerPaymentProfileBa
212212

213213
/// <remarks/>
214214
public string taxId;
215+
216+
/// <remarks/>
217+
[System.Xml.Serialization.XmlArrayItemAttribute("subscriptionId", IsNullable=false)]
218+
public string[] subscriptionIds;
215219
}
216220

217221
/// <remarks/>
@@ -2430,6 +2434,24 @@ public partial class profileTransactionType {
24302434
public object Item;
24312435
}
24322436

2437+
/// <remarks/>
2438+
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
2439+
[System.SerializableAttribute()]
2440+
[System.Diagnostics.DebuggerStepThroughAttribute()]
2441+
[System.ComponentModel.DesignerCategoryAttribute("code")]
2442+
[System.Xml.Serialization.XmlTypeAttribute(Namespace="AnetApi/xml/v1/schema/AnetApiSchema.xsd")]
2443+
public partial class customerProfileIdType {
2444+
2445+
/// <remarks/>
2446+
public string customerProfileId;
2447+
2448+
/// <remarks/>
2449+
public string customerPaymentProfileId;
2450+
2451+
/// <remarks/>
2452+
public string customerAddressId;
2453+
}
2454+
24332455
/// <remarks/>
24342456
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
24352457
[System.SerializableAttribute()]
@@ -2506,6 +2528,9 @@ public partial class ARBSubscriptionType {
25062528

25072529
/// <remarks/>
25082530
public nameAndAddressType shipTo;
2531+
2532+
/// <remarks/>
2533+
public customerProfileIdType profile;
25092534
}
25102535

25112536
/// <remarks/>
@@ -2759,6 +2784,9 @@ public partial class ARBCreateSubscriptionResponse : ANetApiResponse {
27592784

27602785
/// <remarks/>
27612786
public string subscriptionId;
2787+
2788+
/// <remarks/>
2789+
public customerProfileIdType profile;
27622790
}
27632791

27642792
/// <remarks/>
@@ -2785,6 +2813,9 @@ public partial class ARBUpdateSubscriptionRequest : ANetApiRequest {
27852813
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="AnetApi/xml/v1/schema/AnetApiSchema.xsd")]
27862814
[System.Xml.Serialization.XmlRootAttribute(Namespace="AnetApi/xml/v1/schema/AnetApiSchema.xsd", IsNullable=false)]
27872815
public partial class ARBUpdateSubscriptionResponse : ANetApiResponse {
2816+
2817+
/// <remarks/>
2818+
public customerProfileIdType profile;
27882819
}
27892820

27902821
/// <remarks/>
@@ -2989,6 +3020,12 @@ public partial class createCustomerProfileFromTransactionRequest : ANetApiReques
29893020

29903021
/// <remarks/>
29913022
public string transId;
3023+
3024+
/// <remarks/>
3025+
public customerProfileBaseType customer;
3026+
3027+
/// <remarks/>
3028+
public string customerProfileId;
29923029
}
29933030

29943031
/// <remarks/>
@@ -3015,6 +3052,10 @@ public partial class getCustomerProfileResponse : ANetApiResponse {
30153052

30163053
/// <remarks/>
30173054
public customerProfileMaskedType profile;
3055+
3056+
/// <remarks/>
3057+
[System.Xml.Serialization.XmlArrayItemAttribute("subscriptionId", IsNullable=false)]
3058+
public string[] subscriptionIds;
30183059
}
30193060

30203061
/// <remarks/>
@@ -3080,6 +3121,10 @@ public partial class getCustomerShippingAddressResponse : ANetApiResponse {
30803121

30813122
/// <remarks/>
30823123
public customerAddressExType address;
3124+
3125+
/// <remarks/>
3126+
[System.Xml.Serialization.XmlArrayItemAttribute("subscriptionId", IsNullable=false)]
3127+
public string[] subscriptionIds;
30833128
}
30843129

30853130
/// <remarks/>

0 commit comments

Comments
 (0)