├── .gitignore ├── .travis.yml ├── Logging_Net461.md ├── Logging_NetCore.md ├── NLog.config ├── NLog.xsd ├── README.md ├── README_Net461.md ├── README_NetCore.md ├── Source ├── Api.cs ├── AuthenticationData │ ├── Configuration.cs │ └── RequestData.cs ├── Configuration.cs ├── ConfigurationWithMLE.cs ├── MerchantBoardingConfiguration.cs ├── Properties │ └── AssemblyInfo.cs ├── Resource │ ├── AuthTRRReport.json │ ├── DownloadReport.csv │ ├── DownloadedFileWithFileID.csv │ ├── NetworkTokenCert.pem │ ├── NumericUtility.cs │ ├── TRRReport.json │ ├── jwsToken.txt │ ├── mcb_test_merch.p12 │ ├── request_captures.json │ ├── request_payments.json │ ├── request_refund.json │ ├── request_reversals.json │ ├── request_void.json │ ├── signatureHeaderValue.txt │ ├── testrest.p12 │ └── testrest_cpctv.p12 ├── SampleCode.cs ├── Samples │ ├── AccountUpdater │ │ ├── AmexRegistrationCustomerTokenBatch.cs │ │ ├── AmexRegistrationInstrumentIdentifierTokenBatch.cs │ │ ├── ListBatches.cs │ │ ├── OneOffVisaMasterCardCustomerTokenBatch.cs │ │ ├── OneOffVisaMasterCardInstrumentIdentifierTokenBatch.cs │ │ ├── RetrieveBatchReport.cs │ │ └── RetrieveBatchStatus.cs │ ├── Authentication │ │ ├── CallHttpMethods │ │ │ ├── DeleteMethod.cs │ │ │ ├── GetMethod.cs │ │ │ ├── GetObjectMethod.cs │ │ │ ├── PostMethod.cs │ │ │ ├── PostObjectMethod.cs │ │ │ └── PutMethod.cs │ │ ├── GenerateHttpRequestHeaders │ │ │ ├── DeleteGenerateHeaders.cs │ │ │ ├── GetGenerateHeaders.cs │ │ │ ├── PostGenerateHeaders.cs │ │ │ └── PutGenerateHeaders.cs │ │ ├── StandAloneHttpSignature.cs │ │ ├── StandAloneJWT.cs │ │ ├── StandAloneMetaKey.cs │ │ └── StandAloneOAuth.cs │ ├── AzureIntermediateTesting │ │ └── SampleTestingForAzureIntermediateHost.cs │ ├── BinLookup │ │ ├── BINLookupWithCard.cs │ │ ├── BINLookupWithHealthcareCard.cs │ │ ├── BINLookupWithNetworkToken.cs │ │ ├── BINLookupWithTMSCustomerID.cs │ │ ├── BINLookupWithTMSInstrumentIdentifier.cs │ │ ├── BINLookupWithTMSJWTTransientToken.cs │ │ ├── BINLookupWithTMSJtiTransientToken.cs │ │ └── BINLookupWithTMSPaymentInstrument.cs │ ├── FlexMicroform │ │ ├── FlexTokenizeCard.cs │ │ ├── GenerateCaptureContext.cs │ │ ├── GenerateCaptureContextAcceptCard.cs │ │ ├── GenerateCaptureContextAcceptCheck.cs │ │ ├── GenerateKey.cs │ │ └── GenerateKeyLegacyTokenFormat.cs │ ├── Invoicing │ │ ├── InvoiceSettings │ │ │ ├── GetInvoiceSettings.cs │ │ │ └── UpdateInvoiceSettings.cs │ │ └── Invoices │ │ │ ├── CancelInvoice.cs │ │ │ ├── CreateAndSendInvoiceImmediately.cs │ │ │ ├── CreateDraftInvoice.cs │ │ │ ├── CreateInvoiceAndAssignItSpecificInvoiceNumber.cs │ │ │ ├── CreateInvoiceWithoutSendingIt.cs │ │ │ ├── GetInvoiceDetails.cs │ │ │ ├── GetListOfInvoices.cs │ │ │ ├── SendInvoice.cs │ │ │ └── UpdateInvoice.cs │ ├── MLEFeature │ │ ├── PaymentsWithGlobalMLE.cs │ │ ├── PaymentsWithMapToContol1.cs │ │ └── PaymentsWithMapToContol2.cs │ ├── MerchantBoarding │ │ ├── CreateRegistration.cs │ │ ├── MerchantBoardingAmexDirect.cs │ │ ├── MerchantBoardingBarclays.cs │ │ ├── MerchantBoardingBinLookUp.cs │ │ ├── MerchantBoardingCUP.cs │ │ ├── MerchantBoardingEFTPOS.cs │ │ ├── MerchantBoardingFDIGlobal.cs │ │ ├── MerchantBoardingGPX.cs │ │ ├── MerchantBoardingSmartFDC.cs │ │ ├── MerchantBoardingTSYS.cs │ │ └── MerchantBoardingVPC.cs │ ├── MultiThreading │ │ └── MultiThreadTestCase.cs │ ├── NetworkToken │ │ ├── CreateInstrumentIdentifierEnrollForNetworkToken.cs │ │ ├── NetworkToken.cs │ │ └── PaymentCredentialsFromNetworkToken.cs │ ├── PayerAuthentication │ │ ├── AuthenticationWithNORedirect.cs │ │ ├── AuthenticationWithNewAccount.cs │ │ ├── EnrollWithCustomerIdAsPaymentInformation.cs │ │ ├── EnrollWithPendingAuthentication.cs │ │ ├── EnrollWithTransientToken.cs │ │ ├── EnrollWithTravelInformation.cs │ │ ├── PendingAuthenticationWithUnknownPath.cs │ │ ├── SetupCompletionWithCardNumber.cs │ │ ├── SetupCompletionWithFlexTransientToken.cs │ │ ├── SetupCompletionWithFluidDataValueAndPaymentSolution.cs │ │ ├── SetupCompletionWithSecureStorageToken.cs │ │ ├── SetupCompletionWithTMSToken.cs │ │ ├── SetupCompletionWithTokenizedCard.cs │ │ └── ValidateAuthenticationResults.cs │ ├── Payments │ │ ├── Capture │ │ │ ├── CaptureOfAuthorizationThatUsedSwipedTrackData.cs │ │ │ ├── CapturePayment.cs │ │ │ ├── CapturePaymentServiceFee.cs │ │ │ └── RestaurantCaptureWithGratuity.cs │ │ ├── Credit │ │ │ ├── Credit.cs │ │ │ ├── CreditUsingBluefinPCIP2PEForCardPresentEnabledAcquirer.cs │ │ │ ├── CreditUsingBluefinPCIP2PEWithVisaPlatformConnect.cs │ │ │ ├── CreditWithCustomerPaymentInstrumentAndShippingAddressTokenId.cs │ │ │ ├── CreditWithCustomerTokenId.cs │ │ │ ├── CreditWithInstrumentIdentifierTokenId.cs │ │ │ ├── EBTMerchandiseReturnCreditVoucherFromSNAP.cs │ │ │ ├── ElectronicCheckStandAloneCredits.cs │ │ │ ├── PinDebitCreditUsingEMVTechnologyWithContactlessReadWithVisaPlatformConnect.cs │ │ │ ├── PinDebitCreditUsingSwipedTrackDataWithVisaPlatformConnect.cs │ │ │ └── ServiceFeesCredit.cs │ │ ├── Payments │ │ │ ├── AmericanExpressDirectEMVWithContactRead.cs │ │ │ ├── AuthorizationCaptureForTimeoutVoidFlow.cs │ │ │ ├── AuthorizationForIncrementalAuthorizationFlow.cs │ │ │ ├── AuthorizationForTimeoutReversalFlow.cs │ │ │ ├── AuthorizationSkipDecisionManagerForSingleTransaction.cs │ │ │ ├── AuthorizationUsingBluefinPCIP2PEForCardPresentEnabledAcquirer.cs │ │ │ ├── AuthorizationUsingBluefinPCIP2PEWithVisaPlatformConnect.cs │ │ │ ├── AuthorizationUsingSwipedTrackData.cs │ │ │ ├── AuthorizationWithCaptureSale.cs │ │ │ ├── AuthorizationWithCustomerPaymentInstrumentAndShippingAddressTokenId.cs │ │ │ ├── AuthorizationWithCustomerTokenCreation.cs │ │ │ ├── AuthorizationWithCustomerTokenDefaultPaymentInstrumentAndShippingAddressCreation.cs │ │ │ ├── AuthorizationWithCustomerTokenId.cs │ │ │ ├── AuthorizationWithDMAcceptPAEnroll.cs │ │ │ ├── AuthorizationWithDMRejectPAEnroll.cs │ │ │ ├── AuthorizationWithDMReviewPAEnroll.cs │ │ │ ├── AuthorizationWithDecisionManager.cs │ │ │ ├── AuthorizationWithDecisionManagerBuyerInformation.cs │ │ │ ├── AuthorizationWithDecisionManagerCustomSetup.cs │ │ │ ├── AuthorizationWithDecisionManagerDeviceInformation.cs │ │ │ ├── AuthorizationWithDecisionManagerMerchantDefinedInformation.cs │ │ │ ├── AuthorizationWithDecisionManagerShippingInformation.cs │ │ │ ├── AuthorizationWithDecisionManagerTravelInformation.cs │ │ │ ├── AuthorizationWithInstrumentIdentifierTokenCreation.cs │ │ │ ├── AuthorizationWithInstrumentIdentifierTokenId.cs │ │ │ ├── AuthorizationWithLegacyToken.cs │ │ │ ├── AuthorizationWithPAEnrollAuthenticationNeeded.cs │ │ │ ├── AuthorizationWithPayerAuthValidation.cs │ │ │ ├── AuthorizationWithTMSTokenBypassingNetworkToken.cs │ │ │ ├── CITInitiatingInstalmentSubscriptionUK.cs │ │ │ ├── CITInitiatingRecurringSubscription.cs │ │ │ ├── CITPlacingCredentialOnFile.cs │ │ │ ├── DigitalPaymentGooglePay.cs │ │ │ ├── DigitalPaymentsApplePay.cs │ │ │ ├── EBTElectronicVoucherPurchaseFromSNAPAccountWithVisaPlatformConnect.cs │ │ │ ├── EBTPurchaseFromCashBenefitsAccountWithCashback.cs │ │ │ ├── EBTPurchaseFromSNAPAccountWithVisaPlatformConnect.cs │ │ │ ├── ElectronicCheckDebits.cs │ │ │ ├── ElectronicCheckDebitsWithLegacyToken.cs │ │ │ ├── IncrementalAuthorization.cs │ │ │ ├── LevelIIData.cs │ │ │ ├── LevelIIIData.cs │ │ │ ├── MITIndustryPracticeDelayedCharge3RIVisa.cs │ │ │ ├── MITIndustryPracticeResubmission.cs │ │ │ ├── MITInstalment.cs │ │ │ ├── MITRecurring.cs │ │ │ ├── MITUnscheduledCredentialOnFile.cs │ │ │ ├── PartialAuthorization.cs │ │ │ ├── PaymentNetworkTokenization.cs │ │ │ ├── PaymentWithFlexToken.cs │ │ │ ├── PaymentWithFlexTokenCreatePermanentTMSToken.cs │ │ │ ├── PinDebitPurchaseUsingEMVTechnologyWithContactlessReadWithVisaPlatformConnect.cs │ │ │ ├── PinDebitPurchaseUsingSwipedTrackDataWithVisaPlatformConnect.cs │ │ │ ├── RestaurantAuthorization.cs │ │ │ ├── SaleUsingEMVTechnologyWithContactReadOneForCardPresentEnabledAcquirer.cs │ │ │ ├── SaleUsingEMVTechnologyWithContactReadTwoForCardPresentEnabledAcquirer.cs │ │ │ ├── SaleUsingEMVTechnologyWithContactReadWithVisaPlatformConnect.cs │ │ │ ├── SaleUsingEMVTechnologyWithContactless.cs │ │ │ ├── SaleUsingEMVTechnologyWithContactlessReadForCardPresentEnabledAcquirer.cs │ │ │ ├── SaleUsingEMVTechnologyWithContactlessReadWithVisaPlatformConnect.cs │ │ │ ├── SaleUsingKeyedDataForCardPresentEnabledAcquirer.cs │ │ │ ├── SaleUsingKeyedDataWithBalanceInquiry.cs │ │ │ ├── SaleUsingKeyedDataWithVisaPlatformConnect.cs │ │ │ ├── SaleUsingSwipedTrackDataForCardPresentEnabledAcquirer.cs │ │ │ ├── SaleUsingSwipedTrackDataWithVisaPlatformConnect.cs │ │ │ ├── ServiceFeesWithCreditCardTransaction.cs │ │ │ ├── SimpleAuthorizationInternet.cs │ │ │ ├── Swiped.cs │ │ │ └── ZeroDollarAuthorization.cs │ │ ├── Refund │ │ │ ├── ElectronicCheckFollowonRefund.cs │ │ │ ├── RefundCapture.cs │ │ │ └── RefundPayment.cs │ │ ├── Reversal │ │ │ ├── ProcessAuthorizationReversal.cs │ │ │ ├── ServiceFeesAuthorizationReversal.cs │ │ │ └── TimeoutReversal.cs │ │ └── Void │ │ │ ├── EBTReversalOfPurchaseFromSNAPAccount.cs │ │ │ ├── PinDebitPurchaseReversalVoid.cs │ │ │ ├── TimeoutVoid.cs │ │ │ ├── VoidCapture.cs │ │ │ ├── VoidCredit.cs │ │ │ ├── VoidPayment.cs │ │ │ └── VoidRefund.cs │ ├── Payouts │ │ ├── PayoutCardNotToken.cs │ │ └── PayoutToken.cs │ ├── RecurringBillingSubscriptions │ │ ├── Plans │ │ │ ├── ActivatePlan.cs │ │ │ ├── CreatePlan.cs │ │ │ ├── DeactivatePlan.cs │ │ │ ├── DeletePlan.cs │ │ │ ├── GetListOfPlans.cs │ │ │ ├── GetPlan.cs │ │ │ ├── GetPlanCode.cs │ │ │ └── UpdatePlan.cs │ │ └── Subscriptions │ │ │ ├── ActivateSubscription.cs │ │ │ ├── CancelSubscription.cs │ │ │ ├── CreateSubscription.cs │ │ │ ├── GetListOfSubscriptions.cs │ │ │ ├── GetSubscription.cs │ │ │ ├── GetSubscriptionCode.cs │ │ │ ├── SuspendSubscription.cs │ │ │ └── UpdateSubscription.cs │ ├── Reporting │ │ ├── ChargebackDetails │ │ │ └── GetChargebackDetails.cs │ │ ├── ChargebackSummaries │ │ │ └── GetChargebackSummaries.cs │ │ ├── ConversionDetails │ │ │ └── GetConversionDetailTransactions.cs │ │ ├── InterchangeClearingLevelDetails │ │ │ └── InterchangeClearingLevelDataForAccountOrMerchant.cs │ │ ├── NetFundings │ │ │ └── GetNetfundingInformationForAccountOrMerchant.cs │ │ ├── NotificationOfChanges │ │ │ └── GetNotificationOfChanges.cs │ │ ├── PaymentBatchSummaries │ │ │ └── GetPaymentBatchSummaryData.cs │ │ ├── PurchaseAndRefundDetails │ │ │ └── GetPurchaseAndRefundDetails.cs │ │ ├── ReportDefinitions │ │ │ ├── GetReportDefinition.cs │ │ │ └── GetReportingResourceInformation.cs │ │ ├── ReportDownloads │ │ │ └── DownloadReport.cs │ │ ├── ReportSubscriptions │ │ │ ├── CreateClassicStandardReportSubscription.cs │ │ │ ├── CreateReportSubscription.cs │ │ │ ├── DeleteSubscriptionOfReportNameByOrganization.cs │ │ │ ├── GetAllSubscriptions.cs │ │ │ └── GetSubscriptionForReportName.cs │ │ ├── Reports │ │ │ ├── CreateAdhocReport.cs │ │ │ ├── GetReportBasedOnReportId.cs │ │ │ └── RetrieveAvailableReports.cs │ │ ├── RetrievalDetails │ │ │ └── GetRetrievalDetails.cs │ │ └── RetrievalSummaries │ │ │ └── GetRetrievalSummaries.cs │ ├── RiskManagement │ │ ├── DecisionManager │ │ │ ├── AddDataToList.cs │ │ │ ├── AddDuplicateInformation.cs │ │ │ ├── BasicDMTransaction.cs │ │ │ ├── DMWithBuyerInformation.cs │ │ │ ├── DMWithDecisionProfileRejectResponse.cs │ │ │ ├── DMWithDeviceInformation.cs │ │ │ ├── DMWithMerchantDefinedInformation.cs │ │ │ ├── DMWithScoreExceedsThresholdResponse.cs │ │ │ ├── DMWithShippingInformation.cs │ │ │ ├── DMWithTravelInformation.cs │ │ │ ├── MarkAsSuspect.cs │ │ │ └── RemoveFromHistory.cs │ │ └── Verification │ │ │ ├── AddressMatchNotFound.cs │ │ │ ├── ApartmentNumberMissingOrNotFound.cs │ │ │ ├── CanadianBillingDetails.cs │ │ │ ├── ComplianceStatusCompleted.cs │ │ │ ├── CustomerMatchDeniedPartiesList.cs │ │ │ ├── ExportComplianceInformationProvided.cs │ │ │ ├── MultipleLineItems.cs │ │ │ ├── MultipleSanctionLists.cs │ │ │ ├── NoCompanyName.cs │ │ │ ├── ShippingDetailsNotUSOrCanada.cs │ │ │ └── VerboseRequestWithAllFields.cs │ ├── SecureFileShare │ │ ├── DownloadFileWithFileIdentifier.cs │ │ └── GetListOfFiles.cs │ ├── TokenManagement │ │ ├── Customer │ │ │ ├── CreateCustomer.cs │ │ │ ├── DeleteCustomer.cs │ │ │ ├── RetrieveCustomer.cs │ │ │ ├── UpdateCustomer.cs │ │ │ ├── UpdateCustomersDefaultPaymentInstrument.cs │ │ │ └── UpdateCustomersDefaultShippingAddress.cs │ │ ├── CustomerPaymentInstrument │ │ │ ├── CreateCustomerDefaultPaymentInstrumentCard.cs │ │ │ ├── CreateCustomerNonDefaultPaymentInstrumentCard.cs │ │ │ ├── CreateCustomerPaymentInstrumentBankAccount.cs │ │ │ ├── CreateCustomerPaymentInstrumentPinlessDebit.cs │ │ │ ├── DeleteCustomerPaymentInstrument.cs │ │ │ ├── ListPaymentInstrumentsForCustomer.cs │ │ │ └── RetrieveCustomerPaymentInstrument.cs │ │ ├── CustomerShippingAddress │ │ │ ├── CreateCustomerDefaultShippingAddress.cs │ │ │ ├── CreateCustomerNonDefaultShippingAddress.cs │ │ │ ├── DeleteCustomerShippingAddress.cs │ │ │ ├── ListShippingAddressesForCustomer.cs │ │ │ └── RetrieveCustomerShippingAddress.cs │ │ ├── InstrumentIdentifier │ │ │ ├── CreateInstrumentIdentifierBankAccount.cs │ │ │ ├── CreateInstrumentIdentifierCard.cs │ │ │ ├── CreateInstrumentIdentifierCardEnrollForNetworkToken.cs │ │ │ ├── DeleteInstrumentIdentifier.cs │ │ │ ├── EnrollInstrumentIdentifierForNetworkTokenization.cs │ │ │ ├── ListPaymentInstrumentsForInstrumentIdentifier.cs │ │ │ ├── RetrieveInstrumentIdentifier.cs │ │ │ └── UpdateInstrumentIdentifierPreviousTransactionId.cs │ │ └── PaymentInstrument │ │ │ ├── CreatePaymentInstrumentBankAccount.cs │ │ │ ├── CreatePaymentInstrumentCard.cs │ │ │ ├── CreatePaymentInstrumentPinlessDebit.cs │ │ │ ├── DeletePaymentInstrument.cs │ │ │ ├── RetrievePaymentInstrument.cs │ │ │ └── UpdatePaymentInstrument.cs │ ├── TransactionBatches │ │ ├── GetIndividualBatchFile.cs │ │ ├── GetListOfBatchFiles.cs │ │ └── GetTransactionDetailsForGivenBatchId.cs │ ├── TransactionDetails │ │ └── RetrieveTransaction.cs │ ├── TransactionSearch │ │ ├── CreateSearchRequest.cs │ │ └── GetSearchResults.cs │ ├── UnifiedCheckout │ │ ├── GenerateCaptureContextForClickToPayDropInUI.cs │ │ ├── GenerateUnifiedCheckout.cs │ │ └── GenerateUnifiedCheckoutCaptureContextPassingBillingShipping.cs │ ├── UserManagement │ │ └── UserManagement │ │ │ └── GetUserInformationDeprecated.cs │ ├── ValueAddedService │ │ ├── BasicTaxCalculationRequest.cs │ │ ├── CommittedTaxCallRequest.cs │ │ ├── CommittedTaxRefundCallRequest.cs │ │ ├── TaxRefundRequest.cs │ │ └── VoidCommittedTaxCall.cs │ └── Webhooks │ │ ├── CreateNewWebhooks │ │ ├── CreateAlternativePaymentsNotificationWebhook.cs │ │ ├── CreateDecisionManagerWebhook.cs │ │ ├── CreateFraudManagementWebhook.cs │ │ ├── CreateInvoicingWebhook.cs │ │ ├── CreateOutageAndKeyExpirationNotificationWebhook.cs │ │ ├── CreateRecurringBillingWebhook.cs │ │ ├── CreateSecureAcceptanceWebhook.cs │ │ ├── CreateTerminalManagementWebhook.cs │ │ ├── CreateTokenManagementWebhook.cs │ │ ├── CreateWebhookSymmetricKey.cs │ │ ├── CreateWebhookUsingOAuthWithClientCredentials.cs │ │ ├── CreateWebhookUsingOAuthWithJWT.cs │ │ ├── FindProductsYouCanSubscribeTo.cs │ │ └── StoreOAuthCredentials.cs │ │ └── ManageWebhooks │ │ ├── CreateAsymmetricKey.cs │ │ ├── DeleteWebhookSubscription.cs │ │ ├── GetDetailsOnAllCreatedWebhooks.cs │ │ ├── GetDetailsOnSingleWebhook.cs │ │ ├── ReplayFailedTransactionsBySetStartAndEndTime.cs │ │ ├── ReplayFailedTransactionsInLast24Hours.cs │ │ ├── ReplaySpecificListOfTransactions.cs │ │ └── UpdateWebhook.cs ├── Utilities.cs └── lib │ ├── net461 │ └── ApiSdk.dll │ └── netstandard │ └── ApiSdk.dll ├── Validation ├── ExpectedResults │ ├── csharp_expected_results.json │ ├── java_expected_results.json │ ├── json_expected_results.json │ ├── node_expected_results.json │ ├── php_expected_results.json │ ├── python_expected_results.json │ └── ruby_expected_results.json ├── json_to_prettified_html.py ├── response_code_validator.py └── sample_code_log_processor.py ├── cybersource-rest-samples-csharp.csproj ├── cybersource-rest-samples-csharp.sln ├── cybersource-rest-samples-netcore.csproj ├── cybersource-rest-samples-netcore.sln ├── license.txt └── packages.config /.gitignore: -------------------------------------------------------------------------------- 1 | obj 2 | packages 3 | bin 4 | cybersource-rest-samples-netcore.csproj.user 5 | .vs 6 | .idea/ 7 | *.log 8 | .DS_Store 9 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | os: 2 | windows 3 | 4 | language: 5 | cpp 6 | 7 | before_install: 8 | - powershell -c "Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope LocalMachine" 9 | - powershell -c "Import-Module PackageManagement; Install-PackageProvider Nuget" 10 | - powershell -c "Import-Module PackageManagement; Register-PackageSource -Name NuGetOrg -Location https://www.nuget.org/api/v2 -ProviderName NuGet" 11 | - powershell -c "Import-Module PackageManagement; Install-Package -Source NuGetOrg -Name NuGet.CommandLine -Force -ExcludeVersion -Destination C:\tools" 12 | - export PATH="c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin":$PATH 13 | - export PATH="c:\tools\NuGet.CommandLine\tools":$PATH 14 | 15 | install: 16 | - choco install dotnetcore-sdk 17 | - nuget restore cybersource-rest-samples-csharp.sln 18 | 19 | before_script: 20 | - MSBuild.exe cybersource-rest-samples-csharp.sln 21 | 22 | script: 23 | - ./bin/Debug/net461/SampleCode.exe RunAll 24 | - dotnet build cybersource-rest-samples-netcore.sln 25 | - dotnet bin/Debug/netcoreapp3.1/SampleCodeNetCore.dll RunAll 26 | -------------------------------------------------------------------------------- /NLog.config: -------------------------------------------------------------------------------- 1 |  2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | 25 | 26 | 27 | 29 | 31 | 32 | -------------------------------------------------------------------------------- /Source/Api.cs: -------------------------------------------------------------------------------- 1 | namespace Cybersource_rest_samples_dotnet 2 | { 3 | public class Api 4 | { 5 | public string ApiFamily { get; set; } 6 | public string ApiFunctionCall { get; set; } 7 | } 8 | } -------------------------------------------------------------------------------- /Source/AuthenticationData/Configuration.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SampleCode.data 4 | { 5 | public class Configuration 6 | { 7 | // initialize dictionary object 8 | private readonly Dictionary _configurationDictionary = new Dictionary(); 9 | 10 | public Dictionary GetConfiguration() 11 | { 12 | _configurationDictionary.Add("merchantID", "testrest"); 13 | _configurationDictionary.Add("merchantsecretKey", "yBJxy6LjM2TmcPGu+GaJrHtkke25fPpUX+UY6/L/1tE="); 14 | _configurationDictionary.Add("merchantKeyId", "08c94330-f618-42a3-b09d-e1e43be5efda"); 15 | _configurationDictionary.Add("authenticationType", "JWT"); 16 | _configurationDictionary.Add("keysDirectory", "..\\..\\Resource"); 17 | _configurationDictionary.Add("keyFilename", "testrest"); 18 | _configurationDictionary.Add("runEnvironment", "cybersource.environment.sandbox"); 19 | _configurationDictionary.Add("keyAlias", "testrest"); 20 | _configurationDictionary.Add("keyPass", "testrest"); 21 | _configurationDictionary.Add("enableLog", "TRUE"); 22 | _configurationDictionary.Add("logDirectory", string.Empty); 23 | _configurationDictionary.Add("logFileName", string.Empty); 24 | _configurationDictionary.Add("logFileMaxSize", "5242880"); 25 | _configurationDictionary.Add("timeout", "1000"); 26 | _configurationDictionary.Add("proxyAddress", string.Empty); 27 | _configurationDictionary.Add("proxyPort", string.Empty); 28 | 29 | return _configurationDictionary; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Source/MerchantBoardingConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Cybersource_rest_samples_dotnet 9 | { 10 | internal class MerchantBoardingConfiguration 11 | { 12 | 13 | private readonly Dictionary _configurationDictionary = new Dictionary(); 14 | 15 | public Dictionary GetMerchantBoardingConfiguration() 16 | { 17 | _configurationDictionary.Add("authenticationType", "jwt"); 18 | _configurationDictionary.Add("merchantID", ""); 19 | _configurationDictionary.Add("merchantsecretKey", ""); 20 | _configurationDictionary.Add("merchantKeyId", ""); 21 | _configurationDictionary.Add("keysDirectory", Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\Source\\Resource")); 22 | _configurationDictionary.Add("keyFilename", ""); 23 | _configurationDictionary.Add("runEnvironment", "apitest.cybersource.com"); 24 | _configurationDictionary.Add("keyAlias", ""); 25 | _configurationDictionary.Add("keyPass", ""); 26 | _configurationDictionary.Add("timeout", "300000"); 27 | 28 | // Configs related to meta key 29 | _configurationDictionary.Add("portfolioID", string.Empty); 30 | _configurationDictionary.Add("useMetaKey", "false"); 31 | 32 | 33 | return _configurationDictionary; 34 | } 35 | 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Source/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("cybersource-rest-samples-csharp")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Visa Inc")] 12 | [assembly: AssemblyProduct("cybersource-rest-samples-csharp")] 13 | [assembly: AssemblyCopyright("Copyright © Visa Inc 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("97ff11a4-924d-4c87-a028-2aaf64655954")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Source/Resource/AuthTRRReport.json: -------------------------------------------------------------------------------- 1 | { 2 | "startDay":"23", 3 | "timeZone":"America/Chicago", 4 | "reportDefinitionName":"TransactionRequestClass", 5 | "startTime":"1100", 6 | "reportFrequency":"DAILY", 7 | "ReportName":"TRRReport", 8 | "reportFormat":"csv", 9 | "orgId":"testrest", 10 | "reportType":"detail", 11 | "reportFields": ["Request.RequestID","Request.TransactionDate","Request.MerchantReferenceNumber","Request.MerchantID"] 12 | } -------------------------------------------------------------------------------- /Source/Resource/DownloadedFileWithFileID.csv: -------------------------------------------------------------------------------- 1 | Batch Files Detail Report,1.0,2020-01-30 to 2020-01-30,,,,,,, 2 | merchant_id,txn_batch_id,payment_processor,request_id,trans_ref_no,merchant_ref_number,ics_rflag,amount,currency,action 3 | -------------------------------------------------------------------------------- /Source/Resource/NetworkTokenCert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEpAIBAAKCAQEA2tNGgpyJKgviPHjuNmcF+5tPjFsxBKebsto9swyebVcJVYu5Mp4Yz8VnhPbEdkyzckTtAulXQYA82iPYG/BHEbChR/PHwO3yCsbTDDNQlkB0R5c5Py/Ts4BSLvIwkbJEvd/SQxTPaPOOYjqbqSfzJ4oKsCGzW+K94UnZic8b5II8CrKlLZLZSO2RoURFg+4htjXhikBJXqJdDhneZCgnMxbWU8MKbdXXJUIDZq0jMkNUNOi1xdzLHhZQl464kD+VocTUS06Ky8h/FBU6xRJciLQW7/VieqzVxG5MGxwcSNfbiozG7aHw+Nt4Awkt6N2VpcxL6AmOXoKRH5om1yCNhwIDAQABAoIBAQCky1WfiVl288ol9oCXMdD8ogMvVYG92qfT8q1iiQ9KkrBx3y7SouNWnXiPVvOvj6XYWXYQqj/PEU9CjJn0uGgdN2LOeBWoAso0OXW5C3AWJ2YqgAVZw5/v36SEvFm9b357a/LCGAr3I+zHpxGRO4fP8BKKgGa9vS14W5BbS0DbPZ9/QvzRfinw6l+/l2mnPihB8KyvABtsiBv0ylh525JY3SFp7bx9qLePjYXMR9u8P+LhD4CPvps5htj1E/JSV3nysNYUP7qc3m4OPhrT46ly2vIMVYDWrHw7i9CGf4XVtZuJ0jRSaG/FaS/ggvy4wzeBkjWkfx+PROG1RYLBWuBJAoGBAP/GwOWn4UgDFqc6W3qhZU4j1uHzsYuFCaagof151dV3YdTBOSVx40zq3sWxNkgFhAAJLF7RywYslWW8UEEsLjjdjMjofJBEYIS3I3wUGpU85x//SUwlf1cO5rIg+hehU+m/dgSPFwh/jaBxBb1u9wX5B18N/3kGbwBcchs9mJxtAoGBANsEQHGLf3RYUZ/HMB3QpVNwYbE904CVhU+foRuiog0o9jBJEgnQeuMcDd4sEenhDobuI5+W8VdFSD4h9n2fwoUStqx5uLAenWH/zquuaH+q1/Nz/IO78GoUoaerPV32HZWv5oPafYO6sMPt2TDVhcWmpnDMQkx/54iuKfLigfFDAoGBAOVNyC2bniozKqHtfYmpG+s70i9rjCZqtMY/iDp4ea4QgxJ7z8G0InUYs3NEdkeHOlnV34N6TatRWPaGJuTmuOGeLdMIKnQj+OvCS/u3AkX8/a//7DRqAYmJAGV9jviUV2hdj25y4dFqmQvXh6/WxXsDUQp0wC4+CFGoj1vAkwrZAoGANBtG2by+jgeVI9ZX9D/3lWpfU7PJ5gWsuczYn6KJu2fLaqF30S3wjqfWBM2nVWVd92wgvY9Dy+eH0IB0DF8+ADr7iv1Km1wtRWt+2AmegwE6b4lgwlasVBCkhSeQahJr53j59tS8l+KKu5KS4bNrKCMF5kAyZdDoXPRStp59G9ECgYB2lLPPN/OsecBnl5ye9vuBpw6VUlsxUk3UGlDIKZTx46UJm1RCVCis0O434s49nHATzylyaT2ED77HdvOQSx9eqh3+goS+xs3DPBry477TwiP1Cvo/+7neIrS7uO7B6fHBWze7jk59JD7Rs5wANMfErmv8bX1LPoXq43i2ZQGBNA== 3 | -----END RSA PRIVATE KEY----- 4 | -------------------------------------------------------------------------------- /Source/Resource/NumericUtility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Cybersource_rest_samples_dotnet.Resource 8 | { 9 | public class NumericUtility 10 | { 11 | public static string LongRandom(int min, int max) 12 | { 13 | Random generator = new Random(); 14 | string r = generator.Next(min, max).ToString("D8"); 15 | return r; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Source/Resource/TRRReport.json: -------------------------------------------------------------------------------- 1 | { 2 | "startDay": "23", 3 | "timeZone": "America/Chicago", 4 | "reportDefinitionName": "TransactionRequestClass", 5 | "startTime": "1100", 6 | "reportFrequency": "DAILY", 7 | "ReportName": "TRRReport", 8 | "reportFormat": "xml", 9 | "orgId": "testrest", 10 | "reportType": "detail", 11 | "reportFields": [ "Request.RequestID", "Request.TransactionDate", "Request.MerchantReferenceNumber", "Request.MerchantID" ] 12 | } -------------------------------------------------------------------------------- /Source/Resource/jwsToken.txt: -------------------------------------------------------------------------------- 1 | eyJhbGciOiJSUzI1NiIsInYtYy1tZXJjaGFudC1pZCI6InRlc3RyZXN0IiwieDVjIjpbIk1JSUNYekNDQWNpZ0F3SUJBZ0lXTlRjME5qWTBNalF6TURZNU1ERTNOekV3TnpBME5qQU5CZ2txaGtpRzl3MEJBUXNGQURBZU1Sd3dHZ1lEVlFRRERCTkRlV0psY2xOdmRYSmpaVU5sY25SQmRYUm9NQjRYRFRFNU1URXlOVEEyTkRRd00xb1hEVEl4TVRFeU5UQTJORFF3TTFvd05ERVJNQThHQTFVRUF3d0lkR1Z6ZEhKbGMzUXhIekFkQmdOVkJBVVRGalUzTkRZMk5ESTBNekEyT1RBeE56Y3hNRGN3TkRZd2dnRWlNQTBHQ1NxR1NJYjNEUUVCQVFVQUE0SUJEd0F3Z2dFS0FvSUJBUUMrQnRkTWNva2FLd1RlczlPK3NucWpXc2VoTzAvWTRDSnJ3bzRjZEdDYWZSTzZvd3MzbUMxeG1wU1l0dFRLSWRlR1IxcU9ZcFRTZVk5dUpoMmNDZmF5TUtYbWhRZjRkNXY4cE5Ebm1ZQk1HQndVMXdXamxZc01MRmJjUEZXamRQdEtsb3UyUklXWjU2NllXSWJXQ0JmK0c0ZEhrQTBEN0NzcDNGVDNsblVOMm1lNGxKa2x5c2ZxcDFYOHEzSkRxVklRRlZBZHVhbWhXQ1lNUlM1S2c4c0t3TWpsZEdRVWJ5ODhTK01Pd2NDQTNIT0hUNjRiYXJ2UElkMkV4cUFxdmZ5QkNQQVI0OVY2L3l3RFZzSDlTeUhld2cxMjFja01jQTlnNTV0SXFkc3lIR1JaTjlmczIwa015cUVQNzhMNGN4ZmlzdVZRQzhrbmxmWnRkY3FWQVk3RkFnTUJBQUV3RFFZSktvWklodmNOQVFFTEJRQURnWUVBdHBDL0VocS8yUDdWYXp6WTgxZ1ZucFBnRWpIWFB5S2t0emJSU1ZkUkcvTUdiVko1OVFWSmVMbnpnbXpIbXlxMGNKK1FTUVBWTzQ2YmxvTkYrMjlJWVErelZZWGFOZ3ZqcVlRU2hYUEM2bllJbkZDZk9uMXByUklJY0l0KzViWkpZRmtRR1R6OGprRUF2QlpsYjBsdm02S3REVWI5T0xPMzhIMDV5U0xpbDY4PSJdfQ.eyJpYXQiOiJXZWQsIDAyIE1hciAyMDIyIDA3OjU0OjM3IEdNVCJ9.Mxko9nrb6kja6JH5zOna0SzEShZFgrsMxBNpl5bhA9loJNuEZ9IIR6Ij25uJoN6yFQ2IphlKaZKEwvuHkoQWPS_9SUu7Nq9Q4jhrJebNXfhyEew_NFs24LSwgrZvmfq7UOvNmIQX6gsNzNeSSmUgS1IB676mHeFpBIEN6GjuDu44SA-G1_J4MCYj3I-qFoijqOCLPbbZFTqI6De33oV8o5sLDjZ-LJg0xrwgJ4wlQCe5FwXIg9n9yvHswlAhYTq_EDYP_5r9fX7bGDy7KCMfJsADYgLE_SM5jV9ArRNHErXws3cvJop1dnH55V2Gjl3Lz2Lkk07HBiEFakJMGcF5Jg -------------------------------------------------------------------------------- /Source/Resource/mcb_test_merch.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyberSource/cybersource-rest-samples-csharp/8ed4c10f376f63196c11d081d247b8eaa8c9ba5b/Source/Resource/mcb_test_merch.p12 -------------------------------------------------------------------------------- /Source/Resource/request_captures.json: -------------------------------------------------------------------------------- 1 | { 2 | "clientReferenceInformation": { 3 | "code": "TC50171_3" 4 | }, 5 | "orderInformation": { 6 | "amountDetails": { 7 | "totalAmount": "102.21", 8 | "currency": "USD" 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /Source/Resource/request_payments.json: -------------------------------------------------------------------------------- 1 | { 2 | "clientReferenceInformation": { 3 | "code": "TC50171_3" 4 | }, 5 | "processingInformation": { 6 | "commerceIndicator": "internet" 7 | }, 8 | "aggregatorInformation": { 9 | "subMerchant": { 10 | "cardAcceptorID": "1234567890", 11 | "country": "US", 12 | "phoneNumber": "650-432-0000", 13 | "address1": "900 Metro Center", 14 | "postalCode": "94404-2775", 15 | "locality": "Foster City", 16 | "name": "Visa Inc", 17 | "administrativeArea": "CA", 18 | "region": "PEN", 19 | "email": "test@cybs.com" 20 | }, 21 | "name": "V-Internatio", 22 | "aggregatorID": "123456789" 23 | }, 24 | "orderInformation": { 25 | "billTo": { 26 | "country": "US", 27 | "lastName": "VDP", 28 | "address2": "Address 2", 29 | "address1": "201 S. Division St.", 30 | "postalCode": "48104-2201", 31 | "locality": "Ann Arbor", 32 | "administrativeArea": "MI", 33 | "firstName": "RTS", 34 | "phoneNumber": "999999999", 35 | "district": "MI", 36 | "buildingNumber": "123", 37 | "company": "Visa", 38 | "email": "test@cybs.com" 39 | }, 40 | "amountDetails": { 41 | "totalAmount": "102.21", 42 | "currency": "USD" 43 | } 44 | }, 45 | "paymentInformation": { 46 | "card": { 47 | "expirationYear": "2031", 48 | "number": "5555555555554444", 49 | "securityCode": "123", 50 | "expirationMonth": "12", 51 | "type": "002" 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /Source/Resource/request_refund.json: -------------------------------------------------------------------------------- 1 | { 2 | "clientReferenceInformation": { 3 | "code": "Testing-VDP-Payments-Refund" 4 | }, 5 | "orderInformation": { 6 | "amountDetails": { 7 | "totalAmount": "102.21", 8 | "currency": "USD" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Source/Resource/request_reversals.json: -------------------------------------------------------------------------------- 1 | { 2 | "clientReferenceInformation": { 3 | "code": "TC50171_3" 4 | }, 5 | "reversalInformation": { 6 | "reason": "testing", 7 | "amountDetails": { 8 | "totalAmount": "102.21" 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /Source/Resource/request_void.json: -------------------------------------------------------------------------------- 1 | { 2 | "clientReferenceInformation": { 3 | "code": "test_void" 4 | } 5 | } -------------------------------------------------------------------------------- /Source/Resource/signatureHeaderValue.txt: -------------------------------------------------------------------------------- 1 | keyid="08c94330-f618-42a3-b09d-e1e43be5efda", algorithm="HmacSHA256", headers="host date request-target digest v-c-merchant-id", signature="I/3BC76nsQmZGOlnsrvslZk/VLVaXA2Jb0iVtce++JE=" -------------------------------------------------------------------------------- /Source/Resource/testrest.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyberSource/cybersource-rest-samples-csharp/8ed4c10f376f63196c11d081d247b8eaa8c9ba5b/Source/Resource/testrest.p12 -------------------------------------------------------------------------------- /Source/Resource/testrest_cpctv.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyberSource/cybersource-rest-samples-csharp/8ed4c10f376f63196c11d081d247b8eaa8c9ba5b/Source/Resource/testrest_cpctv.p12 -------------------------------------------------------------------------------- /Source/Samples/AccountUpdater/AmexRegistrationCustomerTokenBatch.cs: -------------------------------------------------------------------------------- 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.AccountUpdater 9 | { 10 | public class AmexRegistrationCustomerTokenBatch 11 | { 12 | public static InlineResponse202 Run() 13 | { 14 | string type = "amexRegistration"; 15 | 16 | List includedTokens = new List (); 17 | string includedTokensId1 = "C06977C0EDC0E985E053AF598E0A3326"; 18 | includedTokens.Add(new Accountupdaterv1batchesIncludedTokens( 19 | Id: includedTokensId1 20 | )); 21 | 22 | string includedTokensId2 = "C069A534044F6140E053AF598E0AD492"; 23 | includedTokens.Add(new Accountupdaterv1batchesIncludedTokens( 24 | Id: includedTokensId2 25 | )); 26 | 27 | Accountupdaterv1batchesIncluded included = new Accountupdaterv1batchesIncluded( 28 | Tokens: includedTokens 29 | ); 30 | 31 | string merchantReference = "TC50171_3"; 32 | string notificationEmail = "test@cybs.com"; 33 | var requestObj = new Body( 34 | Type: type, 35 | Included: included, 36 | MerchantReference: merchantReference, 37 | NotificationEmail: notificationEmail 38 | ); 39 | 40 | try 41 | { 42 | var configDictionary = new Configuration().GetConfiguration(); 43 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 44 | 45 | var apiInstance = new BatchesApi(clientConfig); 46 | InlineResponse202 result = apiInstance.PostBatch(requestObj); 47 | Console.WriteLine(result); 48 | return result; 49 | } 50 | catch (Exception e) 51 | { 52 | Console.WriteLine("Exception on calling the API : " + e.Message); 53 | return null; 54 | } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Source/Samples/AccountUpdater/AmexRegistrationInstrumentIdentifierTokenBatch.cs: -------------------------------------------------------------------------------- 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.AccountUpdater 9 | { 10 | public class AmexRegistrationInstrumentIdentifierTokenBatch 11 | { 12 | public static InlineResponse202 Run() 13 | { 14 | string type = "amexRegistration"; 15 | 16 | List includedTokens = new List (); 17 | string includedTokensId1 = "7030000000000260224"; 18 | string includedTokensExpirationMonth1 = "12"; 19 | string includedTokensExpirationYear1 = "2020"; 20 | includedTokens.Add(new Accountupdaterv1batchesIncludedTokens( 21 | Id: includedTokensId1, 22 | ExpirationMonth: includedTokensExpirationMonth1, 23 | ExpirationYear: includedTokensExpirationYear1 24 | )); 25 | 26 | string includedTokensId2 = "7030000000000231118"; 27 | string includedTokensExpirationMonth2 = "12"; 28 | string includedTokensExpirationYear2 = "2020"; 29 | includedTokens.Add(new Accountupdaterv1batchesIncludedTokens( 30 | Id: includedTokensId2, 31 | ExpirationMonth: includedTokensExpirationMonth2, 32 | ExpirationYear: includedTokensExpirationYear2 33 | )); 34 | 35 | Accountupdaterv1batchesIncluded included = new Accountupdaterv1batchesIncluded( 36 | Tokens: includedTokens 37 | ); 38 | 39 | string merchantReference = "TC50171_3"; 40 | string notificationEmail = "test@cybs.com"; 41 | var requestObj = new Body( 42 | Type: type, 43 | Included: included, 44 | MerchantReference: merchantReference, 45 | NotificationEmail: notificationEmail 46 | ); 47 | 48 | try 49 | { 50 | var configDictionary = new Configuration().GetConfiguration(); 51 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 52 | 53 | var apiInstance = new BatchesApi(clientConfig); 54 | InlineResponse202 result = apiInstance.PostBatch(requestObj); 55 | Console.WriteLine(result); 56 | return result; 57 | } 58 | catch (Exception e) 59 | { 60 | Console.WriteLine("Exception on calling the API : " + e.Message); 61 | return null; 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Source/Samples/AccountUpdater/ListBatches.cs: -------------------------------------------------------------------------------- 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.AccountUpdater 9 | { 10 | public class ListBatches 11 | { 12 | public static void Run() 13 | { 14 | try 15 | { 16 | var configDictionary = new Configuration().GetConfiguration(); 17 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 18 | 19 | var apiInstance = new BatchesApi(clientConfig); 20 | string fromDate = "20230101T123000Z"; 21 | string toDate = "20230410T123000Z"; 22 | InlineResponse2008 result = apiInstance.GetBatchesList(0, 10, fromDate, toDate); 23 | Console.WriteLine(result); 24 | } 25 | catch (Exception e) 26 | { 27 | Console.WriteLine("Exception on calling the API : " + e.Message); 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Source/Samples/AccountUpdater/OneOffVisaMasterCardCustomerTokenBatch.cs: -------------------------------------------------------------------------------- 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.AccountUpdater 9 | { 10 | public class OneOffVisaMasterCardCustomerTokenBatch 11 | { 12 | public static InlineResponse202 Run() 13 | { 14 | string type = "oneOff"; 15 | 16 | List includedTokens = new List (); 17 | string includedTokensId1 = "C064DE56200B0DB0E053AF598E0A52AA"; 18 | includedTokens.Add(new Accountupdaterv1batchesIncludedTokens( 19 | Id: includedTokensId1 20 | )); 21 | 22 | string includedTokensId2 = "C064DE56213D0DB0E053AF598E0A52AA"; 23 | includedTokens.Add(new Accountupdaterv1batchesIncludedTokens( 24 | Id: includedTokensId2 25 | )); 26 | 27 | Accountupdaterv1batchesIncluded included = new Accountupdaterv1batchesIncluded( 28 | Tokens: includedTokens 29 | ); 30 | 31 | string merchantReference = "TC50171_3"; 32 | string notificationEmail = "test@cybs.com"; 33 | var requestObj = new Body( 34 | Type: type, 35 | Included: included, 36 | MerchantReference: merchantReference, 37 | NotificationEmail: notificationEmail 38 | ); 39 | 40 | try 41 | { 42 | var configDictionary = new Configuration().GetConfiguration(); 43 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 44 | 45 | var apiInstance = new BatchesApi(clientConfig); 46 | InlineResponse202 result = apiInstance.PostBatch(requestObj); 47 | Console.WriteLine(result); 48 | return result; 49 | } 50 | catch (Exception e) 51 | { 52 | Console.WriteLine("Exception on calling the API : " + e.Message); 53 | return null; 54 | } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Source/Samples/AccountUpdater/OneOffVisaMasterCardInstrumentIdentifierTokenBatch.cs: -------------------------------------------------------------------------------- 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.AccountUpdater 9 | { 10 | public class OneOffVisaMasterCardInstrumentIdentifierTokenBatch 11 | { 12 | public static InlineResponse202 Run() 13 | { 14 | string type = "oneOff"; 15 | 16 | List includedTokens = new List(); 17 | string includedTokensId1 = "7030000000000116236"; 18 | string includedTokensExpirationMonth1 = "12"; 19 | string includedTokensExpirationYear1 = "2020"; 20 | includedTokens.Add(new Accountupdaterv1batchesIncludedTokens( 21 | Id: includedTokensId1, 22 | ExpirationMonth: includedTokensExpirationMonth1, 23 | ExpirationYear: includedTokensExpirationYear1 24 | )); 25 | 26 | string includedTokensId2 = "7030000000000178855"; 27 | string includedTokensExpirationMonth2 = "12"; 28 | string includedTokensExpirationYear2 = "2020"; 29 | includedTokens.Add(new Accountupdaterv1batchesIncludedTokens( 30 | Id: includedTokensId2, 31 | ExpirationMonth: includedTokensExpirationMonth2, 32 | ExpirationYear: includedTokensExpirationYear2 33 | )); 34 | 35 | Accountupdaterv1batchesIncluded included = new Accountupdaterv1batchesIncluded( 36 | Tokens: includedTokens 37 | ); 38 | 39 | string merchantReference = "TC50171_3"; 40 | string notificationEmail = "test@cybs.com"; 41 | var requestObj = new Body( 42 | Type: type, 43 | Included: included, 44 | MerchantReference: merchantReference, 45 | NotificationEmail: notificationEmail 46 | ); 47 | 48 | try 49 | { 50 | var configDictionary = new Configuration().GetConfiguration(); 51 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 52 | 53 | var apiInstance = new BatchesApi(clientConfig); 54 | InlineResponse202 result = apiInstance.PostBatch(requestObj); 55 | Console.WriteLine(result); 56 | return result; 57 | } 58 | catch (Exception e) 59 | { 60 | Console.WriteLine("Exception on calling the API : " + e.Message); 61 | return null; 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Source/Samples/AccountUpdater/RetrieveBatchReport.cs: -------------------------------------------------------------------------------- 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.AccountUpdater 9 | { 10 | public class RetrieveBatchReport 11 | { 12 | public static void Run() 13 | { 14 | try 15 | { 16 | string batchId = "16188390061150001062041064"; 17 | 18 | var configDictionary = new Configuration().GetConfiguration(); 19 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 20 | 21 | var apiInstance = new BatchesApi(clientConfig); 22 | InlineResponse20010 result = apiInstance.GetBatchReport(batchId); 23 | Console.WriteLine(result); 24 | } 25 | catch (Exception e) 26 | { 27 | Console.WriteLine("Exception on calling the API : " + e.Message); 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Source/Samples/AccountUpdater/RetrieveBatchStatus.cs: -------------------------------------------------------------------------------- 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.AccountUpdater 9 | { 10 | public class RetrieveBatchStatus 11 | { 12 | public static void Run() 13 | { 14 | try 15 | { 16 | string batchId = "16188390061150001062041064"; 17 | 18 | var configDictionary = new Configuration().GetConfiguration(); 19 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 20 | 21 | var apiInstance = new BatchesApi(clientConfig); 22 | InlineResponse2009 result = apiInstance.GetBatchStatus(batchId); 23 | Console.WriteLine(result); 24 | } 25 | catch (Exception e) 26 | { 27 | Console.WriteLine("Exception on calling the API : " + e.Message); 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Source/Samples/Authentication/CallHttpMethods/DeleteMethod.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ApiSdk.controller; 3 | using AuthenticationSdk.core; 4 | using AuthenticationSdk.util; 5 | 6 | namespace Cybersource_rest_samples_dotnet.Samples.Authentication 7 | { 8 | public class DeleteMethod 9 | { 10 | // DELETE Request to Delete subscription of (Unsubscribe) a report name by organization 11 | // Below request unsubscribes 'TRR Report' Subscription for Organization ID: testrest 12 | private const string RequestTarget = "/reporting/v2/reportSubscriptions/TRRReport?organizationId=testrest"; 13 | 14 | public static void WriteLogAudit(int status) 15 | { 16 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 17 | var filename = filePath[filePath.Length - 1]; 18 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 19 | } 20 | 21 | public static void Run() 22 | { 23 | try 24 | { 25 | // Setting up Merchant Config 26 | var merchantConfig = new MerchantConfig 27 | { 28 | RequestTarget = RequestTarget, 29 | RequestType = Enumerations.RequestType.DELETE.ToString() 30 | }; 31 | 32 | // Call to the Controller of API_SDK 33 | var apiController = new APIController(merchantConfig); 34 | var response = apiController.DeletePayment(); 35 | 36 | // printing the response details 37 | if (response != null) 38 | { 39 | Console.WriteLine("\n v-c-correlation-id:{0}", response.GetResponseHeaderValue(response.Headers, "v-c-correlation-id")); 40 | Console.WriteLine("\n Response Code:{0}", response.StatusCode); 41 | Console.WriteLine("\n Response Message:{0}", response.Data); 42 | if (response.StatusCode == 200 || response.StatusCode == 404) 43 | { 44 | WriteLogAudit(200); 45 | } 46 | else 47 | { 48 | WriteLogAudit(response.StatusCode); 49 | } 50 | } 51 | } 52 | catch (Exception e) 53 | { 54 | Console.WriteLine(e.Message); 55 | Console.WriteLine(e.StackTrace); 56 | } 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Source/Samples/Authentication/CallHttpMethods/GetMethod.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ApiSdk.controller; 3 | using AuthenticationSdk.core; 4 | using AuthenticationSdk.util; 5 | 6 | namespace Cybersource_rest_samples_dotnet.Samples.Authentication 7 | { 8 | public class GetMethod 9 | { 10 | // GET request to retrieve the payment details of the provided Payment ID 11 | // Below Request fetches the payment details of payment ID: 5319754772076048103525 12 | private const string RequestTarget = "/pts/v2/payments/5526383152166546003003"; 13 | 14 | public static void WriteLogAudit(int status) 15 | { 16 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 17 | var filename = filePath[filePath.Length - 1]; 18 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 19 | } 20 | 21 | public static void Run() 22 | { 23 | try 24 | { 25 | // Setting up Merchant Config 26 | var merchantConfig = new MerchantConfig 27 | { 28 | RequestTarget = RequestTarget, 29 | RequestType = Enumerations.RequestType.GET.ToString() 30 | }; 31 | 32 | // Call to the Controller of API_SDK 33 | var apiController = new APIController(merchantConfig); 34 | var response = apiController.GetPayment(); 35 | 36 | // printing the response details 37 | if (response != null) 38 | { 39 | Console.WriteLine("\n v-c-correlation-id:{0}", response.GetResponseHeaderValue(response.Headers, "v-c-correlation-id")); 40 | Console.WriteLine("\n Response Code:{0}", response.StatusCode); 41 | Console.WriteLine("\n Response Message:{0}", response.Data); 42 | WriteLogAudit(response.StatusCode); 43 | } 44 | } 45 | catch (Exception e) 46 | { 47 | Console.WriteLine(e.Message); 48 | Console.WriteLine(e.StackTrace); 49 | } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /Source/Samples/Authentication/CallHttpMethods/GetObjectMethod.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ApiSdk.controller; 3 | using AuthenticationSdk.core; 4 | using AuthenticationSdk.util; 5 | using SampleCode.data; 6 | 7 | namespace Cybersource_rest_samples_dotnet.Samples.Authentication 8 | { 9 | public class GetObjectMethod 10 | { 11 | // GET request to retrieve the payment details of the provided Payment ID 12 | // Below Request fetches the payment details of payment ID: 5319754772076048103525 13 | private const string RequestTarget = "/pts/v2/payments/5526478103126428303006"; 14 | 15 | public static void WriteLogAudit(int status) 16 | { 17 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 18 | var filename = filePath[filePath.Length - 1]; 19 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 20 | } 21 | 22 | public static void Run() 23 | { 24 | try 25 | { 26 | // Creating a dictionary object which contains the merchant configuration 27 | var config = new Configuration(); 28 | 29 | // Passing the dictionary object to the Merchant Config Constructor to bypass the config set up via App.Config File 30 | var merchantConfig = new MerchantConfig(config.GetConfiguration()) 31 | { 32 | RequestTarget = RequestTarget, 33 | RequestType = Enumerations.RequestType.GET.ToString() 34 | }; 35 | 36 | // Call to the Controller of API_SDK 37 | var apiController = new APIController(merchantConfig); 38 | var response = apiController.GetPayment(); 39 | 40 | // printing the response details 41 | if (response != null) 42 | { 43 | Console.WriteLine("\n v-c-correlation-id:{0}", response.GetResponseHeaderValue(response.Headers, "v-c-correlation-id")); 44 | Console.WriteLine("\n Response Code:{0}", response.StatusCode); 45 | Console.WriteLine("\n Response Message:{0}", response.Data); 46 | WriteLogAudit(response.StatusCode); 47 | } 48 | } 49 | catch (Exception e) 50 | { 51 | Console.WriteLine(e.Message); 52 | Console.WriteLine(e.StackTrace); 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Source/Samples/Authentication/CallHttpMethods/PostMethod.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using ApiSdk.controller; 4 | using AuthenticationSdk.core; 5 | using AuthenticationSdk.util; 6 | using SampleCode.data; 7 | 8 | namespace Cybersource_rest_samples_dotnet.Samples.Authentication 9 | { 10 | public class PostMethod 11 | { 12 | // POST Request to Authorize the payment for a transaction. 13 | // Transaction details provided in the JSON File are sent along with the Request as Request Body 14 | private const string RequestTarget = "/pts/v2/payments/"; 15 | private static string RequestJsonFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "../../../Source/Resource/request_payments.json").ToString(); 16 | 17 | public static void WriteLogAudit(int status) 18 | { 19 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 20 | var filename = filePath[filePath.Length - 1]; 21 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 22 | } 23 | 24 | public static void Run() 25 | { 26 | try 27 | { 28 | var requestData = new RequestData(); 29 | 30 | // Setting up Merchant Config 31 | var merchantConfig = new MerchantConfig 32 | { 33 | RequestTarget = RequestTarget, 34 | RequestType = Enumerations.RequestType.POST.ToString(), 35 | RequestJsonData = requestData.JsonFileData(RequestJsonFilePath) 36 | }; 37 | 38 | // Call to the Controller of API_SDK 39 | var apiController = new APIController(merchantConfig); 40 | var response = apiController.PostPayment(); 41 | 42 | // printing the response details 43 | if (response != null) 44 | { 45 | Console.WriteLine("\n v-c-correlation-id:{0}", response.GetResponseHeaderValue(response.Headers, "v-c-correlation-id")); 46 | Console.WriteLine("\n Response Code:{0}", response.StatusCode); 47 | Console.WriteLine("\n Response Message:{0}", response.Data); 48 | WriteLogAudit(response.StatusCode); 49 | } 50 | } 51 | catch (Exception e) 52 | { 53 | Console.WriteLine(e.Message); 54 | Console.WriteLine(e.StackTrace); 55 | } 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /Source/Samples/Authentication/CallHttpMethods/PostObjectMethod.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ApiSdk.controller; 3 | using AuthenticationSdk.core; 4 | using AuthenticationSdk.util; 5 | using SampleCode.data; 6 | 7 | namespace Cybersource_rest_samples_dotnet.Samples.Authentication 8 | { 9 | public class PostObjectMethod 10 | { 11 | // POST Request to Authorize the payment for a transaction. 12 | // Transaction details are sent along with the Request as Request Body 13 | private const string RequestTarget = "/pts/v2/payments/"; 14 | 15 | public static void WriteLogAudit(int status) 16 | { 17 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 18 | var filename = filePath[filePath.Length - 1]; 19 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 20 | } 21 | 22 | public static void Run() 23 | { 24 | try 25 | { 26 | // Setting up Merchant Config 27 | var config = new Configuration(); 28 | 29 | // Setting RequestJson Data using the sample payments data (instead of reading a JSON file) 30 | var requestData = new RequestData(); 31 | 32 | var merchantConfig = new MerchantConfig(config.GetConfiguration()) 33 | { 34 | RequestTarget = RequestTarget, 35 | RequestType = Enumerations.RequestType.POST.ToString(), 36 | RequestJsonData = requestData.SamplePaymentsData() 37 | }; 38 | 39 | // Call to the Controller of API_SDK 40 | var apiController = new APIController(merchantConfig); 41 | var response = apiController.PostPayment(); 42 | 43 | // printing the response details 44 | if (response != null) 45 | { 46 | Console.WriteLine("\n v-c-correlation-id:{0}", response.GetResponseHeaderValue(response.Headers, "v-c-correlation-id")); 47 | Console.WriteLine("\n Response Code:{0}", response.StatusCode); 48 | Console.WriteLine("\n Response Message:{0}", response.Data); 49 | WriteLogAudit(response.StatusCode); 50 | } 51 | } 52 | catch (Exception e) 53 | { 54 | Console.WriteLine(e.Message); 55 | Console.WriteLine(e.StackTrace); 56 | } 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Source/Samples/BinLookup/BINLookupWithCard.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.BinLookup 10 | { 11 | public class BINLookupWithCard 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | public static InlineResponse2011 Run() 20 | { 21 | Binv1binlookupClientReferenceInformation clientReferenceInformation = new Binv1binlookupClientReferenceInformation( 22 | ); 23 | 24 | string paymentInformationCardNumber = "4111111111111111"; 25 | Binv1binlookupPaymentInformationCard paymentInformationCard = new Binv1binlookupPaymentInformationCard( 26 | Number: paymentInformationCardNumber 27 | ); 28 | 29 | Binv1binlookupPaymentInformation paymentInformation = new Binv1binlookupPaymentInformation( 30 | Card: paymentInformationCard 31 | ); 32 | 33 | var requestObj = new CreateBinLookupRequest( 34 | ClientReferenceInformation: clientReferenceInformation, 35 | PaymentInformation: paymentInformation 36 | ); 37 | 38 | try 39 | { 40 | var configDictionary = new Configuration().GetConfiguration(); 41 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 42 | 43 | var apiInstance = new BinLookupApi(clientConfig); 44 | InlineResponse2011 result = apiInstance.GetAccountInfo(requestObj); 45 | Console.WriteLine(result); 46 | WriteLogAudit(apiInstance.GetStatusCode()); 47 | return result; 48 | } 49 | catch (ApiException e) 50 | { 51 | Console.WriteLine("Exception on calling the API : " + e.Message); 52 | WriteLogAudit(e.ErrorCode); 53 | return null; 54 | } 55 | catch (Exception e) 56 | { 57 | Console.WriteLine("Exception on calling the API : " + e.Message); 58 | WriteLogAudit(999); 59 | return null; 60 | } 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /Source/Samples/BinLookup/BINLookupWithHealthcareCard.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.BinLookup 10 | { 11 | public class BINLookupWithHealthcareCard 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | public static InlineResponse2011 Run() 20 | { 21 | string paymentInformationCardNumber = "4288900100000"; 22 | Binv1binlookupPaymentInformationCard paymentInformationCard = new Binv1binlookupPaymentInformationCard( 23 | Number: paymentInformationCardNumber 24 | ); 25 | 26 | Binv1binlookupPaymentInformation paymentInformation = new Binv1binlookupPaymentInformation( 27 | Card: paymentInformationCard 28 | ); 29 | 30 | var requestObj = new CreateBinLookupRequest( 31 | PaymentInformation: paymentInformation 32 | ); 33 | 34 | try 35 | { 36 | var configDictionary = new Configuration().GetConfiguration(); 37 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 38 | 39 | var apiInstance = new BinLookupApi(clientConfig); 40 | InlineResponse2011 result= apiInstance.GetAccountInfo(requestObj); 41 | Console.WriteLine(result); 42 | WriteLogAudit(apiInstance.GetStatusCode()); 43 | return result; 44 | } 45 | catch (ApiException e) 46 | { 47 | Console.WriteLine("Exception on calling the API : " + e.Message); 48 | WriteLogAudit(e.ErrorCode); 49 | return null; 50 | } 51 | catch (Exception e) 52 | { 53 | Console.WriteLine("Exception on calling the API : " + e.Message); 54 | WriteLogAudit(999); 55 | return null; 56 | } 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Source/Samples/BinLookup/BINLookupWithNetworkToken.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.BinLookup 10 | { 11 | public class BINLookupWithNetworkToken 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | public static InlineResponse2011 Run() 20 | { 21 | string paymentInformationCardNumber = "4895370016313691"; 22 | Binv1binlookupPaymentInformationCard paymentInformationCard = new Binv1binlookupPaymentInformationCard( 23 | Number: paymentInformationCardNumber 24 | ); 25 | 26 | Binv1binlookupPaymentInformation paymentInformation = new Binv1binlookupPaymentInformation( 27 | Card: paymentInformationCard 28 | ); 29 | 30 | var requestObj = new CreateBinLookupRequest( 31 | PaymentInformation: paymentInformation 32 | ); 33 | 34 | try 35 | { 36 | var configDictionary = new Configuration().GetConfiguration(); 37 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 38 | 39 | var apiInstance = new BinLookupApi(clientConfig); 40 | InlineResponse2011 result= apiInstance.GetAccountInfo(requestObj); 41 | Console.WriteLine(result); 42 | WriteLogAudit(apiInstance.GetStatusCode()); 43 | return result; 44 | } 45 | catch (ApiException e) 46 | { 47 | Console.WriteLine("Exception on calling the API : " + e.Message); 48 | WriteLogAudit(e.ErrorCode); 49 | return null; 50 | } 51 | catch (Exception e) 52 | { 53 | Console.WriteLine("Exception on calling the API : " + e.Message); 54 | WriteLogAudit(999); 55 | return null; 56 | } 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Source/Samples/BinLookup/BINLookupWithTMSCustomerID.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.BinLookup 10 | { 11 | public class BINLookupWithTMSCustomerID 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | public static InlineResponse2011 Run() 20 | { 21 | string paymentInformationCustomerId = "E5426CFDE77F7390E053A2598D0A925D"; 22 | GetAllSubscriptionsResponsePaymentInformationCustomer paymentInformationCustomer = new GetAllSubscriptionsResponsePaymentInformationCustomer( 23 | Id: paymentInformationCustomerId 24 | ); 25 | 26 | Binv1binlookupPaymentInformation paymentInformation = new Binv1binlookupPaymentInformation( 27 | Customer: paymentInformationCustomer 28 | ); 29 | 30 | var requestObj = new CreateBinLookupRequest( 31 | PaymentInformation: paymentInformation 32 | ); 33 | 34 | try 35 | { 36 | var configDictionary = new Configuration().GetConfiguration(); 37 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 38 | 39 | var apiInstance = new BinLookupApi(clientConfig); 40 | InlineResponse2011 result= apiInstance.GetAccountInfo(requestObj); 41 | Console.WriteLine(result); 42 | WriteLogAudit(apiInstance.GetStatusCode()); 43 | return result; 44 | } 45 | catch (ApiException e) 46 | { 47 | Console.WriteLine("Exception on calling the API : " + e.Message); 48 | WriteLogAudit(e.ErrorCode); 49 | return null; 50 | } 51 | catch (Exception e) 52 | { 53 | Console.WriteLine("Exception on calling the API : " + e.Message); 54 | WriteLogAudit(999); 55 | return null; 56 | } 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Source/Samples/BinLookup/BINLookupWithTMSInstrumentIdentifier.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.BinLookup 10 | { 11 | public class BINLookupWithTMSInstrumentIdentifier 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | public static InlineResponse2011 Run() 20 | { 21 | string paymentInformationInstrumentIdentifierId = "7010000000016241111"; 22 | Ptsv2paymentsPaymentInformationInstrumentIdentifier paymentInformationInstrumentIdentifier = new Ptsv2paymentsPaymentInformationInstrumentIdentifier( 23 | Id: paymentInformationInstrumentIdentifierId 24 | ); 25 | 26 | Binv1binlookupPaymentInformation paymentInformation = new Binv1binlookupPaymentInformation( 27 | InstrumentIdentifier: paymentInformationInstrumentIdentifier 28 | ); 29 | 30 | var requestObj = new CreateBinLookupRequest( 31 | PaymentInformation: paymentInformation 32 | ); 33 | 34 | try 35 | { 36 | var configDictionary = new Configuration().GetConfiguration(); 37 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 38 | 39 | var apiInstance = new BinLookupApi(clientConfig); 40 | InlineResponse2011 result = apiInstance.GetAccountInfo(requestObj); 41 | Console.WriteLine(result); 42 | WriteLogAudit(apiInstance.GetStatusCode()); 43 | return result; 44 | } 45 | catch (ApiException e) 46 | { 47 | Console.WriteLine("Exception on calling the API : " + e.Message); 48 | WriteLogAudit(e.ErrorCode); 49 | return null; 50 | } 51 | catch (Exception e) 52 | { 53 | Console.WriteLine("Exception on calling the API : " + e.Message); 54 | WriteLogAudit(999); 55 | return null; 56 | } 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Source/Samples/BinLookup/BINLookupWithTMSJWTTransientToken.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.BinLookup 10 | { 11 | public class BINLookupWithTMSJWTTransientToken 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | public static InlineResponse2011 Run() 20 | { 21 | string tokenInformationTransientTokenJwt = "eyJraWQiOiIwODd0bk1DNU04bXJHR3JHMVJQTkwzZ2VyRUh5VWV1ciIsImFsZyI6IlJTMjU2In0.eyJpc3MiOiJGbGV4LzA4IiwiZXhwIjoxNjYwMTk1ODcwLCJ0eXBlIjoiYXBpLTAuMS4wIiwiaWF0IjoxNjYwMTk0OTcwLCJqdGkiOiIxRTBXQzFHTzg3SkcxQkRQMENROFNDUjFUVEs4NlU5Tjk4SDNXSDhJRk05TVZFV1RJWUZJNjJGNDk0MUU3QTkyIiwiY29udGVudCI6eyJwYXltZW50SW5mb3JtYXRpb24iOnsiY2FyZCI6eyJudW1iZXIiOnsibWFza2VkVmFsdWUiOiJYWFhYWFhYWFhYWFgxMTExIiwiYmluIjoiNDExMTExIn0sInR5cGUiOnsidmFsdWUiOiIwMDEifX19fX0.MkCLbyvufN4prGRvHJcqCu1WceDVlgubZVpShNWQVjpuFQUuqwrKg284sC7ucVKuIsOU0DTN8_OoxDLduvZhS7X_5TnO0QjyA_aFxbRBvU_bEz1l9V99VPADG89T-fox_L6sLUaoTJ8T4PyD7rkPHEA0nmXbqQCVqw4Czc5TqlKCwmL-Fe0NBR2HlOFI1PrSXT-7_wI-JTgXI0dQzb8Ub20erHwOLwu3oni4_ZmS3rGI_gxq2MHi8pO-ZOgA597be4WfVFAx1wnMbareqR72a0QM4DefeoltrpNqXSaASVyb5G0zuqg-BOjWJbawmg2QgcZ_vE3rJ6PDgWROvp9Tbw"; 22 | Binv1binlookupTokenInformation tokenInformation = new Binv1binlookupTokenInformation( 23 | TransientTokenJwt: tokenInformationTransientTokenJwt 24 | ); 25 | 26 | var requestObj = new CreateBinLookupRequest( 27 | TokenInformation: tokenInformation 28 | ); 29 | 30 | try 31 | { 32 | var configDictionary = new Configuration().GetConfiguration(); 33 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 34 | 35 | var apiInstance = new BinLookupApi(clientConfig); 36 | InlineResponse2011 result = apiInstance.GetAccountInfo(requestObj); 37 | Console.WriteLine(result); 38 | WriteLogAudit(apiInstance.GetStatusCode()); 39 | return result; 40 | } 41 | catch (ApiException e) 42 | { 43 | Console.WriteLine("Exception on calling the API : " + e.Message); 44 | WriteLogAudit(e.ErrorCode); 45 | return null; 46 | } 47 | catch (Exception e) 48 | { 49 | Console.WriteLine("Exception on calling the API : " + e.Message); 50 | WriteLogAudit(999); 51 | return null; 52 | } 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /Source/Samples/BinLookup/BINLookupWithTMSJtiTransientToken.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.BinLookup 10 | { 11 | public class BINLookupWithTMSJtiTransientToken 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | public static InlineResponse2011 Run() 20 | { 21 | string tokenInformationJti = "1E0WC1GO87JG1BDP0CQ8SCR1TTK86U9N98H3WH8IFM9MVEWTIYFI62F4941E7A92"; 22 | Binv1binlookupTokenInformation tokenInformation = new Binv1binlookupTokenInformation( 23 | Jti: tokenInformationJti 24 | ); 25 | 26 | var requestObj = new CreateBinLookupRequest( 27 | TokenInformation: tokenInformation 28 | ); 29 | 30 | try 31 | { 32 | var configDictionary = new Configuration().GetConfiguration(); 33 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 34 | 35 | var apiInstance = new BinLookupApi(clientConfig); 36 | InlineResponse2011 result = apiInstance.GetAccountInfo(requestObj); 37 | Console.WriteLine(result); 38 | WriteLogAudit(apiInstance.GetStatusCode()); 39 | return result; 40 | } 41 | catch (ApiException e) 42 | { 43 | Console.WriteLine("Exception on calling the API : " + e.Message); 44 | WriteLogAudit(e.ErrorCode); 45 | return null; 46 | } 47 | catch (Exception e) 48 | { 49 | Console.WriteLine("Exception on calling the API : " + e.Message); 50 | WriteLogAudit(999); 51 | return null; 52 | } 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /Source/Samples/BinLookup/BINLookupWithTMSPaymentInstrument.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.BinLookup 10 | { 11 | public class BINLookupWithTMSPaymentInstrument 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | public static InlineResponse2011 Run() 20 | { 21 | string paymentInformationPaymentInstrumentId = "E5427539180789D0E053A2598D0AF053"; 22 | Ptsv2paymentsPaymentInformationPaymentInstrument paymentInformationPaymentInstrument = new Ptsv2paymentsPaymentInformationPaymentInstrument( 23 | Id: paymentInformationPaymentInstrumentId 24 | ); 25 | 26 | Binv1binlookupPaymentInformation paymentInformation = new Binv1binlookupPaymentInformation( 27 | PaymentInstrument: paymentInformationPaymentInstrument 28 | ); 29 | 30 | var requestObj = new CreateBinLookupRequest( 31 | PaymentInformation: paymentInformation 32 | ); 33 | 34 | try 35 | { 36 | var configDictionary = new Configuration().GetConfiguration(); 37 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 38 | 39 | var apiInstance = new BinLookupApi(clientConfig); 40 | InlineResponse2011 result = apiInstance.GetAccountInfo(requestObj); 41 | Console.WriteLine(result); 42 | WriteLogAudit(apiInstance.GetStatusCode()); 43 | return result; 44 | } 45 | catch (ApiException e) 46 | { 47 | Console.WriteLine("Exception on calling the API : " + e.Message); 48 | WriteLogAudit(e.ErrorCode); 49 | return null; 50 | } 51 | catch (Exception e) 52 | { 53 | Console.WriteLine("Exception on calling the API : " + e.Message); 54 | WriteLogAudit(999); 55 | return null; 56 | } 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Source/Samples/FlexMicroform/GenerateCaptureContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using CyberSource.Api; 8 | using CyberSource.Model; 9 | 10 | namespace Cybersource_rest_samples_dotnet.Samples.FlexMicroform 11 | { 12 | class GenerateCaptureContext 13 | { 14 | // public static String Run() 15 | // { 16 | // List targetOrigins = new List() 17 | // { 18 | // "https://www.test.com" 19 | // }; 20 | 21 | // List allowedCardNetworks = new List() 22 | // { 23 | // "VISA", 24 | // "MAESTRO", 25 | // "MASTERCARD", 26 | // "AMEX", 27 | // "DISCOVER", 28 | // "DINERSCLUB", 29 | // "JCB", 30 | // "CUP", 31 | // "CARTESBANCAIRES" 32 | // }; 33 | 34 | // string clientVerison = "v2.0"; 35 | 36 | // var requestObj = new GenerateCaptureContextRequest( 37 | // TargetOrigins: targetOrigins, 38 | // AllowedCardNetworks: allowedCardNetworks, 39 | // ClientVersion: clientVerison 40 | // ); 41 | 42 | // try 43 | // { 44 | // var configDictionary = new Configuration().GetConfiguration(); 45 | // var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 46 | 47 | // var apiInstance = new MicroformIntegrationApi(clientConfig); 48 | // String result = apiInstance.GenerateCaptureContext(requestObj); 49 | // Console.WriteLine(result); 50 | // return result; 51 | // } 52 | // catch (Exception e) 53 | // { 54 | // Console.WriteLine("Exception on calling the API : " + e.Message); 55 | // return null; 56 | // } 57 | // } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Source/Samples/FlexMicroform/GenerateCaptureContextAcceptCheck.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using CyberSource.Api; 8 | using CyberSource.Model; 9 | 10 | namespace Cybersource_rest_samples_dotnet.Samples.FlexMicroform 11 | { 12 | class GenerateCaptureContextAcceptCheck 13 | { 14 | public static void WriteLogAudit(int status) 15 | { 16 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 17 | var filename = filePath[filePath.Length - 1]; 18 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 19 | } 20 | 21 | public static String Run() 22 | { 23 | string clientVersion = "v2"; 24 | 25 | List targetOrigins = new List(); 26 | targetOrigins.Add("https://www.test.com"); 27 | List allowedPaymentTypes = new List(); 28 | allowedPaymentTypes.Add("CHECK"); 29 | var requestObj = new GenerateCaptureContextRequest( 30 | ClientVersion: clientVersion, 31 | TargetOrigins: targetOrigins, 32 | AllowedPaymentTypes: allowedPaymentTypes); 33 | 34 | try 35 | { 36 | var configDictionary = new Configuration().GetConfiguration(); 37 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 38 | 39 | var apiInstance = new MicroformIntegrationApi(clientConfig); 40 | String result = apiInstance.GenerateCaptureContext(requestObj); 41 | Console.WriteLine(result); 42 | WriteLogAudit(apiInstance.GetStatusCode()); 43 | return result; 44 | } 45 | catch (Exception e) 46 | { 47 | Console.WriteLine("Exception on calling the API : " + e.Message); 48 | return null; 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Source/Samples/FlexMicroform/GenerateKey.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.FlexMicroform 10 | { 11 | public class GenerateKey 12 | { 13 | /*public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static FlexV1KeysPost200Response Run() 21 | { 22 | string encryptionType = "RsaOaep"; 23 | string targetOrigin = "https://www.test.com"; 24 | var requestObj = new GeneratePublicKeyRequest( 25 | EncryptionType: encryptionType, 26 | TargetOrigin: targetOrigin 27 | ); 28 | 29 | string format = "JWT"; 30 | try 31 | { 32 | var configDictionary = new Configuration().GetConfiguration(); 33 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 34 | 35 | var apiInstance = new KeyGenerationApi(clientConfig); 36 | FlexV1KeysPost200Response result = apiInstance.GeneratePublicKey(format, requestObj); 37 | Console.WriteLine(result); 38 | WriteLogAudit(apiInstance.GetStatusCode()); 39 | return result; 40 | } 41 | catch (ApiException e) 42 | { 43 | Console.WriteLine("Exception on calling the API : " + e.Message); 44 | WriteLogAudit(e.ErrorCode); 45 | return null; 46 | } 47 | }*/ 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Source/Samples/FlexMicroform/GenerateKeyLegacyTokenFormat.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.FlexMicroform 10 | { 11 | /*public class GenerateKeyLegacyTokenFormat 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static FlexV1KeysPost200Response Run() 21 | { 22 | string encryptionType = "None"; 23 | string targetOrigin = "https://www.test.com"; 24 | var requestObj = new GeneratePublicKeyRequest( 25 | EncryptionType: encryptionType, 26 | TargetOrigin: targetOrigin 27 | ); 28 | 29 | string format = "legacy"; 30 | try 31 | { 32 | var configDictionary = new Configuration().GetConfiguration(); 33 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 34 | 35 | var apiInstance = new KeyGenerationApi(clientConfig); 36 | FlexV1KeysPost200Response result = apiInstance.GeneratePublicKey(format, requestObj); 37 | Console.WriteLine(result); 38 | WriteLogAudit(apiInstance.GetStatusCode()); 39 | return result; 40 | } 41 | catch (ApiException e) 42 | { 43 | Console.WriteLine("Exception on calling the API : " + e.Message); 44 | WriteLogAudit(e.ErrorCode); 45 | return null; 46 | } 47 | } 48 | }*/ 49 | 50 | } 51 | -------------------------------------------------------------------------------- /Source/Samples/Invoicing/InvoiceSettings/GetInvoiceSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Invoicing 10 | { 11 | public class GetInvoiceSettings 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static InvoicingV2InvoiceSettingsGet200Response Run() 21 | { 22 | try 23 | { 24 | var configDictionary = new Configuration().GetConfiguration(); 25 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 26 | 27 | var apiInstance = new InvoiceSettingsApi(clientConfig); 28 | InvoicingV2InvoiceSettingsGet200Response result = apiInstance.GetInvoiceSettings(); 29 | Console.WriteLine(result); 30 | WriteLogAudit(apiInstance.GetStatusCode()); 31 | return result; 32 | } 33 | catch (ApiException e) 34 | { 35 | Console.WriteLine("Exception on calling the API : " + e.Message); 36 | WriteLogAudit(e.ErrorCode); 37 | return null; 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Source/Samples/Invoicing/Invoices/CancelInvoice.cs: -------------------------------------------------------------------------------- 1 | using CyberSource.Api; 2 | using CyberSource.Model; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Invoicing 10 | { 11 | public class CancelInvoice 12 | { 13 | public static InvoicingV2InvoicesCancel200Response Run() 14 | { 15 | try 16 | { 17 | var invoiceId = CreateDraftInvoice.Run().Id; 18 | var configDictionary = new Configuration().GetConfiguration(); 19 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 20 | 21 | var apiInstance = new InvoicesApi(clientConfig); 22 | InvoicingV2InvoicesCancel200Response result = apiInstance.PerformCancelAction(invoiceId); 23 | Console.WriteLine(result); 24 | return result; 25 | } 26 | catch (Exception e) 27 | { 28 | Console.WriteLine("Exception on calling the API : " + e.Message); 29 | return null; 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Source/Samples/Invoicing/Invoices/GetInvoiceDetails.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Invoicing 10 | { 11 | public class GetInvoiceDetails 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static InvoicingV2InvoicesGet200Response Run() 21 | { 22 | string id = CreateDraftInvoice.Run().Id; 23 | try 24 | { 25 | var configDictionary = new Configuration().GetConfiguration(); 26 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 27 | 28 | var apiInstance = new InvoicesApi(clientConfig); 29 | InvoicingV2InvoicesGet200Response result = apiInstance.GetInvoice(id); 30 | Console.WriteLine(result); 31 | WriteLogAudit(apiInstance.GetStatusCode()); 32 | return result; 33 | } 34 | catch (ApiException e) 35 | { 36 | Console.WriteLine("Exception on calling the API : " + e.Message); 37 | WriteLogAudit(e.ErrorCode); 38 | return null; 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Source/Samples/Invoicing/Invoices/GetListOfInvoices.cs: -------------------------------------------------------------------------------- 1 | using CyberSource.Api; 2 | using CyberSource.Model; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Invoicing 10 | { 11 | public class GetListOfInvoices 12 | { 13 | public static InvoicingV2InvoicesAllGet200Response Run() 14 | { 15 | int offset = 0; 16 | int limit = 10; 17 | string query = null; 18 | 19 | try 20 | { 21 | var configDictionary = new Configuration().GetConfiguration(); 22 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 23 | 24 | var apiInstance = new InvoicesApi(clientConfig); 25 | InvoicingV2InvoicesAllGet200Response result = apiInstance.GetAllInvoices(offset, limit, query); 26 | Console.WriteLine(result); 27 | return result; 28 | } 29 | catch (Exception e) 30 | { 31 | Console.WriteLine("Exception on calling the API : " + e.Message); 32 | return null; 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Source/Samples/Invoicing/Invoices/SendInvoice.cs: -------------------------------------------------------------------------------- 1 | using CyberSource.Api; 2 | using CyberSource.Model; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Invoicing 10 | { 11 | public class SendInvoice 12 | { 13 | public static InvoicingV2InvoicesSend200Response Run() 14 | { 15 | try 16 | { 17 | var invoiceId = CreateDraftInvoice.Run().Id; 18 | var configDictionary = new Configuration().GetConfiguration(); 19 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 20 | 21 | var apiInstance = new InvoicesApi(clientConfig); 22 | InvoicingV2InvoicesSend200Response result = apiInstance.PerformSendAction(invoiceId); 23 | Console.WriteLine(result); 24 | return result; 25 | } 26 | catch (Exception e) 27 | { 28 | Console.WriteLine("Exception on calling the API : " + e.Message); 29 | return null; 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Source/Samples/NetworkToken/CreateInstrumentIdentifierEnrollForNetworkToken.cs: -------------------------------------------------------------------------------- 1 | using CyberSource.Api; 2 | using CyberSource.Model; 3 | using System; 4 | 5 | namespace Cybersource_rest_samples_dotnet.Samples.NetworkToken 6 | { 7 | public class CreateInstrumentIdentifierEnrollForNetworkToken 8 | { 9 | public static PostInstrumentIdentifierRequest Run() 10 | { 11 | var profileid = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; 12 | string type = "enrollable card"; 13 | string cardNumber = "5204245750003216"; 14 | string cardExpirationMonth = "12"; 15 | string cardExpirationYear = "2025"; 16 | TmsEmbeddedInstrumentIdentifierCard card = new TmsEmbeddedInstrumentIdentifierCard( 17 | Number: cardNumber, 18 | ExpirationMonth: cardExpirationMonth, 19 | ExpirationYear: cardExpirationYear 20 | ); 21 | var requestObj = new PostInstrumentIdentifierRequest( 22 | Type: type, 23 | Card: card 24 | ); 25 | try 26 | { 27 | var configDictionary = new Configuration().GetConfiguration(); 28 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 29 | 30 | var apiInstance = new InstrumentIdentifierApi(clientConfig); 31 | PostInstrumentIdentifierRequest result = apiInstance.PostInstrumentIdentifier(requestObj, profileid); 32 | Console.WriteLine(result); 33 | return result; 34 | } 35 | catch (Exception e) 36 | { 37 | Console.WriteLine("Exception on calling the API : " + e.Message); 38 | return null; 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Source/Samples/NetworkToken/NetworkToken.cs: -------------------------------------------------------------------------------- 1 | using CyberSource.Utilities; 2 | 3 | using System.Collections.Generic; 4 | using AuthenticationSdk.core; 5 | using System; 6 | using CyberSource.Model; 7 | using System.Security.Cryptography; 8 | using System.IO; 9 | using Org.BouncyCastle.OpenSsl; 10 | using Org.BouncyCastle.Crypto; 11 | using Org.BouncyCastle.Security; 12 | using Org.BouncyCastle.Crypto.Parameters; 13 | 14 | namespace Cybersource_rest_samples_dotnet.Samples.NetworkToken 15 | { 16 | public class NetworkToken 17 | { 18 | public static String Run() 19 | { 20 | 21 | Dictionary configDictionary = new Configuration().GetConfiguration(); 22 | 23 | MerchantConfig merchantConfig = new MerchantConfig(configDictionary); 24 | 25 | try 26 | { 27 | // Step-I 28 | PostInstrumentIdentifierRequest createInstrumentIdentifierEnrollForNetworkTokenResponse = CreateInstrumentIdentifierEnrollForNetworkToken.Run(); 29 | 30 | //Step-II 31 | var encodedResponse = PaymentCredentialsFromNetworkToken.Run(createInstrumentIdentifierEnrollForNetworkTokenResponse.Id); 32 | 33 | //Step-III 34 | //The following method JWEUtility.DecryptJWEResponse(string, MerchantConfig) has been deprecated. 35 | //var result = JWEUtility.DecryptJWEResponse(encodedResponse, merchantConfig); 36 | 37 | //Using the new method JWEUtility.DecryptJWEResponse(RSAParamet ers, string) instead 38 | RSAParameters rsaParams = FetchRSAParametersFromFile(merchantConfig.PemFileDirectory); 39 | var result = JWEUtility.DecryptJWEResponse(rsaParams, encodedResponse); 40 | 41 | Console.WriteLine(result); 42 | return result; 43 | } 44 | catch (Exception e) 45 | { 46 | Console.WriteLine("Exception while decrypting the JWE Response : " + e.Message); 47 | return null; 48 | } 49 | } 50 | 51 | private static RSAParameters FetchRSAParametersFromFile(string pemFileDirectory) 52 | { 53 | var privateKey = File.ReadAllText(pemFileDirectory); 54 | PemReader pemReader = new PemReader(new StringReader(privateKey)); 55 | RsaPrivateCrtKeyParameters keyPair = (RsaPrivateCrtKeyParameters) pemReader.ReadObject(); 56 | return DotNetUtilities.ToRSAParameters((RsaPrivateCrtKeyParameters)keyPair); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Source/Samples/NetworkToken/PaymentCredentialsFromNetworkToken.cs: -------------------------------------------------------------------------------- 1 | using CyberSource.Api; 2 | using CyberSource.Model; 3 | using System; 4 | 5 | namespace Cybersource_rest_samples_dotnet.Samples.NetworkToken 6 | { 7 | public class PaymentCredentialsFromNetworkToken 8 | { 9 | public static string Run(string TokenId = null) 10 | { 11 | var profileid = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; 12 | if (null == TokenId) 13 | { 14 | TokenId = CreateInstrumentIdentifierEnrollForNetworkToken.Run().Id; 15 | } 16 | try 17 | { 18 | var configDictionary = new Configuration().GetConfiguration(); 19 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 20 | 21 | var apiInstance = new TokenApi(clientConfig); 22 | var postPaymentCredentialsRequest = new PostPaymentCredentialsRequest(); 23 | var result = apiInstance.PostTokenPaymentCredentials(TokenId, postPaymentCredentialsRequest, profileid); 24 | Console.WriteLine(result); 25 | return result; 26 | } 27 | catch (Exception e) 28 | { 29 | Console.WriteLine("Exception on calling the API : " + e.Message); 30 | return null; 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Source/Samples/PayerAuthentication/SetupCompletionWithFlexTransientToken.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.PayerAuthentication 10 | { 11 | public class SetupCompletionWithFlexTransientToken 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static RiskV1AuthenticationSetupsPost201Response Run() 21 | { 22 | string clientReferenceInformationCode = "cybs_test"; 23 | Riskv1authenticationsetupsClientReferenceInformation clientReferenceInformation = new Riskv1authenticationsetupsClientReferenceInformation( 24 | Code: clientReferenceInformationCode 25 | ); 26 | 27 | string tokenInformationTransientToken = "1D5ZX4HMOV20FKEBE3IO240JWYJ0NJ90B4V9XQ6SCK4BDN0W96E65E2A39052056"; 28 | Riskv1authenticationsetupsTokenInformation tokenInformation = new Riskv1authenticationsetupsTokenInformation( 29 | TransientToken: tokenInformationTransientToken 30 | ); 31 | 32 | var requestObj = new PayerAuthSetupRequest( 33 | ClientReferenceInformation: clientReferenceInformation, 34 | TokenInformation: tokenInformation 35 | ); 36 | 37 | try 38 | { 39 | var configDictionary = new Configuration().GetConfiguration(); 40 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 41 | 42 | var apiInstance = new PayerAuthenticationApi(clientConfig); 43 | RiskV1AuthenticationSetupsPost201Response result = apiInstance.PayerAuthSetup(requestObj); 44 | Console.WriteLine(result); 45 | WriteLogAudit(apiInstance.GetStatusCode()); 46 | return result; 47 | } 48 | catch (ApiException e) 49 | { 50 | Console.WriteLine("Exception on calling the API : " + e.Message); 51 | WriteLogAudit(e.ErrorCode); 52 | return null; 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Source/Samples/Payments/Void/TimeoutVoid.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Payments 10 | { 11 | public class TimeoutVoid 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static PtsV2PaymentsVoidsPost201Response Run() 21 | { 22 | AuthorizationCaptureForTimeoutVoidFlow.Run(); 23 | string clientReferenceInformationTransactionId = SampleCode.TimeoutVoidTransactionId; 24 | Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation( 25 | TransactionId: clientReferenceInformationTransactionId 26 | ); 27 | 28 | var requestObj = new MitVoidRequest( 29 | ClientReferenceInformation: clientReferenceInformation 30 | ); 31 | 32 | try 33 | { 34 | var configDictionary = new Configuration().GetConfiguration(); 35 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 36 | 37 | var apiInstance = new VoidApi(clientConfig); 38 | PtsV2PaymentsVoidsPost201Response result = apiInstance.MitVoid(requestObj); 39 | Console.WriteLine(result); 40 | WriteLogAudit(apiInstance.GetStatusCode()); 41 | return result; 42 | } 43 | catch (ApiException e) 44 | { 45 | Console.WriteLine("Exception on calling the API : " + e.Message); 46 | WriteLogAudit(e.ErrorCode); 47 | return null; 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Source/Samples/Payments/Void/VoidCapture.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Payments 10 | { 11 | public class VoidCapture 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static PtsV2PaymentsVoidsPost201Response Run() 21 | { 22 | var id = CapturePayment.Run().Id; 23 | string clientReferenceInformationCode = "test_void"; 24 | Ptsv2paymentsidreversalsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsidreversalsClientReferenceInformation( 25 | Code: clientReferenceInformationCode 26 | ); 27 | 28 | var requestObj = new VoidCaptureRequest( 29 | ClientReferenceInformation: clientReferenceInformation 30 | ); 31 | 32 | try 33 | { 34 | var configDictionary = new Configuration().GetConfiguration(); 35 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 36 | 37 | var apiInstance = new VoidApi(clientConfig); 38 | PtsV2PaymentsVoidsPost201Response result = apiInstance.VoidCapture(requestObj, id); 39 | Console.WriteLine(result); 40 | WriteLogAudit(apiInstance.GetStatusCode()); 41 | return result; 42 | } 43 | catch (ApiException e) 44 | { 45 | Console.WriteLine("Exception on calling the API : " + e.Message); 46 | WriteLogAudit(e.ErrorCode); 47 | return null; 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Source/Samples/Payments/Void/VoidCredit.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Payments 10 | { 11 | public class VoidCredit 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static PtsV2PaymentsVoidsPost201Response Run() 21 | { 22 | var id = Credit.Run().Id; 23 | 24 | string clientReferenceInformationCode = "test_void"; 25 | Ptsv2paymentsidreversalsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsidreversalsClientReferenceInformation( 26 | Code: clientReferenceInformationCode 27 | ); 28 | 29 | var requestObj = new VoidCreditRequest( 30 | ClientReferenceInformation: clientReferenceInformation 31 | ); 32 | 33 | try 34 | { 35 | var configDictionary = new Configuration().GetConfiguration(); 36 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 37 | 38 | var apiInstance = new VoidApi(clientConfig); 39 | PtsV2PaymentsVoidsPost201Response result = apiInstance.VoidCredit(requestObj, id); 40 | Console.WriteLine(result); 41 | WriteLogAudit(apiInstance.GetStatusCode()); 42 | return result; 43 | } 44 | catch (ApiException e) 45 | { 46 | Console.WriteLine("Exception on calling the API : " + e.Message); 47 | WriteLogAudit(e.ErrorCode); 48 | return null; 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Source/Samples/Payments/Void/VoidPayment.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Payments 10 | { 11 | public class VoidPayment 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static PtsV2PaymentsVoidsPost201Response Run() 21 | { 22 | SimpleAuthorizationInternet.CaptureTrueForProcessPayment = true; 23 | var id = SimpleAuthorizationInternet.Run().Id; 24 | 25 | string clientReferenceInformationCode = "test_void"; 26 | Ptsv2paymentsidreversalsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsidreversalsClientReferenceInformation( 27 | Code: clientReferenceInformationCode 28 | ); 29 | 30 | var requestObj = new VoidPaymentRequest( 31 | ClientReferenceInformation: clientReferenceInformation 32 | ); 33 | 34 | try 35 | { 36 | var configDictionary = new Configuration().GetConfiguration(); 37 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 38 | 39 | var apiInstance = new VoidApi(clientConfig); 40 | PtsV2PaymentsVoidsPost201Response result = apiInstance.VoidPayment(requestObj, id); 41 | Console.WriteLine(result); 42 | WriteLogAudit(apiInstance.GetStatusCode()); 43 | return result; 44 | } 45 | catch (ApiException e) 46 | { 47 | Console.WriteLine("Exception on calling the API : " + e.Message); 48 | WriteLogAudit(e.ErrorCode); 49 | return null; 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Source/Samples/Payments/Void/VoidRefund.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Payments 10 | { 11 | public class VoidRefund 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static PtsV2PaymentsVoidsPost201Response Run() 21 | { 22 | var id = RefundPayment.Run().Id; 23 | 24 | string clientReferenceInformationCode = "test_void"; 25 | Ptsv2paymentsidreversalsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsidreversalsClientReferenceInformation( 26 | Code: clientReferenceInformationCode 27 | ); 28 | 29 | var requestObj = new VoidRefundRequest( 30 | ClientReferenceInformation: clientReferenceInformation 31 | ); 32 | 33 | try 34 | { 35 | var configDictionary = new Configuration().GetConfiguration(); 36 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 37 | 38 | var apiInstance = new VoidApi(clientConfig); 39 | PtsV2PaymentsVoidsPost201Response result = apiInstance.VoidRefund(requestObj, id); 40 | Console.WriteLine(result); 41 | WriteLogAudit(apiInstance.GetStatusCode()); 42 | return result; 43 | } 44 | catch (ApiException e) 45 | { 46 | Console.WriteLine("Exception on calling the API : " + e.Message); 47 | WriteLogAudit(e.ErrorCode); 48 | return null; 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Source/Samples/RecurringBillingSubscriptions/Plans/ActivatePlan.cs: -------------------------------------------------------------------------------- 1 | using CyberSource.Api; 2 | using CyberSource.Model; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.RecurringBillingSubscriptions 10 | { 11 | public class ActivatePlan 12 | { 13 | public static ActivateDeactivatePlanResponse Run() 14 | { 15 | try 16 | { 17 | var planId = CreatePlan.Run().Id; 18 | var configDictionary = new Configuration().GetConfiguration(); 19 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 20 | 21 | var apiInstance = new PlansApi(clientConfig); 22 | var result = apiInstance.ActivatePlan(planId); 23 | Console.WriteLine(result); 24 | return result; 25 | } 26 | catch (Exception e) 27 | { 28 | Console.WriteLine("Exception on calling the API : " + e.Message); 29 | return null; 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Source/Samples/RecurringBillingSubscriptions/Plans/DeactivatePlan.cs: -------------------------------------------------------------------------------- 1 | using CyberSource.Api; 2 | using CyberSource.Model; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.RecurringBillingSubscriptions 10 | { 11 | public class DeactivatePlan 12 | { 13 | public static ActivateDeactivatePlanResponse Run() 14 | { 15 | try 16 | { 17 | var planId = ActivatePlan.Run().Id; 18 | var configDictionary = new Configuration().GetConfiguration(); 19 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 20 | 21 | var apiInstance = new PlansApi(clientConfig); 22 | var result = apiInstance.DeactivatePlan(planId); 23 | Console.WriteLine(result); 24 | return result; 25 | } 26 | catch (Exception e) 27 | { 28 | Console.WriteLine("Exception on calling the API : " + e.Message); 29 | return null; 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Source/Samples/RecurringBillingSubscriptions/Plans/DeletePlan.cs: -------------------------------------------------------------------------------- 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.RecurringBillingSubscriptions 9 | { 10 | public class DeletePlan 11 | { 12 | public static void Run() 13 | { 14 | try 15 | { 16 | var id = CreatePlan.Run().Id; 17 | var configDictionary = new Configuration().GetConfiguration(); 18 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 19 | 20 | var apiInstance = new PlansApi(clientConfig); 21 | apiInstance.DeletePlan(id); 22 | } 23 | catch (Exception e) 24 | { 25 | Console.WriteLine("Exception on calling the API : " + e.Message); 26 | } 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Source/Samples/RecurringBillingSubscriptions/Plans/GetListOfPlans.cs: -------------------------------------------------------------------------------- 1 | using CyberSource.Api; 2 | using CyberSource.Model; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.RecurringBillingSubscriptions 10 | { 11 | public class GetListOfPlans 12 | { 13 | public static GetAllPlansResponse Run() 14 | { 15 | int? offset = (int?)null; 16 | int? limit = (int?)null; 17 | string code = null; 18 | string status = null; 19 | string name = null; 20 | 21 | try 22 | { 23 | var configDictionary = new Configuration().GetConfiguration(); 24 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 25 | 26 | var apiInstance = new PlansApi(clientConfig); 27 | var result = apiInstance.GetPlans(offset, limit, code, status, name); 28 | Console.WriteLine(result); 29 | return result; 30 | } 31 | catch (Exception e) 32 | { 33 | Console.WriteLine("Exception on calling the API : " + e.Message); 34 | return null; 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Source/Samples/RecurringBillingSubscriptions/Plans/GetPlan.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using ApiSdk.model; 5 | using CyberSource.Api; 6 | using CyberSource.Model; 7 | 8 | namespace Cybersource_rest_samples_dotnet.Samples.RecurringBillingSubscriptions 9 | { 10 | public class GetPlan 11 | { 12 | public static GetPlanResponse Run() 13 | { 14 | try 15 | { 16 | var planId = CreatePlan.Run().Id; 17 | var configDictionary = new Configuration().GetConfiguration(); 18 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 19 | 20 | var apiInstance = new PlansApi(clientConfig); 21 | var result = apiInstance.GetPlan(planId); 22 | Console.WriteLine(result); 23 | return result; 24 | } 25 | catch (Exception e) 26 | { 27 | Console.WriteLine("Exception on calling the API : " + e.Message); 28 | return null; 29 | } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /Source/Samples/RecurringBillingSubscriptions/Plans/GetPlanCode.cs: -------------------------------------------------------------------------------- 1 | using CyberSource.Api; 2 | using CyberSource.Model; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.RecurringBillingSubscriptions 10 | { 11 | public class GetPlanCode 12 | { 13 | public static GetPlanCodeResponse Run() 14 | { 15 | try 16 | { 17 | var configDictionary = new Configuration().GetConfiguration(); 18 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 19 | 20 | var apiInstance = new PlansApi(clientConfig); 21 | var result = apiInstance.GetPlanCode(); 22 | Console.WriteLine(result); 23 | return result; 24 | } 25 | catch (Exception e) 26 | { 27 | Console.WriteLine("Exception on calling the API : " + e.Message); 28 | return null; 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Source/Samples/RecurringBillingSubscriptions/Subscriptions/ActivateSubscription.cs: -------------------------------------------------------------------------------- 1 | using CyberSource.Api; 2 | using CyberSource.Model; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.RecurringBillingSubscriptions 10 | { 11 | public class ActivateSubscription 12 | { 13 | public static ActivateSubscriptionResponse Run() 14 | { 15 | try 16 | { 17 | var subscriptionId = CancelSubscription.Run().Id; 18 | var configDictionary = new Configuration().GetConfiguration(); 19 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 20 | 21 | var apiInstance = new SubscriptionsApi(clientConfig); 22 | var result = apiInstance.ActivateSubscription(subscriptionId); 23 | Console.WriteLine(result); 24 | return result; 25 | } 26 | catch (Exception e) 27 | { 28 | Console.WriteLine("Exception on calling the API : " + e.Message); 29 | return null; 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Source/Samples/RecurringBillingSubscriptions/Subscriptions/CancelSubscription.cs: -------------------------------------------------------------------------------- 1 | using CyberSource.Api; 2 | using CyberSource.Model; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.RecurringBillingSubscriptions 10 | { 11 | public class CancelSubscription 12 | { 13 | public static CancelSubscriptionResponse Run() 14 | { 15 | try 16 | { 17 | var subscriptionId = CreateSubscription.Run().Id; 18 | var configDictionary = new Configuration().GetConfiguration(); 19 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 20 | 21 | var apiInstance = new SubscriptionsApi(clientConfig); 22 | var result = apiInstance.CancelSubscription(subscriptionId); 23 | Console.WriteLine(result); 24 | return result; 25 | } 26 | catch (Exception e) 27 | { 28 | Console.WriteLine("Exception on calling the API : " + e.Message); 29 | return null; 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Source/Samples/RecurringBillingSubscriptions/Subscriptions/GetListOfSubscriptions.cs: -------------------------------------------------------------------------------- 1 | using CyberSource.Api; 2 | using CyberSource.Model; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Xml.Linq; 9 | 10 | namespace Cybersource_rest_samples_dotnet.Samples.RecurringBillingSubscriptions 11 | { 12 | public class GetListOfSubscriptions 13 | { 14 | public static GetAllSubscriptionsResponse Run() 15 | { 16 | int? offset = (int?)null; 17 | int? limit = (int?)null; 18 | string code = null; 19 | string status = null; 20 | 21 | try 22 | { 23 | var configDictionary = new Configuration().GetConfiguration(); 24 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 25 | 26 | var apiInstance = new SubscriptionsApi(clientConfig); 27 | var result = apiInstance.GetAllSubscriptions(offset, limit, code, status); 28 | Console.WriteLine(result); 29 | return result; 30 | } 31 | catch (Exception e) 32 | { 33 | Console.WriteLine("Exception on calling the API : " + e.Message); 34 | return null; 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Source/Samples/RecurringBillingSubscriptions/Subscriptions/GetSubscription.cs: -------------------------------------------------------------------------------- 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.RecurringBillingSubscriptions 9 | { 10 | public class GetSubscription 11 | { 12 | public static void Run() 13 | { 14 | try 15 | { 16 | var id = CreateSubscription.Run().Id; 17 | var configDictionary = new Configuration().GetConfiguration(); 18 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 19 | 20 | var apiInstance = new SubscriptionsApi(clientConfig); 21 | apiInstance.GetSubscription(id); 22 | } 23 | catch (Exception e) 24 | { 25 | Console.WriteLine("Exception on calling the API : " + e.Message); 26 | } 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Source/Samples/RecurringBillingSubscriptions/Subscriptions/GetSubscriptionCode.cs: -------------------------------------------------------------------------------- 1 | using CyberSource.Api; 2 | using CyberSource.Model; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.RecurringBillingSubscriptions 10 | { 11 | public class GetSubscriptionCode 12 | { 13 | public static GetSubscriptionCodeResponse Run() 14 | { 15 | try 16 | { 17 | var configDictionary = new Configuration().GetConfiguration(); 18 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 19 | 20 | var apiInstance = new SubscriptionsApi(clientConfig); 21 | var result = apiInstance.GetSubscriptionCode(); 22 | Console.WriteLine(result); 23 | return result; 24 | } 25 | catch (Exception e) 26 | { 27 | Console.WriteLine("Exception on calling the API : " + e.Message); 28 | return null; 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Source/Samples/RecurringBillingSubscriptions/Subscriptions/SuspendSubscription.cs: -------------------------------------------------------------------------------- 1 | using CyberSource.Api; 2 | using CyberSource.Model; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.RecurringBillingSubscriptions 10 | { 11 | public class SuspendSubscription 12 | { 13 | public static SuspendSubscriptionResponse Run() 14 | { 15 | try 16 | { 17 | var subscriptionId = CreateSubscription.Run().Id; 18 | var configDictionary = new Configuration().GetConfiguration(); 19 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 20 | 21 | var apiInstance = new SubscriptionsApi(clientConfig); 22 | var result = apiInstance.SuspendSubscription(subscriptionId); 23 | Console.WriteLine(result); 24 | return result; 25 | } 26 | catch (Exception e) 27 | { 28 | Console.WriteLine("Exception on calling the API : " + e.Message); 29 | return null; 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Source/Samples/Reporting/ChargebackDetails/GetChargebackDetails.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Reporting 10 | { 11 | public class GetChargebackDetails 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static ReportingV3ChargebackDetailsGet200Response Run() 21 | { 22 | // QUERY PARAMETERS 23 | string organizationId = "testrest"; 24 | var startTime = DateTime.ParseExact("2024-08-01T00:00:00Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); 25 | var endTime = DateTime.ParseExact("2024-09-01T23:59:59Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); 26 | try 27 | { 28 | var configDictionary = new Configuration().GetConfiguration(); 29 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 30 | 31 | var apiInstance = new ChargebackDetailsApi(clientConfig); 32 | ReportingV3ChargebackDetailsGet200Response result = apiInstance.GetChargebackDetails(startTime, endTime, organizationId); 33 | Console.WriteLine(result); 34 | WriteLogAudit(apiInstance.GetStatusCode()); 35 | return result; 36 | } 37 | catch (ApiException e) 38 | { 39 | Console.WriteLine("Exception on calling the API : " + e.Message); 40 | WriteLogAudit(e.ErrorCode); 41 | return null; 42 | } 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Source/Samples/Reporting/ChargebackSummaries/GetChargebackSummaries.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Reporting 10 | { 11 | public class GetChargebackSummaries 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static ReportingV3ChargebackSummariesGet200Response Run() 21 | { 22 | // QUERY PARAMETERS 23 | string organizationId = "testrest"; 24 | var startTime = DateTime.ParseExact("2024-08-01T00:00:00Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); 25 | var endTime = DateTime.ParseExact("2024-09-01T23:59:59Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); 26 | try 27 | { 28 | var configDictionary = new Configuration().GetConfiguration(); 29 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 30 | 31 | var apiInstance = new ChargebackSummariesApi(clientConfig); 32 | ReportingV3ChargebackSummariesGet200Response result = apiInstance.GetChargebackSummaries(startTime, endTime, organizationId); 33 | Console.WriteLine(result); 34 | WriteLogAudit(apiInstance.GetStatusCode()); 35 | return result; 36 | } 37 | catch (ApiException e) 38 | { 39 | Console.WriteLine("Exception on calling the API : " + e.Message); 40 | WriteLogAudit(e.ErrorCode); 41 | return null; 42 | } 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Source/Samples/Reporting/ConversionDetails/GetConversionDetailTransactions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Reporting 10 | { 11 | public class GetConversionDetailTransactions 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static ReportingV3ConversionDetailsGet200Response Run() 21 | { 22 | var startTime = DateTime.ParseExact("2023-01-21T00:00:00Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); 23 | var endTime = DateTime.ParseExact("2023-01-21T23:00:00Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); 24 | string organizationId = "testrest"; 25 | try 26 | { 27 | var configDictionary = new Configuration().GetConfiguration(); 28 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 29 | 30 | var apiInstance = new ConversionDetailsApi(clientConfig); 31 | ReportingV3ConversionDetailsGet200Response result = apiInstance.GetConversionDetail(startTime, endTime, organizationId); 32 | Console.WriteLine(result); 33 | WriteLogAudit(apiInstance.GetStatusCode()); 34 | return result; 35 | } 36 | catch (ApiException e) 37 | { 38 | Console.WriteLine("Exception on calling the API : " + e.Message); 39 | WriteLogAudit(e.ErrorCode); 40 | return null; 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Source/Samples/Reporting/InterchangeClearingLevelDetails/InterchangeClearingLevelDataForAccountOrMerchant.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Reporting 10 | { 11 | public class InterchangeClearingLevelDataForAccountOrMerchant 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static ReportingV3InterchangeClearingLevelDetailsGet200Response Run() 21 | { 22 | // QUERY PARAMETERS 23 | string organizationId = "testrest"; 24 | var startTime = DateTime.ParseExact("2024-08-01T00:00:00Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); 25 | var endTime = DateTime.ParseExact("2024-09-01T23:59:59Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); 26 | try 27 | { 28 | var configDictionary = new Configuration().GetConfiguration(); 29 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 30 | 31 | var apiInstance = new InterchangeClearingLevelDetailsApi(clientConfig); 32 | ReportingV3InterchangeClearingLevelDetailsGet200Response result = apiInstance.GetInterchangeClearingLevelDetails(startTime, endTime, organizationId); 33 | Console.WriteLine(result); 34 | WriteLogAudit(apiInstance.GetStatusCode()); 35 | return result; 36 | } 37 | catch (ApiException e) 38 | { 39 | Console.WriteLine("Exception on calling the API : " + e.Message); 40 | WriteLogAudit(e.ErrorCode); 41 | return null; 42 | } 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Source/Samples/Reporting/NetFundings/GetNetfundingInformationForAccountOrMerchant.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Reporting 10 | { 11 | public class GetNetfundingInformationForAccountOrMerchant 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static ReportingV3NetFundingsGet200Response Run() 21 | { 22 | var startTime = DateTime.ParseExact("2024-01-01T00:00:00Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); 23 | var endTime = DateTime.ParseExact("2024-01-02T23:59:59Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); 24 | string organizationId = "testrest"; 25 | string groupName = null; 26 | try 27 | { 28 | var configDictionary = new Configuration().GetConfiguration(); 29 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 30 | 31 | var apiInstance = new NetFundingsApi(clientConfig); 32 | ReportingV3NetFundingsGet200Response result = apiInstance.GetNetFundingDetails(startTime, endTime, organizationId, groupName); 33 | Console.WriteLine(result); 34 | WriteLogAudit(apiInstance.GetStatusCode()); 35 | return result; 36 | } 37 | catch (ApiException e) 38 | { 39 | Console.WriteLine("Exception on calling the API : " + e.Message); 40 | WriteLogAudit(e.ErrorCode); 41 | return null; 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Source/Samples/Reporting/NotificationOfChanges/GetNotificationOfChanges.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Reporting 10 | { 11 | public class GetNotificationOfChanges 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static ReportingV3NotificationofChangesGet200Response Run() 21 | { 22 | var startTime = DateTime.ParseExact("2024-01-01T12:00:00Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); 23 | var endTime = DateTime.ParseExact("2024-01-10T12:00:00Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); 24 | try 25 | { 26 | var configDictionary = new Configuration().GetConfiguration(); 27 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 28 | 29 | var apiInstance = new NotificationOfChangesApi(clientConfig); 30 | ReportingV3NotificationofChangesGet200Response result = apiInstance.GetNotificationOfChangeReport(startTime, endTime); 31 | Console.WriteLine(result); 32 | WriteLogAudit(apiInstance.GetStatusCode()); 33 | return result; 34 | } 35 | catch (ApiException e) 36 | { 37 | Console.WriteLine("Exception on calling the API : " + e.Message); 38 | WriteLogAudit(e.ErrorCode); 39 | return null; 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Source/Samples/Reporting/PaymentBatchSummaries/GetPaymentBatchSummaryData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Reporting 10 | { 11 | public class GetPaymentBatchSummaryData 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static ReportingV3PaymentBatchSummariesGet200Response Run() 21 | { 22 | var startTime = DateTime.ParseExact("2025-01-01T12:00:00Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); 23 | var endTime = DateTime.ParseExact("2025-01-30T12:00:00Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); 24 | string organizationId = "testrest"; 25 | string rollUp = null; 26 | string breakdown = null; 27 | int? startDayOfWeek = (int?)null; 28 | try 29 | { 30 | var configDictionary = new Configuration().GetConfiguration(); 31 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 32 | 33 | var apiInstance = new PaymentBatchSummariesApi(clientConfig); 34 | ReportingV3PaymentBatchSummariesGet200Response result = apiInstance.GetPaymentBatchSummary(startTime, endTime, organizationId, rollUp, breakdown, startDayOfWeek); 35 | Console.WriteLine(result); 36 | WriteLogAudit(apiInstance.GetStatusCode()); 37 | return result; 38 | } 39 | catch (ApiException e) 40 | { 41 | Console.WriteLine("Exception on calling the API : " + e.Message); 42 | WriteLogAudit(e.ErrorCode); 43 | return null; 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Source/Samples/Reporting/PurchaseAndRefundDetails/GetPurchaseAndRefundDetails.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Reporting 10 | { 11 | public class GetPurchaseAndRefundDetails 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static ReportingV3PurchaseRefundDetailsGet200Response Run() 21 | { 22 | var startTime = DateTime.ParseExact("2025-01-01T12:00:00Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); 23 | var endTime = DateTime.ParseExact("2025-01-30T12:00:00Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); 24 | string organizationId = "testrest"; 25 | string paymentSubtype = "VI"; 26 | string viewBy = "requestDate"; 27 | string groupName = "groupName"; 28 | int? offset = 20; 29 | int? limit = 2000; 30 | try 31 | { 32 | var configDictionary = new Configuration().GetConfiguration(); 33 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 34 | 35 | var apiInstance = new PurchaseAndRefundDetailsApi(clientConfig); 36 | ReportingV3PurchaseRefundDetailsGet200Response result = apiInstance.GetPurchaseAndRefundDetails(startTime, endTime, organizationId, paymentSubtype, viewBy, groupName, offset, limit); 37 | Console.WriteLine(result); 38 | WriteLogAudit(apiInstance.GetStatusCode()); 39 | return result; 40 | } 41 | catch (ApiException e) 42 | { 43 | Console.WriteLine("Exception on calling the API : " + e.Message); 44 | WriteLogAudit(e.ErrorCode); 45 | return null; 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Source/Samples/Reporting/ReportDefinitions/GetReportDefinition.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Reporting 10 | { 11 | public class GetReportDefinition 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static ReportingV3ReportDefinitionsNameGet200Response Run() 21 | { 22 | string reportDefinitionName = "SubscriptionDetailClass"; 23 | string subscriptionType = null; 24 | string reportMimeType = null; 25 | string organizationId = "testrest"; 26 | try 27 | { 28 | var configDictionary = new Configuration().GetConfiguration(); 29 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 30 | 31 | var apiInstance = new ReportDefinitionsApi(clientConfig); 32 | ReportingV3ReportDefinitionsNameGet200Response result = apiInstance.GetResourceInfoByReportDefinition(reportDefinitionName, subscriptionType, reportMimeType, organizationId); 33 | Console.WriteLine(result); 34 | WriteLogAudit(apiInstance.GetStatusCode()); 35 | return result; 36 | } 37 | catch (ApiException e) 38 | { 39 | Console.WriteLine("Exception on calling the API : " + e.Message); 40 | WriteLogAudit(e.ErrorCode); 41 | return null; 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Source/Samples/Reporting/ReportDefinitions/GetReportingResourceInformation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Reporting 10 | { 11 | public class GetReportingResourceInformation 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static ReportingV3ReportDefinitionsGet200Response Run() 21 | { 22 | string subscriptionType = null; 23 | string organizationId = "testrest"; 24 | try 25 | { 26 | var configDictionary = new Configuration().GetConfiguration(); 27 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 28 | 29 | var apiInstance = new ReportDefinitionsApi(clientConfig); 30 | ReportingV3ReportDefinitionsGet200Response result = apiInstance.GetResourceV2Info(subscriptionType, organizationId); 31 | Console.WriteLine(result); 32 | WriteLogAudit(apiInstance.GetStatusCode()); 33 | return result; 34 | } 35 | catch (ApiException e) 36 | { 37 | Console.WriteLine("Exception on calling the API : " + e.Message); 38 | WriteLogAudit(e.ErrorCode); 39 | return null; 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Source/Samples/Reporting/ReportSubscriptions/CreateClassicStandardReportSubscription.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Reporting 10 | { 11 | public class CreateClassicStandardReportSubscription 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static void Run() 21 | { 22 | string reportDefinitionName = "TransactionRequestClass"; 23 | string subscriptionType = "CLASSIC"; 24 | var requestObj = new PredefinedSubscriptionRequestBean( 25 | ReportDefinitionName: reportDefinitionName, 26 | SubscriptionType: subscriptionType 27 | ); 28 | 29 | string organizationId = null; 30 | try 31 | { 32 | var configDictionary = new Configuration().GetConfiguration(); 33 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 34 | 35 | var apiInstance = new ReportSubscriptionsApi(clientConfig); 36 | apiInstance.CreateStandardOrClassicSubscription(requestObj, organizationId); 37 | WriteLogAudit(apiInstance.GetStatusCode()); 38 | } 39 | catch (ApiException e) 40 | { 41 | Console.WriteLine("Exception on calling the API : " + e.Message); 42 | WriteLogAudit(e.ErrorCode); 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Source/Samples/Reporting/ReportSubscriptions/DeleteSubscriptionOfReportNameByOrganization.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Reporting 10 | { 11 | public class DeleteSubscriptionOfReportNameByOrganization 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static string ReportNameToDelete { get; set; } 21 | 22 | public static void Run() 23 | { 24 | if (string.IsNullOrEmpty(ReportNameToDelete)) 25 | { 26 | ReportNameToDelete = "testrest_subcription_v1"; 27 | } 28 | 29 | string reportName = ReportNameToDelete; 30 | string organizationId = null; 31 | try 32 | { 33 | var configDictionary = new Configuration().GetConfiguration(); 34 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 35 | 36 | var apiInstance = new ReportSubscriptionsApi(clientConfig); 37 | apiInstance.DeleteSubscription(reportName, organizationId); 38 | ReportNameToDelete = null; 39 | WriteLogAudit(apiInstance.GetStatusCode()); 40 | } 41 | catch (ApiException e) 42 | { 43 | Console.WriteLine("Exception on calling the API : " + e.Message); 44 | WriteLogAudit(e.ErrorCode); 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Source/Samples/Reporting/ReportSubscriptions/GetAllSubscriptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Reporting 10 | { 11 | public class GetAllSubscriptions 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static ReportingV3ReportSubscriptionsGet200Response Run() 21 | { 22 | string organizationId = null; 23 | try 24 | { 25 | var configDictionary = new Configuration().GetConfiguration(); 26 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 27 | 28 | var apiInstance = new ReportSubscriptionsApi(clientConfig); 29 | ReportingV3ReportSubscriptionsGet200Response result = apiInstance.GetAllSubscriptions(organizationId); 30 | Console.WriteLine(result); 31 | WriteLogAudit(apiInstance.GetStatusCode()); 32 | return result; 33 | } 34 | catch (ApiException e) 35 | { 36 | Console.WriteLine("Exception on calling the API : " + e.Message); 37 | WriteLogAudit(e.ErrorCode); 38 | return null; 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Source/Samples/Reporting/ReportSubscriptions/GetSubscriptionForReportName.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Reporting 10 | { 11 | public class GetSubscriptionForReportName 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static ReportingV3ReportSubscriptionsGet200ResponseSubscriptions Run() 21 | { 22 | var reportName = "testrest_subcription_v1"; 23 | string organizationId = null; 24 | try 25 | { 26 | var configDictionary = new Configuration().GetConfiguration(); 27 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 28 | 29 | var apiInstance = new ReportSubscriptionsApi(clientConfig); 30 | ReportingV3ReportSubscriptionsGet200ResponseSubscriptions result = apiInstance.GetSubscription(reportName, organizationId); 31 | Console.WriteLine(result); 32 | WriteLogAudit(apiInstance.GetStatusCode()); 33 | return result; 34 | } 35 | catch (ApiException e) 36 | { 37 | Console.WriteLine("Exception on calling the API : " + e.Message); 38 | WriteLogAudit(e.ErrorCode); 39 | return null; 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Source/Samples/Reporting/Reports/GetReportBasedOnReportId.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Reporting 10 | { 11 | public class GetReportBasedOnReportId 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static ReportingV3ReportsIdGet200Response Run() 21 | { 22 | string reportId = "79642c43-2368-0cd5-e053-a2588e0a7b3c"; 23 | string organizationId = "testrest"; 24 | try 25 | { 26 | var configDictionary = new Configuration().GetConfiguration(); 27 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 28 | 29 | var apiInstance = new ReportsApi(clientConfig); 30 | ReportingV3ReportsIdGet200Response result = apiInstance.GetReportByReportId(reportId, organizationId); 31 | Console.WriteLine(result); 32 | WriteLogAudit(apiInstance.GetStatusCode()); 33 | return result; 34 | } 35 | catch (ApiException e) 36 | { 37 | Console.WriteLine("Exception on calling the API : " + e.Message); 38 | WriteLogAudit(e.ErrorCode); 39 | return null; 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Source/Samples/Reporting/Reports/RetrieveAvailableReports.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Reporting 10 | { 11 | public class RetrieveAvailableReports 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static ReportingV3ReportsGet200Response Run() 21 | { 22 | string organizationId = null; 23 | var startTime = DateTime.ParseExact("2025-01-01T00:00:00Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); 24 | var endTime = DateTime.ParseExact("2025-01-03T23:59:59Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); 25 | string timeQueryType = "executedTime"; 26 | string reportMimeType = "application/xml"; 27 | string reportFrequency = null; 28 | string reportName = null; 29 | int? reportDefinitionId = (int?)null; 30 | string reportStatus = null; 31 | try 32 | { 33 | var configDictionary = new Configuration().GetConfiguration(); 34 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 35 | 36 | var apiInstance = new ReportsApi(clientConfig); 37 | ReportingV3ReportsGet200Response result = apiInstance.SearchReports(startTime, endTime, timeQueryType, organizationId, reportMimeType, reportFrequency, reportName, reportDefinitionId, reportStatus); 38 | Console.WriteLine(result); 39 | WriteLogAudit(apiInstance.GetStatusCode()); 40 | return result; 41 | } 42 | catch (ApiException e) 43 | { 44 | Console.WriteLine("Exception on calling the API : " + e.Message); 45 | WriteLogAudit(e.ErrorCode); 46 | return null; 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Source/Samples/Reporting/RetrievalDetails/GetRetrievalDetails.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Reporting 10 | { 11 | public class GetRetrievalDetails 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static ReportingV3RetrievalDetailsGet200Response Run() 21 | { 22 | // QUERY PARAMETERS 23 | string organizationId = "testrest"; 24 | var startTime = DateTime.ParseExact("2024-08-01T00:00:00Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); 25 | var endTime = DateTime.ParseExact("2024-09-01T23:59:59Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); 26 | try 27 | { 28 | var configDictionary = new Configuration().GetConfiguration(); 29 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 30 | 31 | var apiInstance = new RetrievalDetailsApi(clientConfig); 32 | ReportingV3RetrievalDetailsGet200Response result = apiInstance.GetRetrievalDetails(startTime, endTime, organizationId); 33 | Console.WriteLine(result); 34 | WriteLogAudit(apiInstance.GetStatusCode()); 35 | return result; 36 | } 37 | catch (ApiException e) 38 | { 39 | Console.WriteLine("Exception on calling the API : " + e.Message); 40 | WriteLogAudit(e.ErrorCode); 41 | return null; 42 | } 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Source/Samples/Reporting/RetrievalSummaries/GetRetrievalSummaries.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.Reporting 10 | { 11 | public class GetRetrievalSummaries 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static ReportingV3RetrievalSummariesGet200Response Run() 21 | { 22 | // QUERY PARAMETERS 23 | string organizationId = "testrest"; 24 | var startTime = DateTime.ParseExact("2024-08-01T00:00:00Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); 25 | var endTime = DateTime.ParseExact("2024-09-01T23:59:59Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); 26 | try 27 | { 28 | var configDictionary = new Configuration().GetConfiguration(); 29 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 30 | 31 | var apiInstance = new RetrievalSummariesApi(clientConfig); 32 | ReportingV3RetrievalSummariesGet200Response result = apiInstance.GetRetrievalSummary(startTime, endTime, organizationId); 33 | Console.WriteLine(result); 34 | WriteLogAudit(apiInstance.GetStatusCode()); 35 | return result; 36 | } 37 | catch (ApiException e) 38 | { 39 | Console.WriteLine("Exception on calling the API : " + e.Message); 40 | WriteLogAudit(e.ErrorCode); 41 | return null; 42 | } 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Source/Samples/RiskManagement/DecisionManager/RemoveFromHistory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.RiskManagement 10 | { 11 | public class RemoveFromHistory 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static RiskV1UpdatePost201Response Run() 21 | { 22 | string id = "5825489395116729903003"; 23 | string riskInformationMarkingDetailsNotes = "Adding this transaction as suspect"; 24 | string riskInformationMarkingDetailsReason = "suspected"; 25 | string riskInformationMarkingDetailsAction = "hide"; 26 | Riskv1decisionsidmarkingRiskInformationMarkingDetails riskInformationMarkingDetails = new Riskv1decisionsidmarkingRiskInformationMarkingDetails( 27 | Notes: riskInformationMarkingDetailsNotes, 28 | Reason: riskInformationMarkingDetailsReason, 29 | Action: riskInformationMarkingDetailsAction 30 | ); 31 | 32 | Riskv1decisionsidmarkingRiskInformation riskInformation = new Riskv1decisionsidmarkingRiskInformation( 33 | MarkingDetails: riskInformationMarkingDetails 34 | ); 35 | 36 | var requestObj = new FraudMarkingActionRequest( 37 | RiskInformation: riskInformation 38 | ); 39 | 40 | try 41 | { 42 | var configDictionary = new Configuration().GetConfiguration(); 43 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 44 | 45 | var apiInstance = new DecisionManagerApi(clientConfig); 46 | RiskV1UpdatePost201Response result = apiInstance.FraudUpdate(id, requestObj); 47 | Console.WriteLine(result); 48 | WriteLogAudit(apiInstance.GetStatusCode()); 49 | return result; 50 | } 51 | catch (ApiException e) 52 | { 53 | Console.WriteLine("Exception on calling the API : " + e.Message); 54 | WriteLogAudit(e.ErrorCode); 55 | return null; 56 | } 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Source/Samples/SecureFileShare/GetListOfFiles.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.SecureFileShare 10 | { 11 | public class GetListOfFiles 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static V1FileDetailsGet200Response Run() 21 | { 22 | var startDate = DateTime.ParseExact("2024-07-20", "yyyy-MM-dd", CultureInfo.InvariantCulture); 23 | var endDate = DateTime.ParseExact("2024-07-30", "yyyy-MM-dd", CultureInfo.InvariantCulture); 24 | string organizationId = "testrest"; 25 | string name = null; 26 | try 27 | { 28 | var configDictionary = new Configuration().GetConfiguration(); 29 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 30 | 31 | var apiInstance = new SecureFileShareApi(clientConfig); 32 | V1FileDetailsGet200Response result = apiInstance.GetFileDetail(startDate, endDate, organizationId, name); 33 | Console.WriteLine(result); 34 | WriteLogAudit(apiInstance.GetStatusCode()); 35 | return result; 36 | } 37 | catch (ApiException e) 38 | { 39 | Console.WriteLine("Exception on calling the API : " + e.Message); 40 | WriteLogAudit(e.ErrorCode); 41 | return null; 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Source/Samples/TokenManagement/Customer/DeleteCustomer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.TokenManagement 10 | { 11 | public class DeleteCustomer 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static void Run() 21 | { 22 | string customerTokenId = CreateCustomer.Run().Id; 23 | try 24 | { 25 | var configDictionary = new Configuration().GetConfiguration(); 26 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 27 | 28 | var apiInstance = new CustomerApi(clientConfig); 29 | apiInstance.DeleteCustomer(customerTokenId); 30 | Console.WriteLine($"Customer {customerTokenId} has been deleted."); 31 | WriteLogAudit(apiInstance.GetStatusCode()); 32 | } 33 | catch (ApiException e) 34 | { 35 | Console.WriteLine("Exception on calling the API : " + e.Message); 36 | WriteLogAudit(e.ErrorCode); 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Source/Samples/TokenManagement/Customer/RetrieveCustomer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.TokenManagement 10 | { 11 | public class RetrieveCustomer 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static PostCustomerRequest Run() 21 | { 22 | string customerTokenId = "AB695DA801DD1BB6E05341588E0A3BDC"; 23 | try 24 | { 25 | var configDictionary = new Configuration().GetConfiguration(); 26 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 27 | 28 | var apiInstance = new CustomerApi(clientConfig); 29 | PostCustomerRequest result = apiInstance.GetCustomer(customerTokenId); 30 | Console.WriteLine(result); 31 | WriteLogAudit(apiInstance.GetStatusCode()); 32 | return result; 33 | } 34 | catch (ApiException e) 35 | { 36 | Console.WriteLine("Exception on calling the API : " + e.Message); 37 | WriteLogAudit(e.ErrorCode); 38 | return null; 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Source/Samples/TokenManagement/Customer/UpdateCustomersDefaultPaymentInstrument.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.TokenManagement 10 | { 11 | public class UpdateCustomersDefaultPaymentInstrument 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static PatchCustomerRequest Run() 21 | { 22 | string customerTokenId = "AB695DA801DD1BB6E05341588E0A3BDC"; 23 | string defaultPaymentInstrumentId = "AB6A54B982A6FCB6E05341588E0A3935"; 24 | Tmsv2customersDefaultPaymentInstrument defaultPaymentInstrument = new Tmsv2customersDefaultPaymentInstrument( 25 | Id: defaultPaymentInstrumentId 26 | ); 27 | 28 | var requestObj = new PatchCustomerRequest( 29 | DefaultPaymentInstrument: defaultPaymentInstrument 30 | ); 31 | 32 | try 33 | { 34 | var configDictionary = new Configuration().GetConfiguration(); 35 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 36 | 37 | var apiInstance = new CustomerApi(clientConfig); 38 | PatchCustomerRequest result = apiInstance.PatchCustomer(customerTokenId, requestObj); 39 | Console.WriteLine(result); 40 | WriteLogAudit(apiInstance.GetStatusCode()); 41 | return result; 42 | } 43 | catch (ApiException e) 44 | { 45 | Console.WriteLine("Exception on calling the API : " + e.Message); 46 | WriteLogAudit(e.ErrorCode); 47 | return null; 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Source/Samples/TokenManagement/Customer/UpdateCustomersDefaultShippingAddress.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.TokenManagement 10 | { 11 | public class UpdateCustomersDefaultShippingAddress 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static PatchCustomerRequest Run() 21 | { 22 | string customerTokenId = "AB695DA801DD1BB6E05341588E0A3BDC"; 23 | string defaultShippingAddressId = "AB6A54B97C00FCB6E05341588E0A3935"; 24 | Tmsv2customersDefaultShippingAddress defaultShippingAddress = new Tmsv2customersDefaultShippingAddress( 25 | Id: defaultShippingAddressId 26 | ); 27 | 28 | var requestObj = new PatchCustomerRequest( 29 | DefaultShippingAddress: defaultShippingAddress 30 | ); 31 | 32 | try 33 | { 34 | var configDictionary = new Configuration().GetConfiguration(); 35 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 36 | 37 | var apiInstance = new CustomerApi(clientConfig); 38 | PatchCustomerRequest result = apiInstance.PatchCustomer(customerTokenId, requestObj); 39 | Console.WriteLine(result); 40 | WriteLogAudit(apiInstance.GetStatusCode()); 41 | return result; 42 | } 43 | catch (ApiException e) 44 | { 45 | Console.WriteLine("Exception on calling the API : " + e.Message); 46 | WriteLogAudit(e.ErrorCode); 47 | return null; 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Source/Samples/TokenManagement/CustomerPaymentInstrument/DeleteCustomerPaymentInstrument.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.TokenManagement 10 | { 11 | public class DeleteCustomerPaymentInstrument 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static void Run() 21 | { 22 | string customerTokenId = "AB695DA801DD1BB6E05341588E0A3BDC"; 23 | string paymentInstrumentTokenId = CreateCustomerNonDefaultPaymentInstrumentCard.Run().Id; 24 | try 25 | { 26 | var configDictionary = new Configuration().GetConfiguration(); 27 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 28 | 29 | var apiInstance = new CustomerPaymentInstrumentApi(clientConfig); 30 | apiInstance.DeleteCustomerPaymentInstrument(customerTokenId, paymentInstrumentTokenId); 31 | Console.WriteLine($"Customer Payment Instrument {customerTokenId} --> {paymentInstrumentTokenId} has been deleted."); 32 | WriteLogAudit(apiInstance.GetStatusCode()); 33 | } 34 | catch (ApiException e) 35 | { 36 | Console.WriteLine("Exception on calling the API : " + e.Message); 37 | WriteLogAudit(e.ErrorCode); 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Source/Samples/TokenManagement/CustomerPaymentInstrument/ListPaymentInstrumentsForCustomer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.TokenManagement 10 | { 11 | public class ListPaymentInstrumentsForCustomer 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static PaymentInstrumentList Run() 21 | { 22 | string customerTokenId = "AB695DA801DD1BB6E05341588E0A3BDC"; 23 | string profileid = null; 24 | long? offset = (long?)null; 25 | long? limit = (long?)null; 26 | try 27 | { 28 | var configDictionary = new Configuration().GetConfiguration(); 29 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 30 | 31 | var apiInstance = new CustomerPaymentInstrumentApi(clientConfig); 32 | PaymentInstrumentList result = apiInstance.GetCustomerPaymentInstrumentsList(customerTokenId, profileid, offset, limit); 33 | Console.WriteLine(result); 34 | WriteLogAudit(apiInstance.GetStatusCode()); 35 | return result; 36 | } 37 | catch (ApiException e) 38 | { 39 | Console.WriteLine("Exception on calling the API : " + e.Message); 40 | WriteLogAudit(e.ErrorCode); 41 | return null; 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Source/Samples/TokenManagement/CustomerPaymentInstrument/RetrieveCustomerPaymentInstrument.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.TokenManagement 10 | { 11 | public class RetrieveCustomerPaymentInstrument 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static PostCustomerPaymentInstrumentRequest Run() 21 | { 22 | string customerTokenId = "AB695DA801DD1BB6E05341588E0A3BDC"; 23 | string paymentInstrumentTokenId = "AB6A54B982A6FCB6E05341588E0A3935"; 24 | try 25 | { 26 | var configDictionary = new Configuration().GetConfiguration(); 27 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 28 | 29 | var apiInstance = new CustomerPaymentInstrumentApi(clientConfig); 30 | PostCustomerPaymentInstrumentRequest result = apiInstance.GetCustomerPaymentInstrument(customerTokenId, paymentInstrumentTokenId); 31 | Console.WriteLine(result); 32 | WriteLogAudit(apiInstance.GetStatusCode()); 33 | return result; 34 | } 35 | catch (ApiException e) 36 | { 37 | Console.WriteLine("Exception on calling the API : " + e.Message); 38 | WriteLogAudit(e.ErrorCode); 39 | return null; 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Source/Samples/TokenManagement/CustomerShippingAddress/DeleteCustomerShippingAddress.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.TokenManagement 10 | { 11 | public class DeleteCustomerShippingAddress 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static void Run() 21 | { 22 | string customerTokenId = "AB695DA801DD1BB6E05341588E0A3BDC"; 23 | string shippingAddressTokenId = CreateCustomerNonDefaultShippingAddress.Run().Id; 24 | try 25 | { 26 | var configDictionary = new Configuration().GetConfiguration(); 27 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 28 | 29 | var apiInstance = new CustomerShippingAddressApi(clientConfig); 30 | apiInstance.DeleteCustomerShippingAddress(customerTokenId, shippingAddressTokenId); 31 | Console.WriteLine($"Customer Shipping Address {customerTokenId} --> {shippingAddressTokenId} has been deleted."); 32 | WriteLogAudit(apiInstance.GetStatusCode()); 33 | } 34 | catch (ApiException e) 35 | { 36 | Console.WriteLine("Exception on calling the API : " + e.Message); 37 | WriteLogAudit(e.ErrorCode); 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Source/Samples/TokenManagement/CustomerShippingAddress/ListShippingAddressesForCustomer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.TokenManagement 10 | { 11 | public class ListShippingAddressesForCustomer 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static ShippingAddressListForCustomer Run() 21 | { 22 | string customerTokenId = "AB695DA801DD1BB6E05341588E0A3BDC"; 23 | string profileid = null; 24 | long? offset = (long?)null; 25 | long? limit = (long?)null; 26 | try 27 | { 28 | var configDictionary = new Configuration().GetConfiguration(); 29 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 30 | 31 | var apiInstance = new CustomerShippingAddressApi(clientConfig); 32 | ShippingAddressListForCustomer result = apiInstance.GetCustomerShippingAddressesList(customerTokenId, profileid, offset, limit); 33 | Console.WriteLine(result); 34 | WriteLogAudit(apiInstance.GetStatusCode()); 35 | return result; 36 | } 37 | catch (ApiException e) 38 | { 39 | Console.WriteLine("Exception on calling the API : " + e.Message); 40 | WriteLogAudit(e.ErrorCode); 41 | return null; 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Source/Samples/TokenManagement/CustomerShippingAddress/RetrieveCustomerShippingAddress.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.TokenManagement 10 | { 11 | public class RetrieveCustomerShippingAddress 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static PostCustomerShippingAddressRequest Run() 21 | { 22 | string customerTokenId = "AB695DA801DD1BB6E05341588E0A3BDC"; 23 | string shippingAddressTokenId = "AB6A54B97C00FCB6E05341588E0A3935"; 24 | try 25 | { 26 | var configDictionary = new Configuration().GetConfiguration(); 27 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 28 | 29 | var apiInstance = new CustomerShippingAddressApi(clientConfig); 30 | PostCustomerShippingAddressRequest result = apiInstance.GetCustomerShippingAddress(customerTokenId, shippingAddressTokenId); 31 | Console.WriteLine(result); 32 | WriteLogAudit(apiInstance.GetStatusCode()); 33 | return result; 34 | } 35 | catch (ApiException e) 36 | { 37 | Console.WriteLine("Exception on calling the API : " + e.Message); 38 | WriteLogAudit(e.ErrorCode); 39 | return null; 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Source/Samples/TokenManagement/InstrumentIdentifier/CreateInstrumentIdentifierBankAccount.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.TokenManagement 10 | { 11 | public class CreateInstrumentIdentifierBankAccount 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static PostInstrumentIdentifierRequest Run() 21 | { 22 | var profileid = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; 23 | string bankAccountNumber = "4100"; 24 | string bankAccountRoutingNumber = "071923284"; 25 | TmsEmbeddedInstrumentIdentifierBankAccount bankAccount = new TmsEmbeddedInstrumentIdentifierBankAccount( 26 | Number: bankAccountNumber, 27 | RoutingNumber: bankAccountRoutingNumber 28 | ); 29 | 30 | var requestObj = new PostInstrumentIdentifierRequest( 31 | BankAccount: bankAccount 32 | ); 33 | 34 | try 35 | { 36 | var configDictionary = new Configuration().GetConfiguration(); 37 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 38 | 39 | var apiInstance = new InstrumentIdentifierApi(clientConfig); 40 | PostInstrumentIdentifierRequest result = apiInstance.PostInstrumentIdentifier(requestObj, profileid); 41 | Console.WriteLine(result); 42 | WriteLogAudit(apiInstance.GetStatusCode()); 43 | return result; 44 | } 45 | catch (ApiException e) 46 | { 47 | Console.WriteLine("Exception on calling the API : " + e.Message); 48 | WriteLogAudit(e.ErrorCode); 49 | return null; 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Source/Samples/TokenManagement/InstrumentIdentifier/CreateInstrumentIdentifierCard.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.TokenManagement 10 | { 11 | public class CreateInstrumentIdentifierCard 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static PostInstrumentIdentifierRequest Run() 21 | { 22 | var profileid = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; 23 | string cardNumber = "411111111111111"; 24 | TmsEmbeddedInstrumentIdentifierCard card = new TmsEmbeddedInstrumentIdentifierCard( 25 | Number: cardNumber 26 | ); 27 | 28 | var requestObj = new PostInstrumentIdentifierRequest( 29 | Card: card 30 | ); 31 | 32 | try 33 | { 34 | var configDictionary = new Configuration().GetConfiguration(); 35 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 36 | 37 | var apiInstance = new InstrumentIdentifierApi(clientConfig); 38 | PostInstrumentIdentifierRequest result = apiInstance.PostInstrumentIdentifier(requestObj, profileid); 39 | Console.WriteLine(result); 40 | WriteLogAudit(apiInstance.GetStatusCode()); 41 | return result; 42 | } 43 | catch (ApiException e) 44 | { 45 | Console.WriteLine("Exception on calling the API : " + e.Message); 46 | WriteLogAudit(e.ErrorCode); 47 | return null; 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Source/Samples/TokenManagement/InstrumentIdentifier/DeleteInstrumentIdentifier.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.TokenManagement 10 | { 11 | public class DeleteInstrumentIdentifier 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static void Run() 21 | { 22 | var profileid = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; 23 | var tokenId = CreateInstrumentIdentifierCard.Run().Id; 24 | try 25 | { 26 | var configDictionary = new Configuration().GetConfiguration(); 27 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 28 | 29 | var apiInstance = new InstrumentIdentifierApi(clientConfig); 30 | apiInstance.DeleteInstrumentIdentifier(tokenId, profileid); 31 | Console.WriteLine($"Instrument Identifier {tokenId} has been deleted."); 32 | WriteLogAudit(apiInstance.GetStatusCode()); 33 | } 34 | catch (ApiException e) 35 | { 36 | Console.WriteLine("Exception on calling the API : " + e.Message); 37 | WriteLogAudit(e.ErrorCode); 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Source/Samples/TokenManagement/InstrumentIdentifier/ListPaymentInstrumentsForInstrumentIdentifier.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.TokenManagement 10 | { 11 | public class ListPaymentInstrumentsForInstrumentIdentifier 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static PaymentInstrumentList1 Run() 21 | { 22 | string instrumentIdentifierTokenId = "7010000000016241111"; 23 | string profileid = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; 24 | long? offset = (long?)null; 25 | long? limit = (long?)null; 26 | try 27 | { 28 | var configDictionary = new Configuration().GetConfiguration(); 29 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 30 | 31 | var apiInstance = new InstrumentIdentifierApi(clientConfig); 32 | PaymentInstrumentList1 result = apiInstance.GetInstrumentIdentifierPaymentInstrumentsList(instrumentIdentifierTokenId, profileid, false, offset, limit); 33 | Console.WriteLine(result); 34 | WriteLogAudit(apiInstance.GetStatusCode()); 35 | return result; 36 | } 37 | catch (ApiException e) 38 | { 39 | Console.WriteLine("Exception on calling the API : " + e.Message); 40 | WriteLogAudit(e.ErrorCode); 41 | return null; 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Source/Samples/TokenManagement/InstrumentIdentifier/RetrieveInstrumentIdentifier.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.TokenManagement 10 | { 11 | public class RetrieveInstrumentIdentifier 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static PostInstrumentIdentifierRequest Run() 21 | { 22 | var profileid = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; 23 | var tokenId = "7010000000016241111"; 24 | try 25 | { 26 | var configDictionary = new Configuration().GetConfiguration(); 27 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 28 | 29 | var apiInstance = new InstrumentIdentifierApi(clientConfig); 30 | PostInstrumentIdentifierRequest result = apiInstance.GetInstrumentIdentifier(tokenId, profileid); 31 | Console.WriteLine(result); 32 | WriteLogAudit(apiInstance.GetStatusCode()); 33 | return result; 34 | } 35 | catch (ApiException e) 36 | { 37 | Console.WriteLine("Exception on calling the API : " + e.Message); 38 | WriteLogAudit(e.ErrorCode); 39 | return null; 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Source/Samples/TokenManagement/PaymentInstrument/DeletePaymentInstrument.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.TokenManagement 10 | { 11 | public class DeletePaymentInstrument 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static void Run() 21 | { 22 | var profileid = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; 23 | var tokenId = CreatePaymentInstrumentCard.Run().Id; 24 | 25 | try 26 | { 27 | var configDictionary = new Configuration().GetConfiguration(); 28 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 29 | 30 | var apiInstance = new PaymentInstrumentApi(clientConfig); 31 | apiInstance.DeletePaymentInstrument(tokenId, profileid); 32 | Console.WriteLine($"Payment Instrument {tokenId} has been deleted."); 33 | WriteLogAudit(apiInstance.GetStatusCode()); 34 | } 35 | catch (ApiException e) 36 | { 37 | Console.WriteLine("Exception on calling the API : " + e.Message); 38 | WriteLogAudit(e.ErrorCode); 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Source/Samples/TokenManagement/PaymentInstrument/RetrievePaymentInstrument.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.TokenManagement 10 | { 11 | public class RetrievePaymentInstrument 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static PostPaymentInstrumentRequest Run() 21 | { 22 | var profileid = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; 23 | var tokenId = "888454C31FB6150CE05340588D0AA9BE"; 24 | 25 | try 26 | { 27 | var configDictionary = new Configuration().GetConfiguration(); 28 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 29 | 30 | var apiInstance = new PaymentInstrumentApi(clientConfig); 31 | PostPaymentInstrumentRequest result = apiInstance.GetPaymentInstrument(tokenId, profileid); 32 | Console.WriteLine(result); 33 | WriteLogAudit(apiInstance.GetStatusCode()); 34 | return result; 35 | } 36 | catch (ApiException e) 37 | { 38 | Console.WriteLine("Exception on calling the API : " + e.Message); 39 | WriteLogAudit(e.ErrorCode); 40 | return null; 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Source/Samples/TransactionBatches/GetIndividualBatchFile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.TransactionBatches 10 | { 11 | public class GetIndividualBatchFile 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static PtsV1TransactionBatchesIdGet200Response Run() 21 | { 22 | try 23 | { 24 | var id = "12345"; 25 | 26 | var configDictionary = new Configuration().GetConfiguration(); 27 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 28 | 29 | var apiInstance = new TransactionBatchesApi(clientConfig); 30 | PtsV1TransactionBatchesIdGet200Response result = apiInstance.GetTransactionBatchId(id); 31 | Console.WriteLine(result); 32 | WriteLogAudit(apiInstance.GetStatusCode()); 33 | return result; 34 | } 35 | catch (ApiException e) 36 | { 37 | Console.WriteLine("Exception on calling the API : " + e.Message); 38 | WriteLogAudit(e.ErrorCode); 39 | return null; 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Source/Samples/TransactionBatches/GetListOfBatchFiles.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.TransactionBatches 10 | { 11 | public class GetListOfBatchFiles 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static PtsV1TransactionBatchesGet200Response Run() 21 | { 22 | var startTime = DateTime.ParseExact("2020-02-22T01:47:57Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); 23 | var endTime = DateTime.ParseExact("2020-02-22T22:47:57Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); 24 | try 25 | { 26 | var configDictionary = new Configuration().GetConfiguration(); 27 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 28 | 29 | var apiInstance = new TransactionBatchesApi(clientConfig); 30 | PtsV1TransactionBatchesGet200Response result = apiInstance.GetTransactionBatches(startTime, endTime); 31 | Console.WriteLine(result); 32 | WriteLogAudit(apiInstance.GetStatusCode()); 33 | return result; 34 | } 35 | catch (ApiException e) 36 | { 37 | Console.WriteLine("Exception on calling the API : " + e.Message); 38 | WriteLogAudit(e.ErrorCode); 39 | return null; 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Source/Samples/TransactionDetails/RetrieveTransaction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | using Cybersource_rest_samples_dotnet.Samples.Payments; 9 | 10 | namespace Cybersource_rest_samples_dotnet.Samples.TransactionDetails 11 | { 12 | public class RetrieveTransaction 13 | { 14 | public static void WriteLogAudit(int status) 15 | { 16 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 17 | var filename = filePath[filePath.Length - 1]; 18 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 19 | } 20 | 21 | public static TssV2TransactionsGet200Response Run() 22 | { 23 | string id = SimpleAuthorizationInternet.Run().Id; 24 | 25 | System.Threading.Thread.Sleep(15000); 26 | 27 | try 28 | { 29 | var configDictionary = new Configuration().GetConfiguration(); 30 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 31 | 32 | var apiInstance = new TransactionDetailsApi(clientConfig); 33 | TssV2TransactionsGet200Response result = apiInstance.GetTransaction(id); 34 | Console.WriteLine(result); 35 | WriteLogAudit(apiInstance.GetStatusCode()); 36 | return result; 37 | } 38 | catch (ApiException e) 39 | { 40 | Console.WriteLine("Exception on calling the API : " + e.Message); 41 | WriteLogAudit(e.ErrorCode); 42 | return null; 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Source/Samples/TransactionSearch/CreateSearchRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.TransactionSearch 10 | { 11 | public class CreateSearchRequest 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static TssV2TransactionsPost201Response Run() 21 | { 22 | bool save = false; 23 | string name = "MRN"; 24 | string timezone = "America/Chicago"; 25 | string query = "clientReferenceInformation.code:TC50171_3 AND submitTimeUtc:[NOW/DAY-7DAYS TO NOW/DAY+1DAY}"; 26 | int offset = 0; 27 | int limit = 100; 28 | string sort = "id:asc,submitTimeUtc:asc"; 29 | var requestObj = new CyberSource.Model.CreateSearchRequest( 30 | Save: save, 31 | Name: name, 32 | Timezone: timezone, 33 | Query: query, 34 | Offset: offset, 35 | Limit: limit, 36 | Sort: sort 37 | ); 38 | 39 | try 40 | { 41 | var configDictionary = new Configuration().GetConfiguration(); 42 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 43 | 44 | var apiInstance = new SearchTransactionsApi(clientConfig); 45 | TssV2TransactionsPost201Response result = apiInstance.CreateSearch(requestObj); 46 | Console.WriteLine(result); 47 | WriteLogAudit(apiInstance.GetStatusCode()); 48 | return result; 49 | } 50 | catch (ApiException e) 51 | { 52 | Console.WriteLine("Exception on calling the API : " + e.Message); 53 | WriteLogAudit(e.ErrorCode); 54 | return null; 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Source/Samples/TransactionSearch/GetSearchResults.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.TransactionSearch 10 | { 11 | public class GetSearchResults 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static TssV2TransactionsPost201Response Run() 21 | { 22 | var searchId = CreateSearchRequest.Run().SearchId; 23 | 24 | try 25 | { 26 | var configDictionary = new Configuration().GetConfiguration(); 27 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 28 | 29 | var apiInstance = new SearchTransactionsApi(clientConfig); 30 | TssV2TransactionsPost201Response result = apiInstance.GetSearch(searchId); 31 | Console.WriteLine(result); 32 | WriteLogAudit(apiInstance.GetStatusCode()); 33 | return result; 34 | } 35 | catch (ApiException e) 36 | { 37 | Console.WriteLine("Exception on calling the API : " + e.Message); 38 | WriteLogAudit(e.ErrorCode); 39 | return null; 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Source/Samples/UserManagement/UserManagement/GetUserInformationDeprecated.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.UserManagement 10 | { 11 | public class GetUserInformationDeprecated 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static UmsV1UsersGet200Response Run() 21 | { 22 | string organizationId = "testrest"; 23 | string userName = null; 24 | string permissionId = "CustomerProfileViewPermission"; 25 | string roleId = null; 26 | try 27 | { 28 | var configDictionary = new Configuration().GetConfiguration(); 29 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 30 | 31 | var apiInstance = new UserManagementApi(clientConfig); 32 | UmsV1UsersGet200Response result = apiInstance.GetUsers(organizationId, userName, permissionId, roleId); 33 | Console.WriteLine(result); 34 | WriteLogAudit(apiInstance.GetStatusCode()); 35 | return result; 36 | } 37 | catch (ApiException e) 38 | { 39 | Console.WriteLine("Exception on calling the API : " + e.Message); 40 | WriteLogAudit(e.ErrorCode); 41 | Console.WriteLine(e.StackTrace); 42 | return null; 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Source/Samples/ValueAddedService/VoidCommittedTaxCall.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | 5 | using CyberSource.Api; 6 | using CyberSource.Client; 7 | using CyberSource.Model; 8 | 9 | namespace Cybersource_rest_samples_dotnet.Samples.ValueAddedService 10 | { 11 | public class VoidCommittedTaxCall 12 | { 13 | public static void WriteLogAudit(int status) 14 | { 15 | var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); 16 | var filename = filePath[filePath.Length - 1]; 17 | Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); 18 | } 19 | 20 | public static VasV2TaxVoid200Response Run() 21 | { 22 | string id = CommittedTaxCallRequest.Run().Id; 23 | string clientReferenceInformationCode = "TAX_TC001"; 24 | Vasv2taxidClientReferenceInformation clientReferenceInformation = new Vasv2taxidClientReferenceInformation( 25 | Code: clientReferenceInformationCode 26 | ); 27 | 28 | var requestObj = new VoidTaxRequest( 29 | ClientReferenceInformation: clientReferenceInformation 30 | ); 31 | 32 | try 33 | { 34 | var configDictionary = new Configuration().GetConfiguration(); 35 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 36 | 37 | var apiInstance = new TaxesApi(clientConfig); 38 | VasV2TaxVoid200Response result = apiInstance.VoidTax(requestObj, id); 39 | Console.WriteLine(result); 40 | WriteLogAudit(apiInstance.GetStatusCode()); 41 | return result; 42 | } 43 | catch (ApiException e) 44 | { 45 | Console.WriteLine("Exception on calling the API : " + e.Message); 46 | WriteLogAudit(e.ErrorCode); 47 | return null; 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Source/Samples/Webhooks/CreateNewWebhooks/CreateWebhookSymmetricKey.cs: -------------------------------------------------------------------------------- 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.Webhooks.CreateNewWebhooks 9 | { 10 | public class CreateWebhookSymmetricKey 11 | { 12 | public static void Run() 13 | { 14 | string clientRequestAction = "CREATE"; 15 | string keyInformationProvider = "nrtd"; 16 | string keyInformationTenant = ""; 17 | string keyInformationKeyType = "sharedSecret"; 18 | string keyInformationOrganizationId = ""; 19 | string vCcorrelationId = null; 20 | string vCsenderOrganizationId = null; 21 | string vCpermissions = null; 22 | 23 | Kmsegressv2keyssymKeyInformation keyInformation = new Kmsegressv2keyssymKeyInformation( 24 | Provider: keyInformationProvider, 25 | Tenant: keyInformationTenant, 26 | KeyType: keyInformationKeyType, 27 | OrganizationId: keyInformationOrganizationId 28 | ); 29 | 30 | var requestObj = new SaveSymEgressKey( 31 | ClientRequestAction: clientRequestAction, 32 | KeyInformation: keyInformation 33 | ); 34 | 35 | try 36 | { 37 | var configDictionary = new Configuration().GetConfiguration(); 38 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 39 | 40 | var apiInstance = new CreateNewWebhooksApi(clientConfig); 41 | apiInstance.SaveSymEgressKey(vCsenderOrganizationId, vCpermissions, vCcorrelationId, requestObj); 42 | } 43 | catch (Exception e) 44 | { 45 | Console.WriteLine("Exception on calling the API : " + e.Message); 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Source/Samples/Webhooks/CreateNewWebhooks/FindProductsYouCanSubscribeTo.cs: -------------------------------------------------------------------------------- 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.Webhooks.CreateNewWebhooks 9 | { 10 | public class FindProductsYouCanSubscribeTo 11 | { 12 | public static void Run() 13 | { 14 | string organizationId = "testrest"; 15 | 16 | try 17 | { 18 | var configDictionary = new Configuration().GetConfiguration(); 19 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 20 | 21 | var apiInstance = new CreateNewWebhooksApi(clientConfig); 22 | //apiInstance.FindProductsToSubscribe(organizationId); 23 | } 24 | catch (Exception e) 25 | { 26 | Console.WriteLine("Exception on calling the API : " + e.Message); 27 | } 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Source/Samples/Webhooks/CreateNewWebhooks/StoreOAuthCredentials.cs: -------------------------------------------------------------------------------- 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.Webhooks.CreateNewWebhooks 9 | { 10 | public class StoreOAuthCredentials 11 | { 12 | public static void Run() 13 | { 14 | string clientRequestAction = "STORE"; 15 | string keyInformationProvider = ""; 16 | string keyInformationTenant = "nrtd"; 17 | string keyInformationKeyType = "oAuthClientCredentials"; 18 | string keyInformationOrganizationId = ""; 19 | string keyInformationClientKeyId = "client username"; 20 | string keyInformationKey = "client secret"; 21 | string keyInformationExpiryDuration = "365"; 22 | string vCcorrelationId = null; 23 | string vCsenderOrganizationId = null; 24 | string vCpermissions = null; 25 | 26 | Kmsegressv2keyssymKeyInformation keyInformation = new Kmsegressv2keyssymKeyInformation( 27 | Provider: keyInformationProvider, 28 | Tenant: keyInformationTenant, 29 | KeyType: keyInformationKeyType, 30 | OrganizationId: keyInformationOrganizationId, 31 | ClientKeyId: keyInformationClientKeyId, 32 | Key: keyInformationKey, 33 | ExpiryDuration: keyInformationExpiryDuration 34 | ); 35 | 36 | var requestObj = new SaveSymEgressKey( 37 | ClientRequestAction: clientRequestAction, 38 | KeyInformation: keyInformation 39 | ); 40 | 41 | try 42 | { 43 | var configDictionary = new Configuration().GetConfiguration(); 44 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 45 | 46 | var apiInstance = new CreateNewWebhooksApi(clientConfig); 47 | apiInstance.SaveSymEgressKey(vCsenderOrganizationId, vCpermissions, vCcorrelationId, requestObj); 48 | } 49 | catch (Exception e) 50 | { 51 | Console.WriteLine("Exception on calling the API : " + e.Message); 52 | } 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /Source/Samples/Webhooks/ManageWebhooks/DeleteWebhookSubscription.cs: -------------------------------------------------------------------------------- 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.Webhooks.ManageWebhooks 9 | { 10 | public class DeleteWebhookSubscription 11 | { 12 | public static void Run(string webhookId) 13 | { 14 | try 15 | { 16 | var configDictionary = new Configuration().GetConfiguration(); 17 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 18 | 19 | var apiInstance = new ManageWebhooksApi(clientConfig); 20 | //apiInstance.DeleteWebhookSubscription(webhookId); 21 | } 22 | catch (Exception e) 23 | { 24 | Console.WriteLine("Exception on calling the API : " + e.Message); 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /Source/Samples/Webhooks/ManageWebhooks/GetDetailsOnAllCreatedWebhooks.cs: -------------------------------------------------------------------------------- 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.Webhooks.ManageWebhooks 9 | { 10 | public class GetDetailsOnAllCreatedWebhooks 11 | { 12 | /*public static List Run() 13 | { 14 | // QUERY PARAMETERS 15 | string organizationId = "testrest"; 16 | string productId = "testProductId"; 17 | string eventType = "testEventType"; 18 | try 19 | { 20 | var configDictionary = new Configuration().GetConfiguration(); 21 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 22 | 23 | var apiInstance = new ManageWebhooksApi(clientConfig); 24 | List result = apiInstance.GetWebhookSubscriptionsByOrg(organizationId, productId, eventType); 25 | Console.WriteLine(result); 26 | return result; 27 | } 28 | catch (Exception e) 29 | { 30 | Console.WriteLine("Exception on calling the API : " + e.Message); 31 | return null; 32 | } 33 | }*/ 34 | } 35 | } -------------------------------------------------------------------------------- /Source/Samples/Webhooks/ManageWebhooks/GetDetailsOnSingleWebhook.cs: -------------------------------------------------------------------------------- 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.Webhooks.ManageWebhooks 9 | { 10 | public class GetDetailsOnSingleWebhook 11 | { 12 | public static void Run() 13 | { 14 | string webhookId = ""; 15 | try 16 | { 17 | var configDictionary = new Configuration().GetConfiguration(); 18 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 19 | 20 | var apiInstance = new ManageWebhooksApi(clientConfig); 21 | //apiInstance.GetWebhookSubscriptionById(webhookId); 22 | } 23 | catch (Exception e) 24 | { 25 | Console.WriteLine("Exception on calling the API : " + e.Message); 26 | } 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Source/Samples/Webhooks/ManageWebhooks/ReplayFailedTransactionsBySetStartAndEndTime.cs: -------------------------------------------------------------------------------- 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.Webhooks.ManageWebhooks 9 | { 10 | public class ReplayFailedTransactionsBySetStartAndEndTime 11 | { 12 | public static void Run() 13 | { 14 | /*string webhookId = ""; 15 | string byDeliveryStatusStatus = "FAILED"; 16 | var byDeliveryStatusStartTime = DateTime.Parse("2021-01-01T15:05:52.284+05:30"); 17 | var byDeliveryStatusEndTime = DateTime.Parse("2021-01-02T03:05:52.284+05:30"); 18 | string byDeliveryStatusProductId = "tokenManagement"; 19 | string byDeliveryStatusEventType = "tms.token.created"; 20 | Nrtfv1webhookswebhookIdreplaysByDeliveryStatus byDeliveryStatus = new Nrtfv1webhookswebhookIdreplaysByDeliveryStatus( 21 | Status: byDeliveryStatusStatus, 22 | StartTime: byDeliveryStatusStartTime, 23 | EndTime: byDeliveryStatusEndTime, 24 | ProductId: byDeliveryStatusProductId, 25 | EventType: byDeliveryStatusEventType 26 | ); 27 | 28 | var requestObj = new ReplayWebhooksRequest( 29 | ByDeliveryStatus: byDeliveryStatus 30 | ); 31 | 32 | try 33 | { 34 | var configDictionary = new Configuration().GetConfiguration(); 35 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 36 | 37 | var apiInstance = new ReplayWebhooksApi(clientConfig); 38 | apiInstance.ReplayPreviousWebhooks(webhookId, requestObj); 39 | } 40 | catch (Exception e) 41 | { 42 | Console.WriteLine("Exception on calling the API : " + e.Message); 43 | } 44 | */ } 45 | } 46 | } -------------------------------------------------------------------------------- /Source/Samples/Webhooks/ManageWebhooks/ReplayFailedTransactionsInLast24Hours.cs: -------------------------------------------------------------------------------- 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.Webhooks.ManageWebhooks 9 | { 10 | public class ReplayFailedTransactionsInLast24Hours 11 | { 12 | public static void Run() 13 | { 14 | /*string webhookId = ""; 15 | string byDeliveryStatusStatus = "FAILED"; 16 | int byDeliveryStatusHoursBack = 24; 17 | string byDeliveryStatusProductId = "tokenManagement"; 18 | string byDeliveryStatusEventType = "tms.token.created"; 19 | Nrtfv1webhookswebhookIdreplaysByDeliveryStatus byDeliveryStatus = new Nrtfv1webhookswebhookIdreplaysByDeliveryStatus( 20 | Status: byDeliveryStatusStatus, 21 | HoursBack: byDeliveryStatusHoursBack, 22 | ProductId: byDeliveryStatusProductId, 23 | EventType: byDeliveryStatusEventType 24 | ); 25 | 26 | var requestObj = new ReplayWebhooksRequest( 27 | ByDeliveryStatus: byDeliveryStatus 28 | ); 29 | 30 | try 31 | { 32 | var configDictionary = new Configuration().GetConfiguration(); 33 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 34 | 35 | var apiInstance = new ReplayWebhooksApi(clientConfig); 36 | apiInstance.ReplayPreviousWebhooks(webhookId, requestObj); 37 | } 38 | catch (Exception e) 39 | { 40 | Console.WriteLine("Exception on calling the API : " + e.Message); 41 | }*/ 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Source/Samples/Webhooks/ManageWebhooks/ReplaySpecificListOfTransactions.cs: -------------------------------------------------------------------------------- 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.Webhooks.ManageWebhooks 9 | { 10 | public class ReplaySpecificListOfTransactions 11 | { 12 | public static void Run() 13 | { 14 | /*string webhookId = ""; 15 | List byTransactionTraceIdentifiers = new List (); 16 | byTransactionTraceIdentifiers.Add("1f1d0bf4-9299-418d-99d8-faa3313829f1"); 17 | byTransactionTraceIdentifiers.Add("d19fb205-20e5-43a2-867e-bd0f574b771e"); 18 | byTransactionTraceIdentifiers.Add("2f2461a3-457c-40e9-867f-aced89662bbb"); 19 | byTransactionTraceIdentifiers.Add("e23ddc19-93d5-4f1f-8482-d7cafbb3ed9b"); 20 | byTransactionTraceIdentifiers.Add("eb9fc4a9-b31f-48d5-81a9-b1d773fd76d8"); 21 | var requestObj = new ReplayWebhooksRequest( 22 | ByTransactionTraceIdentifiers: byTransactionTraceIdentifiers 23 | ); 24 | 25 | try 26 | { 27 | var configDictionary = new Configuration().GetConfiguration(); 28 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 29 | 30 | var apiInstance = new ReplayWebhooksApi(clientConfig); 31 | apiInstance.ReplayPreviousWebhooks(webhookId, requestObj); 32 | } 33 | catch (Exception e) 34 | { 35 | Console.WriteLine("Exception on calling the API : " + e.Message); 36 | }*/ 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /Source/Samples/Webhooks/ManageWebhooks/UpdateWebhook.cs: -------------------------------------------------------------------------------- 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.Webhooks.ManageWebhooks 9 | { 10 | public class UpdateWebhook 11 | { 12 | public static void Run() 13 | { 14 | /*string webhookId = ""; 15 | string name = "My Sample Webhook"; 16 | string description = "Update to my sample webhook"; 17 | string organizationId = ""; 18 | string productId = "terminalManagement"; 19 | 20 | List eventTypes = new List (); 21 | eventTypes.Add("terminalManagement.assignment.update"); 22 | eventTypes.Add("terminalManagement.status.update"); 23 | string webhookUrl = "https://MyWebhookServer.com:8443:/simulateClient"; 24 | string healthCheckUrl = "https://MyWebhookServer.com:8443:/simulateClientHealthCheck"; 25 | string status = "INACTIVE"; 26 | string notificationScopeScope = "SELF"; 27 | Notificationsubscriptionsv1webhooksNotificationScope notificationScope = new Notificationsubscriptionsv1webhooksNotificationScope( 28 | Scope: notificationScopeScope 29 | ); 30 | 31 | var requestObj = new UpdateWebhookRequest( 32 | Name: name, 33 | Description: description, 34 | OrganizationId: organizationId, 35 | ProductId: productId, 36 | EventTypes: eventTypes, 37 | WebhookUrl: webhookUrl, 38 | HealthCheckUrl: healthCheckUrl, 39 | Status: status, 40 | NotificationScope: notificationScope 41 | ); 42 | 43 | try 44 | { 45 | var configDictionary = new Configuration().GetConfiguration(); 46 | var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); 47 | 48 | var apiInstance = new ManageWebhooksApi(clientConfig); 49 | apiInstance.UpdateWebhookSubscription(webhookId, requestObj); 50 | } 51 | catch (Exception e) 52 | { 53 | Console.WriteLine("Exception on calling the API : " + e.Message); 54 | }*/ 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /Source/Utilities.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Cybersource_rest_samples_dotnet 8 | { 9 | public class Utilities 10 | { 11 | private static Random random = new Random(); 12 | 13 | public static string RandomString(int length) 14 | { 15 | const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; 16 | return new string(Enumerable.Repeat(chars, length) 17 | .Select(s => s[random.Next(s.Length)]).ToArray()); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Source/lib/net461/ApiSdk.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyberSource/cybersource-rest-samples-csharp/8ed4c10f376f63196c11d081d247b8eaa8c9ba5b/Source/lib/net461/ApiSdk.dll -------------------------------------------------------------------------------- /Source/lib/netstandard/ApiSdk.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyberSource/cybersource-rest-samples-csharp/8ed4c10f376f63196c11d081d247b8eaa8c9ba5b/Source/lib/netstandard/ApiSdk.dll -------------------------------------------------------------------------------- /Validation/sample_code_log_processor.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | IMPORTS 4 | """ 5 | 6 | import argparse 7 | import re 8 | import json 9 | 10 | """ 11 | ARGUMENT PARSER 12 | """ 13 | 14 | def parse_arguments(): 15 | parser = argparse.ArgumentParser(description="Processes the log file from Sample Code Testing") 16 | parser.add_argument("--log", "-l", help="Log file for the current testing run of Sample Codes") 17 | parser.add_argument("--output", "-o", help="JSON file to store the actual results from the current testing run") 18 | 19 | args = parser.parse_args() 20 | log_path = args.log 21 | output_file = args.output 22 | return log_path, output_file 23 | 24 | """ 25 | LOG FILE PROCESSOR 26 | """ 27 | 28 | def process_log_file(filepath): 29 | with open(filepath, "r", encoding = "utf-8") as file: 30 | contents = file.read() 31 | matches = re.findall(r"(\[Sample Code Testing\]) (\[([A-Za-z0-9\-_]+)\]) ([0-9]{3})", contents) 32 | 33 | return matches 34 | 35 | """ 36 | ADD TO JSON OBJECT 37 | """ 38 | 39 | def add_to_json_object(json_obj, key, value): 40 | json_obj[key] = value 41 | return json_obj 42 | 43 | """ 44 | DUMP JSON TO FILE 45 | """ 46 | 47 | def dump_json_to_file(filepath, src): 48 | with open(filepath, "w") as file: 49 | json.dump(src, file, ensure_ascii=False, indent=4) 50 | 51 | """ 52 | MAIN FUNCTION 53 | """ 54 | 55 | def main(): 56 | current_log_file, output_json_file = parse_arguments() 57 | log_statements = process_log_file(current_log_file) 58 | 59 | code_map = {} 60 | for statement in log_statements: 61 | if statement[2] not in ("Configuration"): 62 | code_map = add_to_json_object(code_map, statement[2], statement[3]) 63 | 64 | dump_json_to_file(output_json_file, code_map) 65 | 66 | if __name__ == "__main__": 67 | main() -------------------------------------------------------------------------------- /cybersource-rest-samples-csharp.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.4.33205.214 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cybersource-rest-samples-csharp", "cybersource-rest-samples-csharp.csproj", "{97FF11A4-924D-4C87-A028-2AAF64655954}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {97FF11A4-924D-4C87-A028-2AAF64655954}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {97FF11A4-924D-4C87-A028-2AAF64655954}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {97FF11A4-924D-4C87-A028-2AAF64655954}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {97FF11A4-924D-4C87-A028-2AAF64655954}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {FB9CA784-6AD6-40A2-97AE-8F3EB809EBD3} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /cybersource-rest-samples-netcore.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | SampleCodeNetCore 7 | SampleCodeNetCore 8 | 9 | 10 | 11 | bin\Debug 12 | full 13 | true 14 | 15 | 16 | 17 | bin\Release 18 | pdbonly 19 | true 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 | Source\lib\netstandard\ApiSdk.dll 56 | true 57 | 58 | 59 | 60 | 61 | 62 | Always 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /cybersource-rest-samples-netcore.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30517.126 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "cybersource-rest-samples-netcore", "cybersource-rest-samples-netcore.csproj", "{EB3608A8-87BA-48C2-B5FA-99B0C400C3AC}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {EB3608A8-87BA-48C2-B5FA-99B0C400C3AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {EB3608A8-87BA-48C2-B5FA-99B0C400C3AC}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {EB3608A8-87BA-48C2-B5FA-99B0C400C3AC}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {EB3608A8-87BA-48C2-B5FA-99B0C400C3AC}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {BC37D5E2-EA43-4842-ADDE-04C956DC6FFC} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | --------------------------------------------------------------------------------