Sumup phase 2 merged
This commit is contained in:
parent
88c7bdf760
commit
066c279a48
|
|
@ -8,15 +8,22 @@
|
||||||
|
|
||||||
<button @onclick="CreatePaymentLink">Create Payment Link</button>
|
<button @onclick="CreatePaymentLink">Create Payment Link</button>
|
||||||
|
|
||||||
|
<NavLink href="@checkoutUrl">Pay Now</NavLink>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
private string checkoutId;
|
||||||
|
private string checkoutUrl = "sumuppayment/3a278990-9eee-4310-9d02-da5c769847fe";
|
||||||
|
|
||||||
private async Task CreatePaymentLink()
|
private async Task CreatePaymentLink()
|
||||||
{
|
{
|
||||||
Transfer subject = new Transfer();
|
Transfer subject = new Transfer();
|
||||||
subject.Id = Guid.NewGuid();
|
subject.Id = Guid.NewGuid();
|
||||||
subject.Price = 17000;
|
subject.Price = 17000;
|
||||||
subject.ContactEmail = "fyloruta@citmo.net";
|
subject.ContactEmail = "fyloruta@citmo.net";
|
||||||
subject.OrderId = 1232131;
|
subject.OrderId = 1232132;
|
||||||
var paymentLink = await SumUpService.CreatePaymentLinkAsync(subject);
|
var paymentLink = await SumUpService.CreatePaymentLinkAsync(subject);
|
||||||
|
checkoutId = paymentLink;
|
||||||
|
checkoutUrl = "sumuppayment/" + checkoutId;
|
||||||
Console.WriteLine($"Payment Link: {paymentLink}");
|
Console.WriteLine($"Payment Link: {paymentLink}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
|
@ -89,14 +89,14 @@
|
||||||
case ("userprofile"):
|
case ("userprofile"):
|
||||||
//get profile for user
|
//get profile for user
|
||||||
UserModelDto resultData = (UserModelDto)AddressContext;
|
UserModelDto resultData = (UserModelDto)AddressContext;
|
||||||
if (resultData.UserDto.Profile.Address != null)
|
if (resultData.ProfileDto.Address != null)
|
||||||
_detailGridData.Add(resultData.UserDto.Profile.Address);
|
_detailGridData.Add(resultData.ProfileDto.Address);
|
||||||
break;
|
break;
|
||||||
case ("userdetailprofile"):
|
case ("userdetailprofile"):
|
||||||
//get profile for user
|
//get profile for user
|
||||||
UserModelDtoDetail resultData2 = (UserModelDtoDetail)AddressContext;
|
UserModelDtoDetail resultData2 = (UserModelDtoDetail)AddressContext;
|
||||||
if (resultData2.UserDto.Profile.Address != null)
|
if (resultData2.ProfileDto.Address != null)
|
||||||
_detailGridData.Add(resultData2.UserDto.Profile.Address);
|
_detailGridData.Add(resultData2.ProfileDto.Address);
|
||||||
break;
|
break;
|
||||||
case ("productprofile"):
|
case ("productprofile"):
|
||||||
//get profile for user
|
//get profile for user
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridCommandColumn NewButtonVisible="false" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
<DxGridCommandColumn NewButtonVisible="false" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="false" SortIndex="0" Visible="false" />
|
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="false" SortIndex="0" Visible="false" />
|
||||||
<DxGridDataColumn FieldName="Profile.FullName" />
|
<DxGridDataColumn FieldName="ProfileDto.FullName" />
|
||||||
<DxGridDataColumn FieldName="UserDto.PhoneNumber" />
|
<DxGridDataColumn FieldName="UserDto.PhoneNumber" />
|
||||||
<DxGridDataColumn FieldName="UserDto.Created" />
|
<DxGridDataColumn FieldName="UserDto.Created" />
|
||||||
<DxGridDataColumn FieldName="UserDto.EmailConfirmed" />
|
<DxGridDataColumn FieldName="UserDto.EmailConfirmed" />
|
||||||
|
|
@ -117,9 +117,6 @@
|
||||||
var transfer2 = (UserModelDtoDetail)EditFormContext.EditModel;
|
var transfer2 = (UserModelDtoDetail)EditFormContext.EditModel;
|
||||||
}
|
}
|
||||||
<DxFormLayout CssClass="w-100">
|
<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">
|
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.EmailAddress) ColSpanMd="4">
|
||||||
@EditFormContext.GetEditor("UserDto.EmailAddress")
|
@EditFormContext.GetEditor("UserDto.EmailAddress")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue