yumi 修复
This commit is contained in:
parent
7dbcec4a86
commit
4b5d26e0f1
@ -882,6 +882,11 @@ var default_api = 'https://api.global-interaction.com/';
|
|||||||
if (isYumiWebPay()) {
|
if (isYumiWebPay()) {
|
||||||
return mapYumiOptions(
|
return mapYumiOptions(
|
||||||
Object.assign({}, options, {
|
Object.assign({}, options, {
|
||||||
|
pay_country_id:
|
||||||
|
query.payCountryId ||
|
||||||
|
options.pay_country_id ||
|
||||||
|
options.payCountryId ||
|
||||||
|
'',
|
||||||
country_code:
|
country_code:
|
||||||
query.countryCode || options.country_code,
|
query.countryCode || options.country_code,
|
||||||
})
|
})
|
||||||
|
|||||||
@ -2266,19 +2266,32 @@
|
|||||||
function selectPayCountryFromConfig(context) {
|
function selectPayCountryFromConfig(context) {
|
||||||
var configured = selectedConfiguredPayCountry(context);
|
var configured = selectedConfiguredPayCountry(context);
|
||||||
if (configured) {
|
if (configured) {
|
||||||
|
var resolved = payCountryFromContext(
|
||||||
|
context,
|
||||||
|
configured.country_code || configured.countryCode
|
||||||
|
);
|
||||||
|
// app JSON 只控制国家和支付方式是否展示;后台 payCountryId 必须从账号 context 的国家映射里取,
|
||||||
|
// 否则 Yumi 这类旧下单接口会在商品已展示后因为 payCountryId 为空被参数校验拦截。
|
||||||
state.selectedPayCountryID =
|
state.selectedPayCountryID =
|
||||||
configured.pay_country_id ||
|
configured.pay_country_id ||
|
||||||
configured.payCountryId ||
|
configured.payCountryId ||
|
||||||
configured.id ||
|
configured.id ||
|
||||||
|
resolved.pay_country_id ||
|
||||||
|
resolved.payCountryId ||
|
||||||
|
resolved.id ||
|
||||||
'';
|
'';
|
||||||
state.selectedCountryCode = String(
|
state.selectedCountryCode = String(
|
||||||
configured.country_code ||
|
configured.country_code ||
|
||||||
configured.countryCode ||
|
configured.countryCode ||
|
||||||
|
resolved.country_code ||
|
||||||
|
resolved.countryCode ||
|
||||||
''
|
''
|
||||||
).toUpperCase();
|
).toUpperCase();
|
||||||
state.selectedCurrencyCode =
|
state.selectedCurrencyCode =
|
||||||
configured.currency_code ||
|
configured.currency_code ||
|
||||||
configured.currencyCode ||
|
configured.currencyCode ||
|
||||||
|
resolved.currency_code ||
|
||||||
|
resolved.currencyCode ||
|
||||||
state.selectedCurrencyCode ||
|
state.selectedCurrencyCode ||
|
||||||
'';
|
'';
|
||||||
return configured;
|
return configured;
|
||||||
@ -2351,6 +2364,36 @@
|
|||||||
: [];
|
: [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function payCountryFromContext(context, countryCode) {
|
||||||
|
var countries =
|
||||||
|
(context &&
|
||||||
|
(context.country_list || context.countryList)) ||
|
||||||
|
[];
|
||||||
|
var normalizedCountryCode = String(countryCode || '')
|
||||||
|
.trim()
|
||||||
|
.toUpperCase();
|
||||||
|
if (!normalizedCountryCode || !countries.length) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
countries.find(function (item) {
|
||||||
|
return (
|
||||||
|
String(
|
||||||
|
item.country_code ||
|
||||||
|
item.countryCode ||
|
||||||
|
firstValue(item.country || {}, [
|
||||||
|
'alphaTwo',
|
||||||
|
'alpha_two',
|
||||||
|
'countryCode',
|
||||||
|
'country_code',
|
||||||
|
]) ||
|
||||||
|
''
|
||||||
|
).toUpperCase() === normalizedCountryCode
|
||||||
|
);
|
||||||
|
}) || {}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function userCountryCodeFromContext(context) {
|
function userCountryCodeFromContext(context) {
|
||||||
context = context || {};
|
context = context || {};
|
||||||
var account = (context && context.account) || {};
|
var account = (context && context.account) || {};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user