Skip to content

Commit

Permalink
Release 4.0.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
WorldlineConnect committed Mar 19, 2024
1 parent ccc85d3 commit d281d64
Show file tree
Hide file tree
Showing 624 changed files with 29,291 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.gitattributes export-ignore
.gitignore export-ignore

* text eol=lf

*.sln text
*.csproj text
*.png binary
*.ico binary
*.snk binary
57 changes: 57 additions & 0 deletions .github/workflows/api-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: API docs

on:
push:
tags: ['[0-9]+.[0-9]+*']

permissions:
contents: write

jobs:
api-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
path: code
persist-credentials: false
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '3.1'
- name: Install docfx
# Versions after 2.65.1 generate broken links to parent namespaces that don't exist
run: dotnet tool update -g docfx --version 2.65.1
- name: Build API docs
run: docfx docfx.json
working-directory: code/documentation
- name: Checkout pages
uses: actions/checkout@v3
with:
ref: gh-pages
path: pages
- name: Deploy pages
run: |
SDK_VERSION_FOLDER=`echo "$SDK_VERSION" | awk --field-separator '.' '{print $1".x";}'`
# Create .nojekyll if it doesn't exist yet
touch .nojekyll
mkdir -p "$SDK_VERSION_FOLDER"
rsync --quiet --archive --checksum --delete --exclude .git ../code/documentation/_site/ "$SDK_VERSION_FOLDER/"
if [ -e latest ]; then rm -r latest; fi
ln -s "$SDK_VERSION_FOLDER" latest
git config user.email "$USER_EMAIL"
git config user.name "$USER_NAME"
git add --all .
# Only commit when there are changes
git diff --quiet && git diff --staged --quiet || git commit --message "Generated API docs for version ${SDK_VERSION}"
git push
shell: bash
working-directory: pages
env:
SDK_VERSION: ${{ github.ref_name }}
USER_EMAIL: ${{ github.event.pusher.email }}
USER_NAME: ${{ github.event.pusher.name }}
43 changes: 43 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Deploy

on:
push:
tags: ['[0-9]+.[0-9]+*']

env:
SDK_VERSION: ${{ github.ref_name }}

jobs:
deploy:
# Build on Windows 2022 to support .NET Framework 4.5
runs-on: windows-2022
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
2.1
3.1
- name: Build
run: |
dotnet restore Worldline.Connect.Sdk
dotnet build -c Release Worldline.Connect.Sdk
dotnet pack -c Release Worldline.Connect.Sdk
dotnet restore Worldline.Connect.Sdk.StrongName
dotnet build -c Release Worldline.Connect.Sdk.StrongName
dotnet pack -c Release Worldline.Connect.Sdk.StrongName
- uses: actions/upload-artifact@v3
with:
name: packages
path: '**/*.nupkg'
retention-days: 1
- name: Deploy
run: |
dotnet nuget push Worldline.Connect.Sdk/bin/Release/Worldline.Connect.Sdk.${env:SDK_VERSION}.nupkg --api-key "${env:NUGET_API_KEY}" --source https://api.nuget.org/v3/index.json
dotnet nuget push Worldline.Connect.Sdk.StrongName/bin/Release/Worldline.Connect.Sdk.StrongName.${env:SDK_VERSION}.nupkg --api-key "${env:NUGET_API_KEY}" --source https://api.nuget.org/v3/index.json
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
46 changes: 46 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#Autosave files
*~

#build
[Oo]bj/
[Bb]in/
packages/
TestResults/

# globs
Makefile.in
*.DS_Store
*.sln.cache
*.suo
*.cache
*.pidb
*.userprefs
*.usertasks
config.log
config.make
config.status
aclocal.m4
install-sh
autom4te.cache/
*.user
*.tar.gz
tarballs/
test-results/
Thumbs.db

#Mac bundle stuff
*.dmg
*.app

#resharper
*_Resharper.*
*.Resharper

#dotCover
*.dotCover

#Visual Studio
.vs

#Visual Studio Code
.vscode
73 changes: 73 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Worldline Connect .NET SDK

## Introduction

The .NET SDK helps you to communicate with the [Worldline Connect](https://docs.connect.worldline-solutions.com/) Server API. Its primary features are:

* convenient C# wrapper around the API calls and responses
* marshalls C# request objects to HTTP requests
* unmarshalls HTTP responses to C# response objects or C# exceptions
* handling of all the details concerning authentication
* handling of required metadata

Its use is demonstrated by an example for each possible call. The examples execute a call using the provided API keys.

See the [Worldline Connect Developer Hub](https://docs.connect.worldline-solutions.com/documentation/sdk/server/dotnet/) for more information on how to use the SDK.

## Structure of this repository

This repository consists out of four main components:

1. The source code of the SDK itself: `/Worldline.Connect.Sdk`
2. The source code of the SDK unit tests: `/Worldline.Connect.Sdk.Tests`
3. The source code of the example integration tests: `/Worldline.Connect.Sdk.IntegrationTests`
4. The source code of the example calls: `/Worldline.Connect.Sdk.Examples`

## Requirements

The .NET SDK supports .NET Framework 4.5 and [.NET Standard](https://docs.microsoft.com/en-us/dotnet/standard/net-standard) 2.0 and 2.1.

### .NET Framework 4.5

When using .NET Framework 4.5, the following packages are rquired:

* [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) 13.0.1 or higher
* [NLog](https://www.nuget.org/packages/NLog/) 4.3.7 or higher
* [System.Collections.Immutable](https://www.nuget.org/packages/System.Collections.Immutable/) 1.2.0 or higher

In addition, the following references are required, which are part of the .NET Framework:
* System.Configuration
* System.Net.Http

### .NET Standard 2.0 and 2.1

When using .NET Standard 2.0 or 2.1, the following packages are rquired:

* [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) 13.0.1 or higher
* [NLog](https://www.nuget.org/packages/NLog/) 4.6.8 or higher
* [System.Collections.Immutable](https://www.nuget.org/packages/System.Collections.Immutable/) 1.6.0 or higher
* [System.Configuration.ConfigurationManager](https://www.nuget.org/packages/System.Configuration.ConfigurationManager/) 4.6.0 or higher

## Installation

### Release

#### Package Manager

To install the latest .NET SDK release, run the following command in the Package Manager Console (`Tools -> NuGet Package Manager -> Package Manager Console`) in Visual Studio:

PM> Install-Package Worldline.Connect.Sdk

#### .NET CLI

To install the latest .NET SDK release, run the following command:

dotnet add package Worldline.Connect.Sdk

### Release (Strong-Named)

To install the latest .NET SDK release as a [Strong-Named assembly](https://docs.microsoft.com/en-us/dotnet/framework/app-domains/strong-named-assemblies), follow the instructions above but use `Worldline.Connect.Sdk.StrongName` instead of `Worldline.Connect.Sdk`.

## Building the repository

This repository uses [Visual Studio](https://www.visualstudio.com/) 2022 to build. Open `Worldline.Connect.Sdk.sln` in Visual Studio, and click build.
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* This class was auto-generated from the API references found at
* https://apireference.connect.worldline-solutions.com/
*/
using System.Collections.Generic;
using Worldline.Connect.Sdk.V1;
using Worldline.Connect.Sdk.V1.Domain;

namespace Worldline.Connect.Sdk.V1.Merchant.Captures
{
public class CreateRefundCaptureExample
{
public async void Example()
{
#pragma warning disable 0168
using (var client = GetClient())
{
var amountOfMoney = new AmountOfMoney();
amountOfMoney.Amount = 500L;
amountOfMoney.CurrencyCode = "EUR";

var refundReferences = new RefundReferences();
refundReferences.MerchantReference = "AcmeOrder0001";

var body = new RefundRequest();
body.AmountOfMoney = amountOfMoney;
body.RefundReferences = refundReferences;

try
{
var response = await client.V1.WithNewMerchant("merchantId").Captures.Refund("captureId", body);
}
catch (DeclinedRefundException e)
{
HandleDeclinedRefund(e.RefundResult);
}
catch (ApiException e)
{
HandleApiErrors(e.Errors);
}
}
#pragma warning restore 0168
}

private static Client GetClient()
{
var apiKeyId = "someKey";
var secretApiKey = "someSecret";

var configuration = Factory.CreateConfiguration(apiKeyId, secretApiKey);
return Factory.CreateClient(configuration);
}

private static void HandleDeclinedRefund(RefundResult refundResult)
{
// handle the result here
}

private static void HandleApiErrors(IList<APIError> errors)
{
// handle the errors here
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* This class was auto-generated from the API references found at
* https://apireference.connect.worldline-solutions.com/
*/
using Worldline.Connect.Sdk.V1.Domain;

namespace Worldline.Connect.Sdk.V1.Merchant.Captures
{
public class GetCaptureExample
{
public async void Example()
{
#pragma warning disable 0168
using (var client = GetClient())
{
var response = await client.V1.WithNewMerchant("merchantId").Captures.Get("captureId");
}
#pragma warning restore 0168
}

private static Client GetClient()
{
var apiKeyId = "someKey";
var secretApiKey = "someSecret";

var configuration = Factory.CreateConfiguration(apiKeyId, secretApiKey);
return Factory.CreateClient(configuration);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* This class was auto-generated from the API references found at
* https://apireference.connect.worldline-solutions.com/
*/
using Worldline.Connect.Sdk.V1.Domain;

namespace Worldline.Connect.Sdk.V1.Merchant.Disputes
{
public class CancelDisputeExample
{
public async void Example()
{
#pragma warning disable 0168
using (var client = GetClient())
{
var response = await client.V1.WithNewMerchant("merchantId").Disputes.Cancel("disputeId");
}
#pragma warning restore 0168
}

private static Client GetClient()
{
var apiKeyId = "someKey";
var secretApiKey = "someSecret";

var configuration = Factory.CreateConfiguration(apiKeyId, secretApiKey);
return Factory.CreateClient(configuration);
}
}
}
Loading

0 comments on commit d281d64

Please sign in to comment.