Skip to content

Commit

Permalink
Add the option to set a mandate id for the customer
Browse files Browse the repository at this point in the history
  • Loading branch information
Viincenttt committed Jun 30, 2024
1 parent 23aefda commit 899864f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ public class CreateSubscriptionModel {

[Required]
public required string Description { get; set; }

public string? MandateId { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,24 @@
<DataAnnotationsValidator />
<ValidationSummary />

<div class="form-group">
<label for="description">Description</label>
<InputText
id="description"
class="form-control"
@bind-Value="_model.Description">
</InputText>
</div>

<div class="form-group">
<label for="mandate-id">Mandate id</label>
<InputText
id="mandate-id"
class="form-control"
@bind-Value="_model.MandateId">
</InputText>
</div>

<div class="form-group">
<label for="amount">Amount</label>
<InputNumber
Expand Down Expand Up @@ -81,7 +99,7 @@
IntervalPeriod = IntervalPeriod.Days,
Times = 5,
IntervalAmount = 2,
Description = "A subscription created by the example application"
Description = "A subscription created by the example application",
};

private async Task OnSave() {
Expand All @@ -92,7 +110,8 @@
Amount = new Amount(_model.Currency, _model.Amount),
Interval = $"{_model.IntervalAmount} {_model.IntervalPeriod.ToString().ToLower()}",
Times = _model.Times,
Description = _model.Description
Description = _model.Description,
MandateId = _model.MandateId
});

NavigationManager.NavigateTo($"/customer/{CustomerId}/subscription/overview");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ else {
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Description</th>
<th scope="col">MandateId</th>
<th scope="col">Date created</th>
<th scope="col">Amount</th>
<th scope="col">Mode</th>
Expand All @@ -28,6 +30,8 @@ else {
@foreach (SubscriptionResponse subscription in _subscriptions.Items) {
<tr>
<td>@subscription.Id</td>
<td>@subscription.Description</td>
<td>@subscription.MandateId</td>
<td>@subscription.CreatedAt</td>
<td>@subscription.Amount.ToString()</td>
<td>@subscription.Mode</td>
Expand Down

0 comments on commit 899864f

Please sign in to comment.