-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathPayoutToken.cs
134 lines (119 loc) · 6.7 KB
/
PayoutToken.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
using System;
using System.Collections.Generic;
using System.Globalization;
using CyberSource.Api;
using CyberSource.Model;
namespace Cybersource_rest_samples_dotnet.Samples.Payouts
{
public class PayoutToken
{
public static PtsV2PayoutsPost201Response Run()
{
string clientReferenceInformationCode = "111111113";
Ptsv2payoutsClientReferenceInformation clientReferenceInformation = new Ptsv2payoutsClientReferenceInformation(
Code: clientReferenceInformationCode
);
string orderInformationAmountDetailsTotalAmount = "111.00";
string orderInformationAmountDetailsCurrency = "USD";
Ptsv2payoutsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2payoutsOrderInformationAmountDetails(
TotalAmount: orderInformationAmountDetailsTotalAmount,
Currency: orderInformationAmountDetailsCurrency
);
Ptsv2payoutsOrderInformation orderInformation = new Ptsv2payoutsOrderInformation(
AmountDetails: orderInformationAmountDetails
);
string merchantInformationMerchantDescriptorName = "Sending Company Name";
string merchantInformationMerchantDescriptorLocality = "FC";
string merchantInformationMerchantDescriptorCountry = "US";
string merchantInformationMerchantDescriptorAdministrativeArea = "CA";
string merchantInformationMerchantDescriptorPostalCode = "94440";
Ptsv2payoutsMerchantInformationMerchantDescriptor merchantInformationMerchantDescriptor = new Ptsv2payoutsMerchantInformationMerchantDescriptor(
Name: merchantInformationMerchantDescriptorName,
Locality: merchantInformationMerchantDescriptorLocality,
Country: merchantInformationMerchantDescriptorCountry,
AdministrativeArea: merchantInformationMerchantDescriptorAdministrativeArea,
PostalCode: merchantInformationMerchantDescriptorPostalCode
);
Ptsv2payoutsMerchantInformation merchantInformation = new Ptsv2payoutsMerchantInformation(
MerchantDescriptor: merchantInformationMerchantDescriptor
);
string recipientInformationFirstName = "John";
string recipientInformationLastName = "Doe";
string recipientInformationAddress1 = "Paseo Padre Boulevard";
string recipientInformationLocality = "Foster City";
string recipientInformationAdministrativeArea = "CA";
string recipientInformationCountry = "US";
string recipientInformationPostalCode = "94400";
string recipientInformationPhoneNumber = "6504320556";
Ptsv2payoutsRecipientInformation recipientInformation = new Ptsv2payoutsRecipientInformation(
FirstName: recipientInformationFirstName,
LastName: recipientInformationLastName,
Address1: recipientInformationAddress1,
Locality: recipientInformationLocality,
AdministrativeArea: recipientInformationAdministrativeArea,
Country: recipientInformationCountry,
PostalCode: recipientInformationPostalCode,
PhoneNumber: recipientInformationPhoneNumber
);
string senderInformationReferenceNumber = "1234567890";
string senderInformationAccountFundsSource = "05";
string senderInformationAccountNumber = "1234567890123456789012345678901234";
Ptsv2payoutsSenderInformationAccount senderInformationAccount = new Ptsv2payoutsSenderInformationAccount(
FundsSource: senderInformationAccountFundsSource,
Number: senderInformationAccountNumber
);
string senderInformationName = "Company Name";
string senderInformationAddress1 = "900 Metro Center Blvd.900";
string senderInformationLocality = "Foster City";
string senderInformationAdministrativeArea = "CA";
string senderInformationCountryCode = "US";
Ptsv2payoutsSenderInformation senderInformation = new Ptsv2payoutsSenderInformation(
ReferenceNumber: senderInformationReferenceNumber,
Account: senderInformationAccount,
Name: senderInformationName,
Address1: senderInformationAddress1,
Locality: senderInformationLocality,
AdministrativeArea: senderInformationAdministrativeArea,
CountryCode: senderInformationCountryCode
);
string processingInformationBusinessApplicationId = "FD";
string processingInformationNetworkRoutingOrder = "V8";
string processingInformationCommerceIndicator = "internet";
Ptsv2payoutsProcessingInformation processingInformation = new Ptsv2payoutsProcessingInformation(
BusinessApplicationId: processingInformationBusinessApplicationId,
NetworkRoutingOrder: processingInformationNetworkRoutingOrder,
CommerceIndicator: processingInformationCommerceIndicator
);
string paymentInformationCustomerCustomerId = "7500BB199B4270EFE05340588D0AFCAD";
Ptsv2paymentsPaymentInformationCustomer paymentInformationCustomer = new Ptsv2paymentsPaymentInformationCustomer(
CustomerId: paymentInformationCustomerCustomerId
);
Ptsv2payoutsPaymentInformation paymentInformation = new Ptsv2payoutsPaymentInformation(
Customer: paymentInformationCustomer
);
var requestObj = new OctCreatePaymentRequest(
ClientReferenceInformation: clientReferenceInformation,
OrderInformation: orderInformation,
MerchantInformation: merchantInformation,
RecipientInformation: recipientInformation,
SenderInformation: senderInformation,
ProcessingInformation: processingInformation,
PaymentInformation: paymentInformation
);
try
{
var configDictionary = new Configuration().GetConfiguration();
var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary);
var apiInstance = new PayoutsApi(clientConfig);
PtsV2PayoutsPost201Response result = apiInstance.OctCreatePayment(requestObj);
Console.WriteLine(result);
return result;
}
catch (Exception e)
{
Console.WriteLine("Exception on calling the API : " + e.Message);
return null;
}
}
}
}