Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/4.1.3 #657

Merged
merged 5 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
queue_rules:
- name: default
conditions:
queue_conditions:
- author~=^dependabot(|-preview)\[bot\]$
merge_conditions:
# Conditions to get out of the queue (= merged)
- check-success=Run Unit and UI tests
- check-success=license/cla
merge_method: squash

pull_request_rules:
- name: Automatic approve on dependabot PR
Expand All @@ -13,17 +16,13 @@ pull_request_rules:
review:
type: APPROVE

- name: Automatic merge on approval
conditions:
- author~=^dependabot(|-preview)\[bot\]$
actions:
queue:
method: squash
name: default

- name: Thank contributor
conditions:
- merged
actions:
comment:
message: "Thank you @{{author}} for your contribution!"
message: "Thank you @{{author}} for your contribution!"
- name: Automatic merge on approval
conditions: []
actions:
queue:
2 changes: 1 addition & 1 deletion .github/workflows/test_deploy_samplesite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

steps:
- name: "Get information about the origin 'CI' run"
uses: potiuk/get-workflow-origin@v1_1
uses: potiuk/get-workflow-origin@v1_5
id: source-run-info
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
10 changes: 10 additions & 0 deletions src/Samples/Sample.AspNetCore/Controllers/CheckOutController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using System.Threading.Tasks;

using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
Expand All @@ -25,6 +26,7 @@ namespace Sample.AspNetCore.Controllers;
public class CheckOutController : Controller
{
private readonly Cart _cartService;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly ILogger<CheckOutController> _logger;
private readonly StoreDbContext _context;
private readonly PayeeInfoConfig _payeeInfoOptions;
Expand All @@ -36,6 +38,7 @@ public class CheckOutController : Controller
public CheckOutController(IOptionsSnapshot<PayeeInfoConfig> payeeInfoOptionsAccessor,
IOptionsSnapshot<UrlsOptions> urlsAccessor,
Cart cart,
IHttpContextAccessor httpContextAccessor,
ILogger<CheckOutController> logger,
StoreDbContext storeDbContext,
ISwedbankPayClient payClient,
Expand All @@ -44,6 +47,7 @@ public CheckOutController(IOptionsSnapshot<PayeeInfoConfig> payeeInfoOptionsAcce
_payeeInfoOptions = payeeInfoOptionsAccessor.Value;
_urls = urlsAccessor.Value;
_cartService = cart;
_httpContextAccessor = httpContextAccessor;
_logger = logger;
_context = storeDbContext;
_swedbankPayClient = payClient;
Expand Down Expand Up @@ -148,6 +152,11 @@ public async Task<IPaymentOrderResponse> CreatePaymentOrder(bool? generatePaymen
LogoUrl = _urls.LogoUrl,
CancelUrl = _urls.CancelUrl
};

if (_httpContextAccessor.HttpContext != null){
var httpContextRequest = _httpContextAccessor.HttpContext.Request;
urls.TermsOfServiceUrl = new Uri($"{httpContextRequest.Scheme}://{httpContextRequest.Host.Value}/terms", UriKind.Absolute);
}

var paymentOrderRequest = new PaymentOrderRequest(
generateRecurrenceToken.HasValue && generateRecurrenceToken.Value || generateUnscheduledToken.HasValue && generateUnscheduledToken.Value
Expand All @@ -162,6 +171,7 @@ public async Task<IPaymentOrderResponse> CreatePaymentOrder(bool? generatePaymen
{
PayeeId = _payeeInfoOptions.PayeeId,
OrderReference = $"PO-{DateTime.UtcNow.Ticks}",
ProductCategory = "A100",
Subsite = "TestSubsiteId",
SiteId = "TestSiteId"
})
Expand Down
11 changes: 11 additions & 0 deletions src/Samples/Sample.AspNetCore/Controllers/TermsController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Microsoft.AspNetCore.Mvc;

namespace Sample.AspNetCore.Controllers;

public class TermsController : Controller
{
public IActionResult Index()
{
return View();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
function onTermsOfServiceRequested(obj){
console.log("Terms of service requested event:");
console.log(obj)
window.open(obj.termsOfServiceUrl, '_blank');
}

function onEventNotification(obj){
Expand Down
13 changes: 13 additions & 0 deletions src/Samples/Sample.AspNetCore/Views/Terms/Index.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<h1>Terms of Payment</h1>

<p>By making a payment, you agree to the following terms and conditions:</p>

<ul>
<li>All payments are non-refundable unless otherwise stated.</li>
<li>Payments must be made in full before the delivery of any goods or services.</li>
<li>We accept the following payment methods: credit card, debit card, and PayPal.</li>
<li>Any disputes regarding payments must be reported within 30 days of the transaction date.</li>
<li>We reserve the right to change our payment terms at any time without prior notice.</li>
</ul>

<p>If you have any questions or concerns about our payment terms, please contact our support team.</p>
2 changes: 2 additions & 0 deletions src/SwedbankPay.Sdk.Infrastructure/PayeeInfoDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public PayeeInfoDto(PayeeInfo payeeInfo)
PayeeId = payeeInfo.PayeeId;
PayeeReference = payeeInfo.PayeeReference;
PayeeName = payeeInfo.PayeeName;
ProductCategory = payeeInfo.ProductCategory;
OrderReference = payeeInfo.OrderReference;
Subsite = payeeInfo.Subsite;
SiteId = payeeInfo.SiteId;
Expand All @@ -15,6 +16,7 @@ public PayeeInfoDto(PayeeInfo payeeInfo)
public string? PayeeId { get; init; }
public string PayeeReference { get; init; }
public string? PayeeName { get; init; }
public string? ProductCategory { get; init; }
public string? OrderReference { get; init; }
public string? Subsite { get; init; }
public string? SiteId { get; init; }
Expand Down
7 changes: 7 additions & 0 deletions src/SwedbankPay.Sdk/PayeeInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ public record PayeeInfo(string PayeeReference)
/// </summary>
public string? PayeeName { get; init; }

/// <summary>
/// A product category or number sent in from the payee/merchant. This is not validated by Swedbank Pay,
/// but will be passed through the payment process and may be used in the settlement process.
/// You therefore need to ensure that the value given here is valid in the settlement.
/// </summary>
public string? ProductCategory { get; init; }

/// <summary>
/// The order reference should reflect the order reference found in the merchant's systems.
/// </summary>
Expand Down
Loading