-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from PinchPayments/multi-nonce-responses
Added multi-nonce support to the responses
- Loading branch information
Showing
8 changed files
with
101 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
name: Upload dotnet package | ||
|
||
on: | ||
release: | ||
types: [created] | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
|
||
jobs: | ||
deploy: | ||
|
@@ -19,12 +20,24 @@ jobs: | |
env: | ||
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
|
||
- name: Get the version | ||
id: get_version | ||
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/} | ||
|
||
- name: Build | ||
run: dotnet build --configuration Release | ||
|
||
- name: Create the package | ||
run: dotnet pack --configuration Release | ||
run: dotnet pack --configuration Release -p:PackageVersion=${{ steps.get_version.outputs.VERSION }} | ||
|
||
- name: Publish the package to GPR | ||
working-directory: ./src/Pinch.SDK | ||
run: dotnet nuget push ./bin/Release/*.nupkg | ||
run: dotnet nuget push ./bin/Release/*.nupkg | ||
|
||
- name: Publish Github Release | ||
uses: marvinpinto/[email protected] | ||
with: | ||
title: v${{ steps.get_version.outputs.VERSION }} | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
prerelease: false | ||
files: ./bin/Release/*.nupkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,40 @@ | ||
 | ||
|
||
# Pinch SDK for .NET | ||
The Pinch SDK for .NET helps developers build web, desktop, Silverlight, Windows Phone and Windows Store applications that integrate with Pinch. | ||
The Pinch SDK for .NET helps developers build applications that integrate with Pinch across all supported .NET platforms. | ||
|
||
## NuGet | ||
|
||
Install-Package Pinch.SDK | ||
## Installation | ||
Using the .NET Core command-line interface (CLI) tools: | ||
|
||
dotnet add package Pinch.SDK | ||
|
||
*The Pinch SDK for .NET binaries are only distributed via nuget. For those using older versions of Visual Studio that | ||
does not support NuGet Package Manager, please download the [command line version of NuGet.exe](http://nuget.codeplex.com/releases/view/58939) and run the following | ||
command.* | ||
Using the NuGet Command Line Interface (CLI): | ||
|
||
nuget install Pinch.SDK | ||
|
||
If you would like to get an older version of the the binaries please use the following command. | ||
|
||
nuget install Pinch.SDK -v 0.17.1 | ||
Using the Package Manager Console: | ||
|
||
Install-Package Pinch.SDK | ||
|
||
From within Visual Studio: | ||
|
||
1. Open the Solution Explorer. | ||
2. Right-click on a project within your solution. | ||
3. Click on Manage NuGet Packages... | ||
4. Click on the Browse tab and search for "Pinch.SDK". | ||
5. Click on the Pinch.SDK package, select the appropriate version in the right-tab and click Install. | ||
|
||
See the [Pinch.SDK nuget page](https://www.nuget.org/packages/Pinch.SDK) for all previous versions. | ||
|
||
|
||
## Documentation | ||
You can find the documentation for this project [here](https://docs.getpinch.com.au/). | ||
Check out the [Pinch API documentation here](https://docs.getpinch.com.au/) for the full API reference as well as example usages and guides on using the Pinch API. | ||
|
||
## Features | ||
* Compatible with all Pinch REST API methods. | ||
* Supports both sandboxed test environment and production. | ||
* Sample applications and documentation are provided to get you started quickly. | ||
|
||
## Supported Platforms | ||
* .NET 3.5 (Client Profile and Full Profile) | ||
* .NET 4.0 (Client Profile and Full Profile) | ||
* .NET 4.5 | ||
* .NET Standard 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Linq; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Pinch.SDK.Converters | ||
{ | ||
internal class SingleOrArrayConverter<T> : JsonConverter | ||
{ | ||
public override bool CanConvert(Type objectType) | ||
{ | ||
return (objectType == typeof(List<T>)); | ||
} | ||
|
||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) | ||
{ | ||
JToken token = JToken.Load(reader); | ||
if (token.Type == JTokenType.Array) | ||
{ | ||
return token.ToObject<List<T>>(); | ||
} | ||
return new List<T> { token.ToObject<T>() }; | ||
} | ||
|
||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) | ||
{ | ||
List<T> list = (List<T>)value; | ||
if (list.Count == 1) | ||
{ | ||
value = list[0]; | ||
} | ||
serializer.Serialize(writer, value); | ||
} | ||
|
||
public override bool CanWrite | ||
{ | ||
get { return true; } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters