Skip to content

Commit

Permalink
Fix trim of order number based on order number template (#3)
Browse files Browse the repository at this point in the history
* Fix reference when order number template ends with or contains {0}
  • Loading branch information
bjarnef authored and umbracotrd committed Mar 12, 2024
1 parent 97fe979 commit 1a9ce10
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ private async Task<TResult> RequestAsync<TResult>(string url, Func<IFlurlRequest
{
throw;
}
catch (Exception ex)
{
throw;
}

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ public override async Task<PaymentFormResult> GenerateFormAsync(PaymentProviderC
else if (orderNumberTemplate.EndsWith("{0}"))
{
// Trim prefix
reference = reference.Substring(prefix.Length - 1);
reference = reference.Substring(prefix.Length);
}
else if (orderNumberTemplate.Contains("{0}"))
{
// Trim prefix & suffix
reference = reference.Substring(prefix.Length - 1, reference.Length - suffix.Length);
reference = reference.Substring(prefix.Length, reference.Length - prefix.Length - suffix.Length);
}
}
}
Expand Down

0 comments on commit 1a9ce10

Please sign in to comment.