Skip to content

Commit 611894b

Browse files
Merge pull request #111 from CyberSource/release-sep24
MIT Framework Samples and Sep24 Release
2 parents e9eb332 + f732588 commit 611894b

13 files changed

+1001
-5
lines changed

Source/Samples/MerchantBoarding/MerchantBoardingVPC.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public static InlineResponse2012 Run()
9595
EnableInterchangeOptimization = false,
9696
EnableSplitShipment = false,
9797
VisaDelegatedAuthenticationId = "123457",
98-
DomesticMerchantId = "123458",
98+
DomesticMerchantId = false,
9999
CreditCardRefundLimitPercent = "2",
100100
BusinessCenterCreditCardRefundLimitPercent = "3",
101101
AllowCapturesGreaterThanAuthorizations = false,

Source/Samples/PayerAuthentication/EnrollWithCustomerIdAsPaymentInformation.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public static RiskV1AuthenticationsPost201Response Run()
6060
);
6161

6262
string paymentInformationCustomerCustomerId = "AB695DA801DD1BB6E05341588E0A3BDC";
63-
Ptsv2paymentsPaymentInformationCustomer paymentInformationCustomer = new Ptsv2paymentsPaymentInformationCustomer(
63+
Riskv1authenticationsPaymentInformationCustomer paymentInformationCustomer = new Riskv1authenticationsPaymentInformationCustomer(
6464
CustomerId: paymentInformationCustomerCustomerId
6565
);
6666

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Globalization;
4+
5+
using CyberSource.Api;
6+
using CyberSource.Model;
7+
8+
namespace Cybersource_rest_samples_dotnet.Samples.Payments
9+
{
10+
public class CITInitiatingInstalmentSubscriptionUK
11+
{
12+
public static PtsV2PaymentsPost201Response Run()
13+
{
14+
string clientReferenceInformationCode = "TC50171_3";
15+
Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
16+
Code: clientReferenceInformationCode
17+
);
18+
19+
bool processingInformationCapture = false;
20+
string processingInformationCommerceIndicator = "vbv";
21+
bool processingInformationAuthorizationOptionsIgnoreAvsResult = false;
22+
bool processingInformationAuthorizationOptionsIgnoreCvResult = false;
23+
bool processingInformationAuthorizationOptionsInitiatorCredentialStoredOnFile = true;
24+
Ptsv2paymentsProcessingInformationAuthorizationOptionsInitiator processingInformationAuthorizationOptionsInitiator = new Ptsv2paymentsProcessingInformationAuthorizationOptionsInitiator(
25+
CredentialStoredOnFile: processingInformationAuthorizationOptionsInitiatorCredentialStoredOnFile
26+
);
27+
28+
Ptsv2paymentsProcessingInformationAuthorizationOptions processingInformationAuthorizationOptions = new Ptsv2paymentsProcessingInformationAuthorizationOptions(
29+
IgnoreAvsResult: processingInformationAuthorizationOptionsIgnoreAvsResult,
30+
IgnoreCvResult: processingInformationAuthorizationOptionsIgnoreCvResult,
31+
Initiator: processingInformationAuthorizationOptionsInitiator
32+
);
33+
34+
bool processingInformationRecurringOptionsLoanPayment = false;
35+
bool processingInformationRecurringOptionsFirstRecurringPayment = true;
36+
Ptsv2paymentsProcessingInformationRecurringOptions processingInformationRecurringOptions = new Ptsv2paymentsProcessingInformationRecurringOptions(
37+
LoanPayment: processingInformationRecurringOptionsLoanPayment,
38+
FirstRecurringPayment: processingInformationRecurringOptionsFirstRecurringPayment
39+
);
40+
41+
Ptsv2paymentsProcessingInformation processingInformation = new Ptsv2paymentsProcessingInformation(
42+
Capture: processingInformationCapture,
43+
CommerceIndicator: processingInformationCommerceIndicator,
44+
AuthorizationOptions: processingInformationAuthorizationOptions,
45+
RecurringOptions: processingInformationRecurringOptions
46+
);
47+
48+
string paymentInformationCardNumber = "4111111111111111";
49+
string paymentInformationCardExpirationMonth = "12";
50+
string paymentInformationCardExpirationYear = "2031";
51+
Ptsv2paymentsPaymentInformationCard paymentInformationCard = new Ptsv2paymentsPaymentInformationCard(
52+
Number: paymentInformationCardNumber,
53+
ExpirationMonth: paymentInformationCardExpirationMonth,
54+
ExpirationYear: paymentInformationCardExpirationYear
55+
);
56+
57+
Ptsv2paymentsPaymentInformation paymentInformation = new Ptsv2paymentsPaymentInformation(
58+
Card: paymentInformationCard
59+
);
60+
61+
string orderInformationAmountDetailsTotalAmount = "102.21";
62+
string orderInformationAmountDetailsCurrency = "GBP";
63+
Ptsv2paymentsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsOrderInformationAmountDetails(
64+
TotalAmount: orderInformationAmountDetailsTotalAmount,
65+
Currency: orderInformationAmountDetailsCurrency
66+
);
67+
68+
string orderInformationBillToFirstName = "John";
69+
string orderInformationBillToLastName = "Doe";
70+
string orderInformationBillToAddress1 = "1 Market St";
71+
string orderInformationBillToLocality = "san francisco";
72+
string orderInformationBillToAdministrativeArea = "CA";
73+
string orderInformationBillToPostalCode = "94105";
74+
string orderInformationBillToCountry = "US";
75+
string orderInformationBillToEmail = "[email protected]";
76+
string orderInformationBillToPhoneNumber = "4158880000";
77+
Ptsv2paymentsOrderInformationBillTo orderInformationBillTo = new Ptsv2paymentsOrderInformationBillTo(
78+
FirstName: orderInformationBillToFirstName,
79+
LastName: orderInformationBillToLastName,
80+
Address1: orderInformationBillToAddress1,
81+
Locality: orderInformationBillToLocality,
82+
AdministrativeArea: orderInformationBillToAdministrativeArea,
83+
PostalCode: orderInformationBillToPostalCode,
84+
Country: orderInformationBillToCountry,
85+
Email: orderInformationBillToEmail,
86+
PhoneNumber: orderInformationBillToPhoneNumber
87+
);
88+
89+
Ptsv2paymentsOrderInformation orderInformation = new Ptsv2paymentsOrderInformation(
90+
AmountDetails: orderInformationAmountDetails,
91+
BillTo: orderInformationBillTo
92+
);
93+
94+
string consumerAuthenticationInformationCavv = "EHuWW9PiBkWvqE5juRwDzAUFBAk=";
95+
Ptsv2paymentsConsumerAuthenticationInformation consumerAuthenticationInformation = new Ptsv2paymentsConsumerAuthenticationInformation(
96+
Cavv: consumerAuthenticationInformationCavv
97+
);
98+
99+
var requestObj = new CreatePaymentRequest(
100+
ClientReferenceInformation: clientReferenceInformation,
101+
ProcessingInformation: processingInformation,
102+
PaymentInformation: paymentInformation,
103+
OrderInformation: orderInformation,
104+
ConsumerAuthenticationInformation: consumerAuthenticationInformation
105+
);
106+
107+
try
108+
{
109+
var configDictionary = new Configuration().GetConfiguration();
110+
var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary);
111+
112+
var apiInstance = new PaymentsApi(clientConfig);
113+
PtsV2PaymentsPost201Response result = apiInstance.CreatePayment(requestObj);
114+
Console.WriteLine(result);
115+
return result;
116+
}
117+
catch (Exception e)
118+
{
119+
Console.WriteLine("Exception on calling the API : " + e.Message);
120+
return null;
121+
}
122+
}
123+
}
124+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Globalization;
4+
5+
using CyberSource.Api;
6+
using CyberSource.Model;
7+
8+
namespace Cybersource_rest_samples_dotnet.Samples.Payments
9+
{
10+
public class CITInitiatingRecurringSubscription
11+
{
12+
public static PtsV2PaymentsPost201Response Run()
13+
{
14+
string clientReferenceInformationCode = "TC50171_3";
15+
Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
16+
Code: clientReferenceInformationCode
17+
);
18+
19+
bool processingInformationCapture = false;
20+
string processingInformationCommerceIndicator = "vbv";
21+
bool processingInformationAuthorizationOptionsIgnoreAvsResult = false;
22+
bool processingInformationAuthorizationOptionsIgnoreCvResult = false;
23+
bool processingInformationAuthorizationOptionsInitiatorCredentialStoredOnFile = true;
24+
Ptsv2paymentsProcessingInformationAuthorizationOptionsInitiator processingInformationAuthorizationOptionsInitiator = new Ptsv2paymentsProcessingInformationAuthorizationOptionsInitiator(
25+
CredentialStoredOnFile: processingInformationAuthorizationOptionsInitiatorCredentialStoredOnFile
26+
);
27+
28+
Ptsv2paymentsProcessingInformationAuthorizationOptions processingInformationAuthorizationOptions = new Ptsv2paymentsProcessingInformationAuthorizationOptions(
29+
IgnoreAvsResult: processingInformationAuthorizationOptionsIgnoreAvsResult,
30+
IgnoreCvResult: processingInformationAuthorizationOptionsIgnoreCvResult,
31+
Initiator: processingInformationAuthorizationOptionsInitiator
32+
);
33+
34+
bool processingInformationRecurringOptionsLoanPayment = false;
35+
bool processingInformationRecurringOptionsFirstRecurringPayment = true;
36+
Ptsv2paymentsProcessingInformationRecurringOptions processingInformationRecurringOptions = new Ptsv2paymentsProcessingInformationRecurringOptions(
37+
LoanPayment: processingInformationRecurringOptionsLoanPayment,
38+
FirstRecurringPayment: processingInformationRecurringOptionsFirstRecurringPayment
39+
);
40+
41+
Ptsv2paymentsProcessingInformation processingInformation = new Ptsv2paymentsProcessingInformation(
42+
Capture: processingInformationCapture,
43+
CommerceIndicator: processingInformationCommerceIndicator,
44+
AuthorizationOptions: processingInformationAuthorizationOptions,
45+
RecurringOptions: processingInformationRecurringOptions
46+
);
47+
48+
string paymentInformationCardNumber = "4111111111111111";
49+
string paymentInformationCardExpirationMonth = "12";
50+
string paymentInformationCardExpirationYear = "2031";
51+
Ptsv2paymentsPaymentInformationCard paymentInformationCard = new Ptsv2paymentsPaymentInformationCard(
52+
Number: paymentInformationCardNumber,
53+
ExpirationMonth: paymentInformationCardExpirationMonth,
54+
ExpirationYear: paymentInformationCardExpirationYear
55+
);
56+
57+
Ptsv2paymentsPaymentInformation paymentInformation = new Ptsv2paymentsPaymentInformation(
58+
Card: paymentInformationCard
59+
);
60+
61+
string orderInformationAmountDetailsTotalAmount = "102.21";
62+
string orderInformationAmountDetailsCurrency = "GBP";
63+
Ptsv2paymentsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsOrderInformationAmountDetails(
64+
TotalAmount: orderInformationAmountDetailsTotalAmount,
65+
Currency: orderInformationAmountDetailsCurrency
66+
);
67+
68+
string orderInformationBillToFirstName = "John";
69+
string orderInformationBillToLastName = "Doe";
70+
string orderInformationBillToAddress1 = "1 Market St";
71+
string orderInformationBillToLocality = "san francisco";
72+
string orderInformationBillToAdministrativeArea = "CA";
73+
string orderInformationBillToPostalCode = "94105";
74+
string orderInformationBillToCountry = "US";
75+
string orderInformationBillToEmail = "[email protected]";
76+
string orderInformationBillToPhoneNumber = "4158880000";
77+
Ptsv2paymentsOrderInformationBillTo orderInformationBillTo = new Ptsv2paymentsOrderInformationBillTo(
78+
FirstName: orderInformationBillToFirstName,
79+
LastName: orderInformationBillToLastName,
80+
Address1: orderInformationBillToAddress1,
81+
Locality: orderInformationBillToLocality,
82+
AdministrativeArea: orderInformationBillToAdministrativeArea,
83+
PostalCode: orderInformationBillToPostalCode,
84+
Country: orderInformationBillToCountry,
85+
Email: orderInformationBillToEmail,
86+
PhoneNumber: orderInformationBillToPhoneNumber
87+
);
88+
89+
Ptsv2paymentsOrderInformation orderInformation = new Ptsv2paymentsOrderInformation(
90+
AmountDetails: orderInformationAmountDetails,
91+
BillTo: orderInformationBillTo
92+
);
93+
94+
string consumerAuthenticationInformationCavv = "EHuWW9PiBkWvqE5juRwDzAUFBAk=";
95+
Ptsv2paymentsConsumerAuthenticationInformation consumerAuthenticationInformation = new Ptsv2paymentsConsumerAuthenticationInformation(
96+
Cavv: consumerAuthenticationInformationCavv
97+
);
98+
99+
var requestObj = new CreatePaymentRequest(
100+
ClientReferenceInformation: clientReferenceInformation,
101+
ProcessingInformation: processingInformation,
102+
PaymentInformation: paymentInformation,
103+
OrderInformation: orderInformation,
104+
ConsumerAuthenticationInformation: consumerAuthenticationInformation
105+
);
106+
107+
try
108+
{
109+
var configDictionary = new Configuration().GetConfiguration();
110+
var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary);
111+
112+
var apiInstance = new PaymentsApi(clientConfig);
113+
PtsV2PaymentsPost201Response result = apiInstance.CreatePayment(requestObj);
114+
Console.WriteLine(result);
115+
return result;
116+
}
117+
catch (Exception e)
118+
{
119+
Console.WriteLine("Exception on calling the API : " + e.Message);
120+
return null;
121+
}
122+
}
123+
}
124+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Globalization;
4+
5+
using CyberSource.Api;
6+
using CyberSource.Model;
7+
8+
namespace Cybersource_rest_samples_dotnet.Samples.Payments
9+
{
10+
public class CITPlacingCredentialOnFile
11+
{
12+
public static PtsV2PaymentsPost201Response Run()
13+
{
14+
string clientReferenceInformationCode = "TC50171_3";
15+
Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
16+
Code: clientReferenceInformationCode
17+
);
18+
19+
bool processingInformationCapture = false;
20+
string processingInformationCommerceIndicator = "vbv";
21+
bool processingInformationAuthorizationOptionsIgnoreAvsResult = false;
22+
bool processingInformationAuthorizationOptionsIgnoreCvResult = false;
23+
bool processingInformationAuthorizationOptionsInitiatorCredentialStoredOnFile = true;
24+
Ptsv2paymentsProcessingInformationAuthorizationOptionsInitiator processingInformationAuthorizationOptionsInitiator = new Ptsv2paymentsProcessingInformationAuthorizationOptionsInitiator(
25+
CredentialStoredOnFile: processingInformationAuthorizationOptionsInitiatorCredentialStoredOnFile
26+
);
27+
28+
Ptsv2paymentsProcessingInformationAuthorizationOptions processingInformationAuthorizationOptions = new Ptsv2paymentsProcessingInformationAuthorizationOptions(
29+
IgnoreAvsResult: processingInformationAuthorizationOptionsIgnoreAvsResult,
30+
IgnoreCvResult: processingInformationAuthorizationOptionsIgnoreCvResult,
31+
Initiator: processingInformationAuthorizationOptionsInitiator
32+
);
33+
34+
Ptsv2paymentsProcessingInformation processingInformation = new Ptsv2paymentsProcessingInformation(
35+
Capture: processingInformationCapture,
36+
CommerceIndicator: processingInformationCommerceIndicator,
37+
AuthorizationOptions: processingInformationAuthorizationOptions
38+
);
39+
40+
string paymentInformationCardNumber = "4111111111111111";
41+
string paymentInformationCardExpirationMonth = "12";
42+
string paymentInformationCardExpirationYear = "2031";
43+
Ptsv2paymentsPaymentInformationCard paymentInformationCard = new Ptsv2paymentsPaymentInformationCard(
44+
Number: paymentInformationCardNumber,
45+
ExpirationMonth: paymentInformationCardExpirationMonth,
46+
ExpirationYear: paymentInformationCardExpirationYear
47+
);
48+
49+
Ptsv2paymentsPaymentInformation paymentInformation = new Ptsv2paymentsPaymentInformation(
50+
Card: paymentInformationCard
51+
);
52+
53+
string orderInformationAmountDetailsTotalAmount = "102.21";
54+
string orderInformationAmountDetailsCurrency = "GBP";
55+
Ptsv2paymentsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsOrderInformationAmountDetails(
56+
TotalAmount: orderInformationAmountDetailsTotalAmount,
57+
Currency: orderInformationAmountDetailsCurrency
58+
);
59+
60+
string orderInformationBillToFirstName = "John";
61+
string orderInformationBillToLastName = "Doe";
62+
string orderInformationBillToAddress1 = "1 Market St";
63+
string orderInformationBillToLocality = "san francisco";
64+
string orderInformationBillToAdministrativeArea = "CA";
65+
string orderInformationBillToPostalCode = "94105";
66+
string orderInformationBillToCountry = "US";
67+
string orderInformationBillToEmail = "[email protected]";
68+
string orderInformationBillToPhoneNumber = "4158880000";
69+
Ptsv2paymentsOrderInformationBillTo orderInformationBillTo = new Ptsv2paymentsOrderInformationBillTo(
70+
FirstName: orderInformationBillToFirstName,
71+
LastName: orderInformationBillToLastName,
72+
Address1: orderInformationBillToAddress1,
73+
Locality: orderInformationBillToLocality,
74+
AdministrativeArea: orderInformationBillToAdministrativeArea,
75+
PostalCode: orderInformationBillToPostalCode,
76+
Country: orderInformationBillToCountry,
77+
Email: orderInformationBillToEmail,
78+
PhoneNumber: orderInformationBillToPhoneNumber
79+
);
80+
81+
Ptsv2paymentsOrderInformation orderInformation = new Ptsv2paymentsOrderInformation(
82+
AmountDetails: orderInformationAmountDetails,
83+
BillTo: orderInformationBillTo
84+
);
85+
86+
string consumerAuthenticationInformationCavv = "EHuWW9PiBkWvqE5juRwDzAUFBAk=";
87+
Ptsv2paymentsConsumerAuthenticationInformation consumerAuthenticationInformation = new Ptsv2paymentsConsumerAuthenticationInformation(
88+
Cavv: consumerAuthenticationInformationCavv
89+
);
90+
91+
var requestObj = new CreatePaymentRequest(
92+
ClientReferenceInformation: clientReferenceInformation,
93+
ProcessingInformation: processingInformation,
94+
PaymentInformation: paymentInformation,
95+
OrderInformation: orderInformation,
96+
ConsumerAuthenticationInformation: consumerAuthenticationInformation
97+
);
98+
99+
try
100+
{
101+
var configDictionary = new Configuration().GetConfiguration();
102+
var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary);
103+
104+
var apiInstance = new PaymentsApi(clientConfig);
105+
PtsV2PaymentsPost201Response result = apiInstance.CreatePayment(requestObj);
106+
Console.WriteLine(result);
107+
return result;
108+
}
109+
catch (Exception e)
110+
{
111+
Console.WriteLine("Exception on calling the API : " + e.Message);
112+
return null;
113+
}
114+
}
115+
}
116+
}

0 commit comments

Comments
 (0)