Skip to content

Commit abd8a1c

Browse files
Maksymilian SzokalskiMaksymilian Szokalski
authored andcommitted
Merge branch 'main' of https://github.com/illunix/Axepta.SDK into dev
2 parents db7e2e7 + e49a5b8 commit abd8a1c

File tree

14 files changed

+203
-45
lines changed

14 files changed

+203
-45
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: 'CI'
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- dev
8+
pull_request: {}
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 0
17+
- uses: actions/setup-dotnet@v4
18+
with:
19+
global-json-file: './global.json'
20+
- run: dotnet --version
21+
- name: Build
22+
run: dotnet build
23+
- name: Test
24+
run: dotnet test --no-build

.github/workflows/dotnet.yml

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

global.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"sdk": {
3+
"version": "8.0.400",
4+
"rollForward": "latestFeature"
5+
}
6+
}
7+

samples/Axepta.Sample/Program.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,37 @@ CancellationToken ct
4646
}
4747
);
4848

49+
paymentEndpoints.MapPost(
50+
"/payment-url",
51+
async (
52+
IAxepta axepta,
53+
CancellationToken ct
54+
) =>
55+
{
56+
var payment = await axepta.CreatePaymentUrlAsync(
57+
new()
58+
{
59+
Amount = 100,
60+
Currency = Currency.PLN,
61+
OrderId = "123456789",
62+
ReturnUrl = "https://example.com",
63+
SuccessReturnUrl = "https://example.com/success",
64+
FailureReturnUrl = "https://example.com/failure",
65+
Customer = new()
66+
{
67+
Id = "123",
68+
FirstName = "Jan",
69+
LastName = "Kowalski",
70+
71+
}
72+
},
73+
ct
74+
);
75+
76+
return Results.Ok(payment);
77+
}
78+
);
79+
4980
paymentEndpoints.MapPost(
5081
"/webhook",
5182
async (
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"axepta-paywall": {
3-
"merchantId": "5n3bxvzoxife15djkmpa",
3+
"merchantId": "ir49nkdgnuex458f6wnq",
44
"service": {
5-
"id": "bf1efa70-a6d8-4c08-a512-52e8aa025952",
6-
"key": "XrvZlCclg45zOOBtANK5reKo4onNlMrKAwgM"
5+
"id": "eff3207f-d2a0-4560-99ce-bba83267c90b",
6+
"key": "67ieYPyhrqMIpx7UZCLfSimWT0vUm0I_lH0Z"
77
},
8-
"authToken": "rc9wg0rosqzfx4dcdh1epzloemn5fhuis62gy37faxhd7iojhhop6eb341jbqfpw",
8+
"authToken": "ttfc9ve4zeseca4egs0pguk15c3yckkwf7d1n1ts8e55y5hs68886ujt76z5glbl",
99
"sandbox": true
1010
}
1111
}

src/Axepta.SDK/Axepta.SDK.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<PackageId>Axepta.SDK</PackageId>
8-
<VersionPrefix>1.0.4</VersionPrefix>
9-
<VersionSuffix>alpha</VersionSuffix>
8+
<VersionPrefix>1.0.5</VersionPrefix>
109
<Authors>Maksymilian Szokalski</Authors>
1110
<Description>Axepta.SDK is a class library for BNP Paribas Axepta Paywall</Description>
1211
<PackageTags>BNP Paribas;Axepta;Paywall;Payments;Transactions</PackageTags>
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
namespace Axepta.SDK;
2+
3+
/// <summary>
4+
/// Represents a payment transaction, encapsulating details such as service ID, amount, currency,
5+
/// order information, customer details, and redirection URLs for successful, failed, or general outcomes.
6+
/// This record focuses on capturing essential information required to generate a payment link.
7+
/// </summary>
8+
public sealed record GeneratePaymentLink
9+
{
10+
private int _amount;
11+
12+
/// <summary>
13+
/// Gets or sets the service ID associated with the payment. This is a unique identifier for the service involved in the payment.
14+
/// </summary>
15+
[JsonPropertyName("serviceId")]
16+
public string? ServiceId { get; private set; }
17+
18+
/// <summary>
19+
/// Gets or sets the payment amount. The setter converts the input amount from a major currency unit (e.g., dollars) to a minor unit (e.g., cents).
20+
/// </summary>
21+
[JsonPropertyName("amount")]
22+
public required int Amount
23+
{
24+
get => _amount;
25+
set => _amount = value * 100;
26+
}
27+
28+
/// <summary>
29+
/// Gets or sets the currency code for the payment, following the ISO 4217 standard.
30+
/// </summary>
31+
[StringLength(3)]
32+
[JsonPropertyName("currency")]
33+
public required Currency Currency { get; init; }
34+
35+
/// <summary>
36+
/// Gets or sets the unique identifier for the payment order, which can be used for tracking and referencing the transaction.
37+
/// </summary>
38+
[StringLength(100)]
39+
[RegularExpression(AllowedCharactersPatterns.ADDITIONAL_ALLOWED_CHARACTERS_PATTERN)]
40+
[JsonPropertyName("orderId")]
41+
public required string OrderId { get; init; }
42+
43+
/// <summary>
44+
/// Gets or sets the URL to which the user is redirected after a successful payment. This URL is used for post-transaction navigation.
45+
/// </summary>
46+
[StringLength(300)]
47+
[Url]
48+
[JsonPropertyName("successReturnUrl")]
49+
public required string SuccessReturnUrl { get; init; }
50+
51+
/// <summary>
52+
/// Gets or sets the URL to which the user is redirected after a failed payment. This provides a means to handle unsuccessful transactions.
53+
/// </summary>
54+
[StringLength(300)]
55+
[Url]
56+
[JsonPropertyName("failureReturnUrl")]
57+
public required string FailureReturnUrl { get; init; }
58+
59+
/// <summary>
60+
/// Gets or sets a general return URL for the payment, used for redirecting the user after the transaction is processed, regardless of the outcome.
61+
/// </summary>
62+
[StringLength(300)]
63+
[Url]
64+
[JsonPropertyName("returnUrl")]
65+
public required string ReturnUrl { get; init; }
66+
67+
/// <summary>
68+
/// Gets or sets the customer's information, essential for processing the payment and for record-keeping purposes.
69+
/// </summary>
70+
[JsonPropertyName("customer")]
71+
public required Customer Customer { get; init; }
72+
73+
/// <summary>
74+
/// Gets or sets the title associated with the payment. This can be a description or label for the payment, and can be null.
75+
/// </summary>
76+
[StringLength(255)]
77+
[RegularExpression(AllowedCharactersPatterns.ADDITIONAL_ALLOWED_CHARACTERS_PATTERN)]
78+
[JsonPropertyName("title")]
79+
public string? Title { get; init; }
80+
81+
/// <summary>
82+
/// Gets or sets the expiration date and time of the transaction. If not specified, the transaction remains valid indefinitely.
83+
/// Transactions not completed by this timestamp will be automatically cancelled.
84+
/// </summary>
85+
[JsonPropertyName("activeTo")]
86+
public DateTime? ActiveTo { get; init; }
87+
88+
internal void SetServiceId(string serviceId)
89+
=> ServiceId = serviceId;
90+
}

src/Axepta.SDK/Entities/Response/ResponseRoot.cs renamed to src/Axepta.SDK/Entities/Response/AxeptaResponseRoot.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace Axepta.SDK;
22

3-
public sealed class ResponseRoot
3+
public sealed class AxeptaResponseRoot
44
{
55
[JsonPropertyName("status")]
66
public required string Status { get; set; }

src/Axepta.SDK/Entities/Response/Data.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ public sealed record Data
88
[JsonPropertyName("payment")]
99
public PaymentResponse? Payment { get; init; }
1010

11+
[JsonPropertyName("paymentLink")]
12+
public PaymentLink? PaymentLink { get; init; }
13+
1114
[JsonPropertyName("action")]
1215
public Action? Action { get; init; }
1316

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace Axepta.SDK;
2+
3+
public sealed record PaymentLink
4+
{
5+
[JsonPropertyName("paymentId")]
6+
public required string PaymentId { get; init; }
7+
8+
[JsonPropertyName("url")]
9+
public required string Url { get; init; }
10+
}

0 commit comments

Comments
 (0)