Skip to content

Commit b552aa4

Browse files
committed
Merge branch 'master' of https://github.com/CyberSource/cybersource-rest-samples-csharp into folder-restructure
# Conflicts: # src/SampleCode.csproj # src/Samples/Payments/ServiceFees/CreditWithServiceFee.cs # src/Samples/Payments/ServiceFees/ECheckStandaloneCreditWithServiceFee.cs # src/Samples/Payouts/CoreServices/ProcessPayout.cs # src/Samples/Reporting/CoreServices/GetReportingResourceInformation.cs # src/Samples/RiskManagement/CoreServices/DecisionProfileReject.cs # src/Samples/SecureFileShare/CoreServices/GetListOfFiles.cs # src/Samples/SecureFileShare/DownloadFileWithFileIdentifier.cs
2 parents 3cb39a0 + 8ba5619 commit b552aa4

File tree

7 files changed

+429
-1
lines changed

7 files changed

+429
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using CyberSource.Model;
7+
using CyberSource.Api;
8+
9+
namespace Cybersource_rest_samples_dotnet.Samples.Payments.ServiceFees
10+
{
11+
public class CreditWithServiceFee
12+
{
13+
public static PtsV2CreditsPost201Response Run()
14+
{
15+
var requestObj = new CreateCreditRequest();
16+
17+
var v2PaymentsClientReferenceInformationObj = new Ptsv2paymentsClientReferenceInformation
18+
{
19+
Code = "12345678"
20+
};
21+
22+
requestObj.ClientReferenceInformation = v2PaymentsClientReferenceInformationObj;
23+
24+
var v2PaymentsOrderInformationObj = new Ptsv2paymentsidrefundsOrderInformation();
25+
var v2PaymentsOrderInformationBillToObj = new Ptsv2paymentsidcapturesOrderInformationBillTo
26+
{
27+
Country = "US",
28+
FirstName = "John",
29+
LastName = "Doe",
30+
PhoneNumber = "4158880000",
31+
Address1 = "1 Market St",
32+
PostalCode = "94105",
33+
Locality = "san francisco",
34+
AdministrativeArea = "CA",
35+
36+
};
37+
v2PaymentsOrderInformationObj.BillTo = v2PaymentsOrderInformationBillToObj;
38+
39+
var v2PaymentsOrderInformationAmountDetailsObj = new Ptsv2paymentsidcapturesOrderInformationAmountDetails
40+
{
41+
TotalAmount = "2325.00",
42+
Currency = "usd",
43+
ServiceFeeAmount = "30.00"
44+
};
45+
46+
v2PaymentsOrderInformationObj.AmountDetails = v2PaymentsOrderInformationAmountDetailsObj;
47+
48+
requestObj.OrderInformation = v2PaymentsOrderInformationObj;
49+
50+
var v2PaymentsPaymentInformationObj = new Ptsv2paymentsidrefundsPaymentInformation();
51+
52+
var v2PaymentsPaymentInformationCardObj = new Ptsv2paymentsidrefundsPaymentInformationCard
53+
{
54+
ExpirationYear = "2031",
55+
Number = "4111111111111111",
56+
ExpirationMonth = "03"
57+
};
58+
59+
v2PaymentsPaymentInformationObj.Card = v2PaymentsPaymentInformationCardObj;
60+
61+
requestObj.PaymentInformation = v2PaymentsPaymentInformationObj;
62+
63+
try
64+
{
65+
var configDictionary = new Configuration().GetConfiguration();
66+
var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary);
67+
var apiInstance = new CreditApi(clientConfig);
68+
69+
var result = apiInstance.CreateCredit(requestObj);
70+
Console.WriteLine(result);
71+
return result;
72+
}
73+
catch (Exception e)
74+
{
75+
Console.WriteLine("Exception on calling the API: " + e.Message);
76+
return null;
77+
}
78+
}
79+
}
80+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using CyberSource.Api;
7+
using CyberSource.Model;
8+
9+
namespace Cybersource_rest_samples_dotnet.Samples.Payments.ServiceFees
10+
{
11+
public class ECheckStandaloneCreditWithServiceFee
12+
{
13+
public static PtsV2CreditsPost201Response Run()
14+
{
15+
var requestObj = new CreateCreditRequest();
16+
17+
var v2PaymentsClientReferenceInformationObj = new Ptsv2paymentsClientReferenceInformation
18+
{
19+
Code = "TC46125-1"
20+
};
21+
requestObj.ClientReferenceInformation = v2PaymentsClientReferenceInformationObj;
22+
var processingInformation = new Ptsv2creditsProcessingInformation
23+
{
24+
CommerceIndicator = "internet"
25+
};
26+
requestObj.ProcessingInformation = processingInformation;
27+
28+
var v2PaymentsOrderInformationObj = new Ptsv2paymentsidrefundsOrderInformation();
29+
var v2PaymentsOrderInformationBillToObj = new Ptsv2paymentsidcapturesOrderInformationBillTo
30+
{
31+
Country = "US",
32+
FirstName = "John",
33+
LastName = "Doe",
34+
PhoneNumber = "4158880000",
35+
Address1 = "1 Market St",
36+
PostalCode = "94105",
37+
Locality = "san francisco",
38+
AdministrativeArea = "CA",
39+
40+
};
41+
v2PaymentsOrderInformationObj.BillTo = v2PaymentsOrderInformationBillToObj;
42+
43+
var v2PaymentsOrderInformationAmountDetailsObj = new Ptsv2paymentsidcapturesOrderInformationAmountDetails
44+
{
45+
TotalAmount = "2325.00",
46+
Currency = "usd",
47+
ServiceFeeAmount = "30.00"
48+
};
49+
50+
v2PaymentsOrderInformationObj.AmountDetails = v2PaymentsOrderInformationAmountDetailsObj;
51+
52+
requestObj.OrderInformation = v2PaymentsOrderInformationObj;
53+
54+
var v2PaymentsPaymentInformationObj = new Ptsv2paymentsidrefundsPaymentInformation();
55+
var v2paymentsPaymentInformationBankAccountObj = new Ptsv2paymentsPaymentInformationBankAccount
56+
{
57+
Number = "4100",
58+
Type = "C",
59+
CheckNumber = "123456"
60+
};
61+
var v2paymentsPaymentInformationBankObj = new Ptsv2paymentsPaymentInformationBank
62+
{
63+
RoutingNumber = "071923284"
64+
};
65+
v2paymentsPaymentInformationBankObj.Account = v2paymentsPaymentInformationBankAccountObj;
66+
v2PaymentsPaymentInformationObj.Bank = v2paymentsPaymentInformationBankObj;
67+
requestObj.PaymentInformation = v2PaymentsPaymentInformationObj;
68+
69+
try
70+
{
71+
var configDictionary = new Configuration().GetConfiguration();
72+
var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary);
73+
var apiInstance = new CreditApi(clientConfig);
74+
75+
var result = apiInstance.CreateCredit(requestObj);
76+
Console.WriteLine(result);
77+
return result;
78+
}
79+
catch (Exception e)
80+
{
81+
Console.WriteLine("Exception on calling the API: " + e.Message);
82+
return null;
83+
}
84+
}
85+
}
86+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
using System;
2+
using CyberSource.Api;
3+
using CyberSource.Model;
4+
5+
namespace Cybersource_rest_samples_dotnet.Samples.Payouts.CoreServices
6+
{
7+
public class ProcessPayout
8+
{
9+
public static void Run()
10+
{
11+
var requestObj = new OctCreatePaymentRequest();
12+
13+
var clientReferenceInformationObj = new Ptsv2payoutsClientReferenceInformation
14+
{
15+
Code = "33557799"
16+
};
17+
18+
requestObj.ClientReferenceInformation = clientReferenceInformationObj;
19+
20+
var senderInformationObj = new Ptsv2payoutsSenderInformation
21+
{
22+
ReferenceNumber = "1234567890",
23+
Address1 = "900 Metro Center Blvd.900",
24+
CountryCode = "US",
25+
Locality = "San Francisco",
26+
Name = "Thomas Jefferson",
27+
AdministrativeArea = "CA"
28+
};
29+
30+
var accountObj = new Ptsv2payoutsSenderInformationAccount
31+
{
32+
Number = "1234567890123456789012345678901234",
33+
FundsSource = "01"
34+
};
35+
36+
senderInformationObj.Account = accountObj;
37+
38+
requestObj.SenderInformation = senderInformationObj;
39+
40+
var processingInformationObj = new Ptsv2payoutsProcessingInformation
41+
{
42+
CommerceIndicator = "internet",
43+
BusinessApplicationId = "FD",
44+
NetworkRoutingOrder = "ECG"
45+
};
46+
47+
requestObj.ProcessingInformation = processingInformationObj;
48+
49+
var orderInformationObj = new Ptsv2payoutsOrderInformation();
50+
51+
var amountDetailsObj = new Ptsv2payoutsOrderInformationAmountDetails
52+
{
53+
TotalAmount = "100.00",
54+
Currency = "USD"
55+
};
56+
57+
orderInformationObj.AmountDetails = amountDetailsObj;
58+
59+
requestObj.OrderInformation = orderInformationObj;
60+
61+
var merchantInformationObj = new Ptsv2payoutsMerchantInformation
62+
{
63+
CategoryCode = 123
64+
};
65+
66+
var merchantDescriptorObj = new Ptsv2payoutsMerchantInformationMerchantDescriptor
67+
{
68+
Country = "US",
69+
PostalCode = "94440",
70+
Locality = "FC",
71+
Name = "Thomas",
72+
AdministrativeArea = "CA"
73+
};
74+
75+
merchantInformationObj.MerchantDescriptor = merchantDescriptorObj;
76+
77+
requestObj.MerchantInformation = merchantInformationObj;
78+
79+
var paymentInformationObj = new Ptsv2payoutsPaymentInformation();
80+
81+
var cardObj = new Ptsv2payoutsPaymentInformationCard
82+
{
83+
ExpirationYear = "2025",
84+
Number = "4111111111111111",
85+
ExpirationMonth = "12",
86+
Type = "001",
87+
SourceAccountType = "CH"
88+
};
89+
90+
paymentInformationObj.Card = cardObj;
91+
92+
requestObj.PaymentInformation = paymentInformationObj;
93+
94+
var recipientInformationObj = new Ptsv2payoutsRecipientInformation
95+
{
96+
FirstName = "John",
97+
LastName = "Doe",
98+
Address1 = "Paseo Padre Boulevard",
99+
Locality = "San Francisco",
100+
AdministrativeArea = "CA",
101+
PostalCode = "94400",
102+
PhoneNumber = "6504320556",
103+
DateOfBirth = "19801009",
104+
Country = "US"
105+
};
106+
107+
requestObj.RecipientInformation = recipientInformationObj;
108+
109+
try
110+
{
111+
var configDictionary = new Configuration().GetConfiguration();
112+
var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary);
113+
var apiInstance = new PayoutsApi(clientConfig);
114+
115+
var result = apiInstance.OctCreatePaymentWithHttpInfo(requestObj);
116+
Console.WriteLine(result);
117+
}
118+
catch (Exception e)
119+
{
120+
Console.WriteLine("Exception on calling the API: " + e.Message);
121+
}
122+
}
123+
}
124+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System;
2+
using CyberSource.Api;
3+
4+
namespace Cybersource_rest_samples_dotnet.Samples.Reporting.CoreServices
5+
{
6+
public class GetReportingResourceInformation
7+
{
8+
public static void Run()
9+
{
10+
const string organizationId = "testrest";
11+
12+
try
13+
{
14+
var configDictionary = new Configuration().GetConfiguration();
15+
var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary);
16+
var apiInstance = new ReportDefinitionsApi(clientConfig);
17+
18+
var result = apiInstance.GetResourceV2Info(organizationId: organizationId);
19+
Console.WriteLine(result);
20+
}
21+
catch (Exception e)
22+
{
23+
Console.WriteLine("Exception on calling the API: " + e.Message);
24+
}
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)