markdown fix
All checks were successful
Deploy / build-deploy (push) Successful in 2m23s

This commit is contained in:
Jorijn van der Graaf 2026-08-18 11:12:24 +02:00
commit 4666c1995f
14 changed files with 876 additions and 346 deletions

View file

@ -817,17 +817,21 @@ SafeHtml RenderCheckoutForm(const Product& product,
}
if (bestUnits <= 0 || bestUnits > Form::kMaxQuantity) bestUnits = Form::kMaxQuantity;
cc += R"(,"x":[)";
for (std::size_t i = 0; i < Money::NoSaleCountries().size(); ++i) {
if (i) cc += ',';
cc += JsonStr(Money::NoSaleCountries()[i]);
}
cc += std::format(R"(],"xm":{},"s":[)", JsonStr(Form::kNoSaleMessage));
// Sanctions (s/sm) then the shipping allow-list (w/rm). Note w is what the
// shop CAN ship to, so the preview refuses on absence — which is why this
// payload stays five codes long while most of the world is closed, instead
// of carrying a deny-list of two hundred.
cc += R"(,"s":[)";
for (std::size_t i = 0; i < Money::SanctionedCountries().size(); ++i) {
if (i) cc += ',';
cc += JsonStr(Money::SanctionedCountries()[i]);
}
cc += std::format(R"(],"sm":{}}})", JsonStr(Form::kSanctionsMessage));
cc += std::format(R"(],"sm":{},"w":[)", JsonStr(Form::kSanctionsMessage));
for (std::size_t i = 0; i < Money::ShippableCountries().size(); ++i) {
if (i) cc += ',';
cc += JsonStr(Money::ShippableCountries()[i]);
}
cc += std::format(R"(],"rm":{}}})", JsonStr(Form::kRegulatoryMessage));
const SafeHtml payFieldset =
offerCrypto ? RenderPayFieldset(prev, errorFor("pay")) : SafeHtml{};
@ -919,7 +923,7 @@ SafeHtml RenderCheckoutForm(const Product& product,
// the lede would only repeat half of them.
offerCrypto ? SafeHtml{}
: Raw(": iDEAL, card, or a plain bank transfer, handled by Mollie"),
Escape(Form::kNoSaleMessage),
Escape(Form::kShipsToMessage),
Escape(Form::kSanctionsMessage),
CustomsNote(),
formError,
@ -2146,11 +2150,14 @@ inline constexpr std::string_view kGeoPriceHintScript =
"var qty=qe?parseInt(qe.value,10)||1:1;"
"var k=(ke&&ke.value?ke.value:\"\").replace(/\\s/g,\"\").toUpperCase();"
"if(k.length!==2||!unit||qty<1||qty>d.q){if(out)out.hidden=true;return}"
// Refused destination — policy or sanctions: say so where the total would
// have been, instead of pricing an order the server will decline.
"if(d.x&&d.x.indexOf(k)>-1){if(out){out.textContent=d.xm;out.hidden=false}return}"
// Refused destination: say so where the total would have been, instead of
// pricing an order the server will decline. The same two gates as
// ValidateCheckout, in the same order, from the same sentences — sanctions
// first, then absence from the shipping list.
"var eu=ecc.indexOf(k)>-1;"
"if(d.s&&d.s.indexOf(k)>-1){if(out){out.textContent=d.sm;out.hidden=false}return}"
"var eu=ecc.indexOf(k)>-1,line=unit*qty;"
"if(d.w&&d.w.indexOf(k)<0){if(out){out.textContent=d.rm;out.hidden=false}return}"
"var line=unit*qty;"
"var goods=eu?line:Math.floor((line*10000+6050)/12100);"
// No ladder for this destination: there is no price, and saying so beats
// quoting a total the submit would then reject.