Skip to content

Commit 219e9b5

Browse files
committed
Update to latest version of SDK
1 parent 55c5e8e commit 219e9b5

File tree

11 files changed

+24
-118
lines changed

11 files changed

+24
-118
lines changed

Source/Configuration.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
using System.Collections.Generic;
2-
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
35
namespace Cybersource_rest_samples_dotnet
46
{
57
public class Configuration
@@ -13,7 +15,7 @@ public Dictionary<string, string> GetConfiguration()
1315
_configurationDictionary.Add("merchantID", "testrest");
1416
_configurationDictionary.Add("merchantsecretKey", "yBJxy6LjM2TmcPGu+GaJrHtkke25fPpUX+UY6/L/1tE=");
1517
_configurationDictionary.Add("merchantKeyId", "08c94330-f618-42a3-b09d-e1e43be5efda");
16-
_configurationDictionary.Add("keysDirectory", "Source\\Resource");
18+
_configurationDictionary.Add("keysDirectory", Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\Source\\Resource"));
1719
_configurationDictionary.Add("keyFilename", "testrest");
1820
_configurationDictionary.Add("runEnvironment", "apitest.cybersource.com");
1921
_configurationDictionary.Add("keyAlias", "testrest");
@@ -45,7 +47,7 @@ public Dictionary<string, string> GetAlternativeConfiguration()
4547
_configurationDictionary.Add("merchantID", "testrest_cpctv");
4648
_configurationDictionary.Add("merchantsecretKey", "JXm4dqKYIxWofM1TIbtYY9HuYo7Cg1HPHxn29f6waRo=");
4749
_configurationDictionary.Add("merchantKeyId", "e547c3d3-16e4-444c-9313-2a08784b906a");
48-
_configurationDictionary.Add("keysDirectory", "Resource");
50+
_configurationDictionary.Add("keysDirectory", Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\Source\\Resource"));
4951
_configurationDictionary.Add("keyFilename", "testrest_cpctv");
5052
_configurationDictionary.Add("runEnvironment", "apitest.cybersource.com");
5153
_configurationDictionary.Add("keyAlias", "testrest_cpctv");

Source/Resource/jwsToken.txt

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Q25NJkZl7d2lDtAbyyMeZGafFsUzQwy8UUQ1SdpwPwo5WyIcYxMu-yMnqhLNugh_JkFvnAtlYdfbbt58QkctIky3U4vebQY10S2B2W5xGasaOsaLQDd8TC2Grp3CdmaUy1XjA8k5Yu336QXKToi9_tWYgBfX2TMP8NIuk8twqXdgeIsg6zhxvjU9Db1gf6sbfoUIm4cYivkG2uffuNTN31lG2zoE2GhPEM3xugMU5Hs9XjlCRyQ

Source/Samples/Authentication/CallHttpMethods/PostMethod.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.IO;
23
using ApiSdk.controller;
34
using AuthenticationSdk.core;
45
using AuthenticationSdk.util;
@@ -11,7 +12,7 @@ public class PostMethod
1112
// POST Request to Authorize the payment for a transaction.
1213
// Transaction details provided in the JSON File are sent along with the Request as Request Body
1314
private const string RequestTarget = "/pts/v2/payments/";
14-
private const string RequestJsonFilePath = "../../../Source/Resource/request_payments.json";
15+
private static string RequestJsonFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "../../../Source/Resource/request_payments.json").ToString();
1516

1617
public static void Run()
1718
{

Source/Samples/Authentication/CallHttpMethods/PutMethod.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.IO;
23
using ApiSdk.controller;
34
using AuthenticationSdk.core;
45
using AuthenticationSdk.util;
@@ -12,7 +13,7 @@ public class PutMethod
1213
// Report Details provided in the JSON File are sent along with the Request as Request Body
1314
// Below request subscribes 'TRR Report' for Organization ID: testrest
1415
private const string RequestTarget = "/reporting/v2/reportSubscriptions/TRRReport?organizationId=testrest";
15-
private const string RequestJsonFilePath = "../../../Source/Resource/TRRReport.json";
16+
private static string RequestJsonFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "../../../Source/Resource/TRRReport.json");
1617

1718
public static void Run()
1819
{

Source/Samples/Authentication/GenerateHttpRequestHeaders/PostGenerateHeaders.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.IO;
23
using AuthenticationSdk.core;
34
using AuthenticationSdk.util;
45
using SampleCode.data;
@@ -10,7 +11,7 @@ public class PostGenerateHeaders
1011
// POST Request to Authorize the payment for a transaction.
1112
// Transaction details provided in the JSON File are sent along with the Request as Request Body
1213
private const string RequestTarget = "/pts/v2/payments";
13-
private const string RequestJsonFilePath = "../../../Source/Resource/request_payments.json";
14+
private static string RequestJsonFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "../../../Source/Resource/request_payments.json");
1415

1516
public static void Run()
1617
{

Source/Samples/Authentication/StandAloneJWT.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public static string GenerateJWT(string request, string method)
181181
Console.WriteLine("\tJWT BODY : " + jwtBody);
182182

183183
// P12 certificate public key is sent in the header and the private key is used to sign the token
184-
X509Certificate2 x5Cert = new X509Certificate2(Path.Combine($"../../../Source/Resource", $"testrest.p12"), merchantID, X509KeyStorageFlags.MachineKeySet);
184+
X509Certificate2 x5Cert = new X509Certificate2(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"../../../Source/Resource", $"testrest.p12"), merchantID, X509KeyStorageFlags.MachineKeySet);
185185

186186
// Extracting Public Key from .p12 file
187187
string x5cPublicKey = Convert.ToBase64String(x5Cert.RawData);
@@ -223,7 +223,7 @@ public static string GenerateJWT(string request, string method)
223223
token = Jose.JWT.Encode(jwtBody, privateKey, Jose.JwsAlgorithm.RS256, cybsHeaders);
224224

225225
// Writing Generated Token to file.
226-
File.WriteAllText(Path.Combine($"../../../Source/Resource", $"jwsToken.txt"), token);
226+
File.WriteAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"../../../Source/Resource", $"jwsToken.txt"), token);
227227
}
228228
catch (Exception ex)
229229
{

Source/Samples/Authentication/StandAloneOAuth.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using CyberSource.Model;
44
using CyberSource.Api;
5+
using System.IO;
56

67
namespace Cybersource_rest_samples_dotnet.Samples.Authentication
78
{
@@ -16,7 +17,7 @@ private static Dictionary<string, string> GetConfiguration()
1617

1718
// Configs related to OAuth
1819
_configDictionary.Add("enableClientCert", "true");
19-
_configDictionary.Add("clientCertDirectory", "Source\\Resource");
20+
_configDictionary.Add("clientCertDirectory", Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Source\\Resource"));
2021
_configDictionary.Add("clientCertFile", "");
2122
_configDictionary.Add("clientCertPassword", "");
2223
_configDictionary.Add("clientId", "");

Source/Samples/Payments/Credit/ElectronicCheckStandAloneCredits.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static PtsV2CreditsPost201Response Run()
2626
);
2727

2828
string paymentInformationBankRoutingNumber = "071923284";
29-
Ptsv2paymentsPaymentInformationBank paymentInformationBank = new Ptsv2paymentsPaymentInformationBank(
29+
Ptsv2paymentsidrefundsPaymentInformationBank paymentInformationBank = new Ptsv2paymentsidrefundsPaymentInformationBank(
3030
Account: paymentInformationBankAccount,
3131
RoutingNumber: paymentInformationBankRoutingNumber
3232
);

Source/Samples/Payments/Payments/ParallelAuth.cs

Lines changed: 0 additions & 100 deletions
This file was deleted.

cybersource-rest-samples-csharp.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@
3737
<SpecificVersion>False</SpecificVersion>
3838
<HintPath>Source\lib\net461\ApiSdk.dll</HintPath>
3939
</Reference>
40-
<Reference Include="AuthenticationSdk, Version=0.0.0.11, Culture=neutral, processorArchitecture=MSIL">
40+
<Reference Include="AuthenticationSdk">
4141
<SpecificVersion>False</SpecificVersion>
42-
<HintPath>packages\CyberSource.Authentication.0.0.0.11\lib\AuthenticationSdk.dll</HintPath>
42+
<HintPath>packages\CyberSource.Authentication.0.0.0.12\lib\AuthenticationSdk.dll</HintPath>
4343
</Reference>
44-
<Reference Include="cybersource-rest-client-dotnet, Version=0.0.1.18, Culture=neutral, processorArchitecture=MSIL">
44+
<Reference Include="cybersource-rest-client-dotnet">
4545
<SpecificVersion>False</SpecificVersion>
46-
<HintPath>packages\CyberSource.Rest.Client.0.0.1.18\lib\cybersource-rest-client-dotnet.dll</HintPath>
46+
<HintPath>packages\CyberSource.Rest.Client.0.0.1.19\lib\cybersource-rest-client-dotnet.dll</HintPath>
4747
</Reference>
4848
<Reference Include="jose-jwt">
4949
<HintPath>packages\jose-jwt.2.4.0\lib\net461\jose-jwt.dll</HintPath>

0 commit comments

Comments
 (0)