Skip to content

Commit 21d23ad

Browse files
Update payment selection page to use new TryCalculateFee
1 parent 333febc commit 21d23ad

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/Umbraco.Commerce.Checkout/Views/UmbracoCommerceCheckout/UmbracoCommerceCheckoutPaymentMethodPage.cshtml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,17 @@
4242
@foreach (var item in paymentMethods.Where(x => zeroValuePaymentMethod == null || x.Alias != zeroValuePaymentMethod.Alias)
4343
.Select((pm, i) => new { PaymentMethod = pm, Index = i }))
4444
{
45-
<li class="border-gray-300 @(item.Index > 0 ? "border-t " : "")">
46-
<label class="flex items-center py-4 px-4 cursor-pointer hover:bg-gray-50">
47-
<input name="paymentMethod" type="radio" value="@item.PaymentMethod.Id" class="mr-3" @Html.Raw(currentPaymentMethodId.HasValue && currentPaymentMethodId.Value == item.PaymentMethod.Id ? "checked=\"checked\"" : "") required />
48-
<span class="font-medium">@(item.PaymentMethod.Name)</span>
49-
<span class="flex-1 text-right">@(item.PaymentMethod.CalculatePrice()?.Formatted())</span>
50-
</label>
51-
</li>
45+
var fee = item.PaymentMethod.TryCalculateFee(currentOrder);
46+
if (fee.Success)
47+
{
48+
<li class="border-gray-300 @(item.Index > 0 ? "border-t " : "")">
49+
<label class="flex items-center py-4 px-4 cursor-pointer hover:bg-gray-50">
50+
<input name="paymentMethod" type="radio" value="@item.PaymentMethod.Id" class="mr-3" @Html.Raw(currentPaymentMethodId.HasValue && currentPaymentMethodId.Value == item.PaymentMethod.Id ? "checked=\"checked\"" : "") required />
51+
<span class="font-medium">@(item.PaymentMethod.Name)</span>
52+
<span class="flex-1 text-right">@(fee.Result?.Formatted())</span>
53+
</label>
54+
</li>
55+
}
5256
}
5357
</ul>
5458
}

0 commit comments

Comments
 (0)