Skip to content

Commit

Permalink
Merge pull request #9 from dynamicweb/ssm/18342-fix_parameters
Browse files Browse the repository at this point in the history
Parameters - labels and values are mixed up
  • Loading branch information
StanislavSmetaninSSM authored Mar 6, 2024
2 parents 5a1cb8f + 1920ecb commit 25cb897
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<VersionPrefix>10.0.6</VersionPrefix>
<VersionPrefix>10.0.7</VersionPrefix>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<Title>QuickPay Payment Window</Title>
<Description>The QuickPay Payment Window checkout handler is designed to work with QuickPay v10.</Description>
Expand Down
55 changes: 29 additions & 26 deletions src/QuickPayPaymentWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,24 +305,24 @@ public override string StartCheckout(Order order, bool headless, string? receipt
else
{
var formValues = new Dictionary<string, string>
{
{"version", "v10"},
{"merchant_id", Merchant.Trim()},
{"agreement_id", Agreement.Trim()},
{"order_id", order.Id},
{"language", LanguageCode},
{"amount", order.Price.PricePIP.ToString()},
{"currency", order.Price.Currency.Code},
{"continueurl", receiptUrl ?? ContinueUrl(order, false)},
{"cancelurl", cancelUrl ?? CancelUrl(order)},
{"callbackurl", CallbackUrl(order, headless)},
{"autocapture", AutoCapture ? "1" : "0"},
{"autofee", AutoFee ? "1" : "0"},
{"payment_methods", PaymentMethods},
{"branding_id", Branding},
{"google_analytics_tracking_id", GoogleAnalyticsTracking},
{"google_analytics_client_id", GoogleAnalyticsClient}
};
{
{"version", "v10"},
{"merchant_id", Merchant.Trim()},
{"agreement_id", Agreement.Trim()},
{"order_id", order.Id},
{"language", LanguageCode},
{"amount", order.Price.PricePIP.ToString()},
{"currency", order.Price.Currency.Code},
{"continueurl", receiptUrl ?? ContinueUrl(order, false)},
{"cancelurl", cancelUrl ?? CancelUrl(order)},
{"callbackurl", CallbackUrl(order, headless)},
{"autocapture", AutoCapture ? "1" : "0"},
{"autofee", AutoFee ? "1" : "0"},
{"payment_methods", PaymentMethods},
{"branding_id", Branding},
{"google_analytics_tracking_id", GoogleAnalyticsTracking},
{"google_analytics_client_id", GoogleAnalyticsClient}
};

formValues.Add("checksum", ComputeHash(ApiKey, GetMacString(formValues)));

Expand Down Expand Up @@ -560,13 +560,14 @@ public IEnumerable<ParameterOption> GetParameterOptions(string parameterName)
switch (parameterName)
{
case "Post mode":
return new List<ParameterOption>(){
new("Auto", "Auto post (does not use the template)"){Hint = "do not use the template."},
new("Template", "Render template"){Hint = "this allows you to customize the information sent to QuickPay via the post template." },
new("Inline", "Render inline form")
};
return new List<ParameterOption>
{
new("Auto post (does not use the template)", "Auto") { Hint = "do not use the template." },
new("Render template", "Template") { Hint = "this allows you to customize the information sent to QuickPay via the post template." },
new("Render inline form", "Inline")
};
case "Card type":
return new List<ParameterOption>(GetCardTypes(false, true).Select(kv => new ParameterOption(kv.Key, kv.Value)));
return GetCardTypes(false, true).Select(pair => new ParameterOption(pair.Value, pair.Key)).ToList();

default:
throw new ArgumentException(string.Format("Unknown dropdown name: '{0}'", parameterName));
Expand Down Expand Up @@ -1422,7 +1423,8 @@ private OperationStatus GetLastOperationStatus(Order order, string operationType

private Dictionary<string, string> GetCardTypes(bool recurringOnly, bool translate)
{
var cardTypes = new Dictionary<string, string>{
var cardTypes = new Dictionary<string, string>
{
{"creditcard", "All card type payments"},
{"american-express", "American Express credit card"},
{"american-express-dk", "American Express (Danish card)"},
Expand Down Expand Up @@ -1456,7 +1458,8 @@ private Dictionary<string, string> GetCardTypes(bool recurringOnly, bool transla

if (!recurringOnly)
{
var acquirers = new Dictionary<string, string>{
var acquirers = new Dictionary<string, string>
{
{"apple-pay", "Apple pay"},
{"anyday-split", "ANYDAY Split"},
{"google-pay", "Google pay"},
Expand Down

0 comments on commit 25cb897

Please sign in to comment.