Skip to content

Commit

Permalink
feat: Add AnalogAppRedirectUri to MobilePaySettingsV2 (#179)
Browse files Browse the repository at this point in the history
The AnalogAppRedirectUri is different depending on which environment the server is in
  • Loading branch information
marfavi authored Jun 7, 2023
1 parent b0fdea6 commit 22271a7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public class MobilePaySettingsV2 : IValidatable
[Required]
public string WebhookUrl { get; set; }

[Required]
public string AnalogAppRedirectUri { get; set; }

public void Validate()
{
Validator.ValidateObject(this, new ValidationContext(this), true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ namespace CoffeeCard.MobilePay.Service.v2
{
public class MobilePayPaymentsService : IMobilePayPaymentsService
{
private const string CoffeeCardAppRedirectUrl = "analogcoffeecard://mobilepay_purchase";

private readonly MobilePaySettingsV2 _mobilePaySettings;
private readonly PaymentsApi _paymentsApi;

Expand All @@ -31,7 +29,7 @@ public async Task<MobilePayPaymentDetails> InitiatePayment(MobilePayPaymentReque
Amount = ConvertAmountToOrer(paymentRequest.Amount),
IdempotencyKey = paymentRequest.OrderId,
PaymentPointId = _mobilePaySettings.PaymentPointId,
RedirectUri = CoffeeCardAppRedirectUrl,
RedirectUri = _mobilePaySettings.AnalogAppRedirectUri,
Reference = paymentRequest.OrderId.ToString(),
Description = paymentRequest.Description
}, null);
Expand Down
3 changes: 2 additions & 1 deletion coffeecard/CoffeeCard.WebApi/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"ApiUrl": "https://invalidurl.test/",
"ApiKey": "DummyKey",
"PaymentPointId": "00000000-0000-0000-0000-000000000000",
"WebhookUrl": "https://invalidurl.test/"
"WebhookUrl": "https://invalidurl.test/",
"AnalogAppRedirectUri": "analogcoffeecard-dev://mobilepay_purchase"
},
"LoginLimiterSettings": {
"IsEnabled": true,
Expand Down
4 changes: 4 additions & 0 deletions infrastructure/dev.settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
"name": "MailgunSettings__EmailBaseUrl",
"value": "https://core.dev.analogio.dk"
},
{
"name": "MobilePaySettingsV2__AnalogAppRedirectUri",
"value": "analogcoffeecard-dev://mobilepay_purchase"
},
{
"name": "MobilePaySettingsV2__ApiUrl",
"value": "https://api.sandbox.mobilepay.dk/"
Expand Down
4 changes: 4 additions & 0 deletions infrastructure/prd.settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
"name": "MailgunSettings__EmailBaseUrl",
"value": "https://core.prd.analogio.dk"
},
{
"name": "MobilePaySettingsV2__AnalogAppRedirectUri",
"value": "analogcoffeecard://mobilepay_purchase"
},
{
"name": "MobilePaySettingsV2__ApiUrl",
"value": "https://api.mobilepay.dk/"
Expand Down

0 comments on commit 22271a7

Please sign in to comment.