Sumup phase 2 merged

This commit is contained in:
Adam 2024-05-29 16:14:25 +02:00
parent 88c7bdf760
commit 066c279a48
4 changed files with 48 additions and 10 deletions

View File

@ -8,15 +8,22 @@
<button @onclick="CreatePaymentLink">Create Payment Link</button>
<NavLink href="@checkoutUrl">Pay Now</NavLink>
@code {
private string checkoutId;
private string checkoutUrl = "sumuppayment/3a278990-9eee-4310-9d02-da5c769847fe";
private async Task CreatePaymentLink()
{
Transfer subject = new Transfer();
subject.Id = Guid.NewGuid();
subject.Price = 17000;
subject.ContactEmail = "fyloruta@citmo.net";
subject.OrderId = 1232131;
subject.OrderId = 1232132;
var paymentLink = await SumUpService.CreatePaymentLinkAsync(subject);
checkoutId = paymentLink;
checkoutUrl = "sumuppayment/" + checkoutId;
Console.WriteLine($"Payment Link: {paymentLink}");
}
}

View File

@ -0,0 +1,34 @@
@page "/sumuppayment/{checkoutId}"
@inject IJSRuntime JSRuntime
@code {
[Parameter]
public string checkoutId { get; set; } = "";
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await JSRuntime.InvokeVoidAsync("loadSumUpPaymentWidget", checkoutId);
}
}
}
<div id="sumup-card"></div>
<script>
window.loadSumUpPaymentWidget = function (checkoutId) {
const script = document.createElement('script');
script.src = 'https://gateway.sumup.com/gateway/ecom/card/v2/sdk.js';
script.onload = () => {
SumUpCard.mount({
id: 'sumup-card',
checkoutId: checkoutId,
onResponse: function (type, body) {
console.log('Type', type);
console.log('Body', body);
}
});
};
document.head.appendChild(script);
};
</script>

View File

@ -89,14 +89,14 @@
case ("userprofile"):
//get profile for user
UserModelDto resultData = (UserModelDto)AddressContext;
if (resultData.UserDto.Profile.Address != null)
_detailGridData.Add(resultData.UserDto.Profile.Address);
if (resultData.ProfileDto.Address != null)
_detailGridData.Add(resultData.ProfileDto.Address);
break;
case ("userdetailprofile"):
//get profile for user
UserModelDtoDetail resultData2 = (UserModelDtoDetail)AddressContext;
if (resultData2.UserDto.Profile.Address != null)
_detailGridData.Add(resultData2.UserDto.Profile.Address);
if (resultData2.ProfileDto.Address != null)
_detailGridData.Add(resultData2.ProfileDto.Address);
break;
case ("productprofile"):
//get profile for user

View File

@ -89,7 +89,7 @@
<Columns>
<DxGridCommandColumn NewButtonVisible="false" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="false" SortIndex="0" Visible="false" />
<DxGridDataColumn FieldName="Profile.FullName" />
<DxGridDataColumn FieldName="ProfileDto.FullName" />
<DxGridDataColumn FieldName="UserDto.PhoneNumber" />
<DxGridDataColumn FieldName="UserDto.Created" />
<DxGridDataColumn FieldName="UserDto.EmailConfirmed" />
@ -119,10 +119,7 @@
<DxFormLayout CssClass="w-100">
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.EmailAddress) ColSpanMd="4">
@EditFormContext.GetEditor("UserDto.EmailAddress")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.EmailAddress) ColSpanMd="4">
@EditFormContext.GetEditor("UserDto.EmailAddress")
</DxFormLayoutItem>
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ConfirmEmail) ColSpanMd="4">
@EditFormContext.GetEditor("UserDto.EmailConfirmed")
</DxFormLayoutItem>