@alipay/ams-checkout 0.0.1745808793-dev.1 → 0.0.1745808793-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/umd/ams-checkout.min.js +1 -1
- package/esm/component/channel.d.ts +3 -1
- package/esm/component/channel.js +24 -42
- package/esm/config/index.d.ts +7 -7
- package/esm/config/index.js +7 -7
- package/esm/constant/easysafepay.d.ts +16 -0
- package/esm/constant/easysafepay.js +19 -0
- package/esm/constant/index.d.ts +1 -0
- package/esm/constant/index.js +1 -0
- package/esm/core/component/element/elementContainerService/containerService.js +2 -2
- package/esm/core/component/element/elementController/index.js +15 -9
- package/esm/core/component/element/elementProcessor/baseElementProcessor.d.ts +3 -0
- package/esm/core/component/element/elementProcessor/baseElementProcessor.js +11 -0
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +15 -8
- package/esm/core/component/element/index.js +6 -1
- package/esm/core/component/element/util.d.ts +6 -0
- package/esm/core/component/element/util.js +27 -0
- package/esm/core/instance/index.d.ts +1 -1
- package/esm/foundation/core/index.d.ts +3 -0
- package/esm/foundation/core/index.js +33 -4
- package/esm/foundation/index.d.ts +6 -0
- package/esm/foundation/product-processor/easysafepay/deps.d.ts +1 -1
- package/esm/foundation/product-processor/easysafepay/index.d.ts +2 -0
- package/esm/foundation/product-processor/easysafepay/index.js +219 -113
- package/esm/foundation/service/container/index.d.ts +1 -0
- package/esm/foundation/service/container/index.js +20 -2
- package/esm/foundation/utils/web_app_url_utils.d.ts +30 -5
- package/esm/foundation/utils/web_app_url_utils.js +127 -42
- package/esm/plugin/component/channel.d.ts +3 -1
- package/esm/plugin/component/channel.js +10 -12
- package/esm/plugin/component/index.js +45 -42
- package/esm/plugin/type.d.ts +1 -1
- package/esm/types/index.d.ts +17 -0
- package/esm/types/index.js +6 -0
- package/package.json +3 -2
@@ -11,7 +11,7 @@ import { isEmpty } from "../../../util";
|
|
11
11
|
import { addInlineLoading, createInlineBaseElement } from "../../../component/component.inline.style";
|
12
12
|
import { addPopupLoading, createBaseElement } from "../../../component/component.popup.style";
|
13
13
|
import { insertStyleSheet } from "../../../component/popupWindow.style";
|
14
|
-
import { COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CLOSE_MASK_BLOCK_ID, COMPONENT_CONTAINER_ID, ERRORMESSAGE, EVENT, LOADING_ID, MOCKUP_ID, TIMEOUT_WEB_APP_HEART_BEAT, TIME_DELAY_SEND_HEART_BEAT } from "../../../constant";
|
14
|
+
import { COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CLOSE_MASK_BLOCK_ID, COMPONENT_CONTAINER_ID, ERRORMESSAGE, EVENT, LOADING_ID, MOCKUP_ID, TIMEOUT_WEB_APP_HEART_BEAT, TIME_DELAY_SEND_HEART_BEAT, closeImg, closeImgLight } from "../../../constant";
|
15
15
|
import { DisplayTypeEnum, ProductSceneEnum } from "../../../types";
|
16
16
|
import { ServiceProvider } from "../index";
|
17
17
|
import { PopupManager } from "./popup";
|
@@ -194,7 +194,8 @@ export var ContainerService = /*#__PURE__*/function () {
|
|
194
194
|
this.eventCenter.listen(EVENT.sizeChanged.name, function (data) {
|
195
195
|
_this.handleSizeChanged(_objectSpread({}, data));
|
196
196
|
});
|
197
|
-
this.eventCenter.listen(EVENT.showCloseButton.name, function () {
|
197
|
+
this.eventCenter.listen(EVENT.showCloseButton.name, function (data) {
|
198
|
+
_this.handleCloseButtonTheme(data.theme);
|
198
199
|
_this.changeCloseBtnVisibility(true);
|
199
200
|
});
|
200
201
|
this.eventCenter.listen(EVENT.hideCloseButton.name, function () {
|
@@ -323,6 +324,23 @@ export var ContainerService = /*#__PURE__*/function () {
|
|
323
324
|
closeBlock === null || closeBlock === void 0 || closeBlock.classList.add("".concat(COMPONENT_CLOSE_MASK_BLOCK_ID, "-hidden"));
|
324
325
|
}
|
325
326
|
}
|
327
|
+
}, {
|
328
|
+
key: "handleCloseButtonTheme",
|
329
|
+
value: function handleCloseButtonTheme(theme) {
|
330
|
+
if (!theme) return;
|
331
|
+
var closeBlock = document.getElementById(COMPONENT_CLOSE_BLOCK_ID);
|
332
|
+
var closeButtonImg = closeBlock === null || closeBlock === void 0 ? void 0 : closeBlock.querySelector('img');
|
333
|
+
var maskCloseBlock = document.getElementById(COMPONENT_CLOSE_MASK_BLOCK_ID);
|
334
|
+
if (theme === 'light') {
|
335
|
+
closeButtonImg === null || closeButtonImg === void 0 || closeButtonImg.setAttribute('src', closeImgLight);
|
336
|
+
closeBlock === null || closeBlock === void 0 || closeBlock.classList.add("".concat(COMPONENT_CLOSE_BLOCK_ID, "-light"));
|
337
|
+
maskCloseBlock === null || maskCloseBlock === void 0 || maskCloseBlock.classList.add("".concat(COMPONENT_CLOSE_MASK_BLOCK_ID, "-light"));
|
338
|
+
} else {
|
339
|
+
closeButtonImg === null || closeButtonImg === void 0 || closeButtonImg.setAttribute('src', closeImg);
|
340
|
+
closeBlock === null || closeBlock === void 0 || closeBlock.classList.remove("".concat(COMPONENT_CLOSE_BLOCK_ID, "-light"));
|
341
|
+
maskCloseBlock === null || maskCloseBlock === void 0 || maskCloseBlock.classList.remove("".concat(COMPONENT_CLOSE_MASK_BLOCK_ID, "-light"));
|
342
|
+
}
|
343
|
+
}
|
326
344
|
}, {
|
327
345
|
key: "getWebApp",
|
328
346
|
value: function getWebApp() {
|
@@ -1,5 +1,6 @@
|
|
1
|
-
import { DisplayTypeEnum, PaymentMethodCategoryTypeEnum, ProductSceneEnum } from '../../types';
|
1
|
+
import { DisplayTypeEnum, PaymentMethodCategoryTypeEnum, ProductSceneEnum, IPaymentSessionMetaData } from '../../types';
|
2
2
|
import { SDKMetaData } from '../index';
|
3
|
+
import { ESP_PAGE_NAME } from "../../constant/easysafepay";
|
3
4
|
/**
|
4
5
|
* Tell the SDK which version of the Web App to load.
|
5
6
|
* Sent by server inside paymentSession.
|
@@ -21,9 +22,10 @@ export interface WebAppMatchConfig {
|
|
21
22
|
* Sent by server inside paymentSession.
|
22
23
|
*/
|
23
24
|
export interface WebAppUrlMatchConfig {
|
24
|
-
|
25
|
+
minSDKVersion: string;
|
25
26
|
url: string;
|
26
|
-
|
27
|
+
doubleFa: string;
|
28
|
+
mids?: string[];
|
27
29
|
}
|
28
30
|
export interface QueryParams {
|
29
31
|
displayType: DisplayTypeEnum;
|
@@ -75,17 +77,40 @@ export declare const parseWebAppUrlMatchConfig: (extendInfo: string) => WebAppUr
|
|
75
77
|
* @param productScene - The product scene for which the checkout URL should be saved.
|
76
78
|
*/
|
77
79
|
export declare const saveLocalCheckoutUrl: (productScene: ProductSceneEnum, url: string) => void;
|
80
|
+
/**
|
81
|
+
* 获取从外部动态下发的V2AppUrl.
|
82
|
+
*
|
83
|
+
* @param config - sessionData解析来的checkoutInfo列表.
|
84
|
+
*/
|
85
|
+
export declare const getMatchedWebAppV2Url: (productScene: ProductSceneEnum, mid: string, configs: WebAppUrlMatchConfig[], env: string) => string;
|
86
|
+
/**
|
87
|
+
* 获取ESP从sessionData.checkoutInfo内动态下发的Url.
|
88
|
+
*/
|
89
|
+
export declare const matchEasySafePayV2Url: (params: {
|
90
|
+
configs: WebAppUrlMatchConfig[];
|
91
|
+
mid: string;
|
92
|
+
env: string;
|
93
|
+
pageName: ESP_PAGE_NAME;
|
94
|
+
}) => string;
|
78
95
|
/**
|
79
96
|
* Retrieve the saved checkout URL from localStorage for the specified product scene.
|
80
97
|
* If no url is found, a default checkout url string is returned.
|
81
98
|
*
|
82
99
|
* @param productScene - The product scene for which the checkout URL should be retrieved.
|
83
100
|
*/
|
84
|
-
export declare const getLocalCheckoutUrl: (productScene: ProductSceneEnum) => string;
|
101
|
+
export declare const getLocalCheckoutUrl: (productScene: ProductSceneEnum, environment: string) => string;
|
85
102
|
/**
|
86
103
|
* Provide default checkout URL for the specified product scene.
|
87
104
|
* Return URL for 'EASY_PAY' product scene, while for other product scenes, it returns an empty string as they are not currently in use
|
88
105
|
*
|
89
106
|
* @param productScene - The product scene for which the default checkout URL should be provided.
|
90
107
|
*/
|
91
|
-
export declare const defaultCheckoutUrl: (productScene: ProductSceneEnum) => string;
|
108
|
+
export declare const defaultCheckoutUrl: (productScene: ProductSceneEnum, environment?: string) => string;
|
109
|
+
/**
|
110
|
+
* V2应用EasySafePay 热更新兜底URL构建规则
|
111
|
+
* 1. 兜底URL版本与sdk版本保持一致
|
112
|
+
* 2. DEV环境下html新增版本前缀
|
113
|
+
**/
|
114
|
+
export declare const getDefaultEasySafePayPageUrl: (pageName: ESP_PAGE_NAME, env: string) => string;
|
115
|
+
/**通过sessionData获取doubleFa,于createComponent时传递给WEB应用*/
|
116
|
+
export declare const getDoubleFaUrlFromSession: (paymentSessionObj: IPaymentSessionMetaData, env?: string) => string;
|
@@ -5,10 +5,11 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
7
7
|
import { ComponentSignEnum, ProductSceneEnum } from "../../types";
|
8
|
-
import { marmotMap, v2AppMarmotMap } from "../../config";
|
8
|
+
import { marmotMap, v2AppMarmotMap, sdkVersion } from "../../config";
|
9
9
|
import { queryParse, serialize } from "../../util";
|
10
|
+
import { compareVersion } from "../../util/versionCompare";
|
10
11
|
import { isDebugLog } from "../../util/debug";
|
11
|
-
|
12
|
+
import { ESP_PAGE_NAME } from "../../constant/easysafepay";
|
12
13
|
/**
|
13
14
|
* Tell the SDK which version of the Web App to load.
|
14
15
|
* Sent by server inside paymentSession.
|
@@ -70,9 +71,10 @@ export var getWebAppV2Url = function getWebAppV2Url(params) {
|
|
70
71
|
var productScene = params.productScene,
|
71
72
|
isPreload = params.isPreload,
|
72
73
|
mid = params.mid,
|
73
|
-
extendInfo = params.extendInfo
|
74
|
+
extendInfo = params.extendInfo,
|
75
|
+
environment = params.environment;
|
74
76
|
var webAppUrlMatchConfig = parseWebAppUrlMatchConfig(extendInfo);
|
75
|
-
var v2Url = isPreload ? getLocalCheckoutUrl(productScene) : getMatchedWebAppV2Url(productScene, mid, webAppUrlMatchConfig);
|
77
|
+
var v2Url = isPreload ? getLocalCheckoutUrl(productScene, environment) : getMatchedWebAppV2Url(productScene, mid, webAppUrlMatchConfig, environment);
|
76
78
|
var info = getWebAppUrlInfo(_objectSpread(_objectSpread({}, params), {}, {
|
77
79
|
v2Url: v2Url
|
78
80
|
}));
|
@@ -117,7 +119,7 @@ var getAppPath = function getAppPath() {
|
|
117
119
|
var webAppVersion = sdkMetaData.webAppVersion;
|
118
120
|
switch (productScene) {
|
119
121
|
case ProductSceneEnum.EASY_PAY:
|
120
|
-
return v2Url !== null && v2Url !== void 0 ? v2Url : defaultCheckoutUrl(productScene);
|
122
|
+
return v2Url !== null && v2Url !== void 0 ? v2Url : defaultCheckoutUrl(productScene, environment);
|
121
123
|
default:
|
122
124
|
return "".concat(marmotMap[environment], "/").concat(productSceneWithPaymentMethodCategoryType, "/").concat(validProductSceneVersion, "/index.").concat(webAppVersion, ".html");
|
123
125
|
}
|
@@ -165,7 +167,7 @@ var KEY_CHECKOUT_URL = "web_url_";
|
|
165
167
|
|
166
168
|
/**
|
167
169
|
* Save the current checkout URL to localStorage for the specified product scene.
|
168
|
-
*
|
170
|
+
*
|
169
171
|
* @param productScene - The product scene for which the checkout URL should be saved.
|
170
172
|
*/
|
171
173
|
export var saveLocalCheckoutUrl = function saveLocalCheckoutUrl(productScene, url) {
|
@@ -173,62 +175,145 @@ export var saveLocalCheckoutUrl = function saveLocalCheckoutUrl(productScene, ur
|
|
173
175
|
localStorage.setItem(key, url);
|
174
176
|
};
|
175
177
|
|
178
|
+
/**
|
179
|
+
* 获取从外部动态下发的V2AppUrl.
|
180
|
+
*
|
181
|
+
* @param config - sessionData解析来的checkoutInfo列表.
|
182
|
+
*/
|
183
|
+
export var getMatchedWebAppV2Url = function getMatchedWebAppV2Url(productScene) {
|
184
|
+
var mid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
185
|
+
var configs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
186
|
+
var env = arguments.length > 3 ? arguments[3] : undefined;
|
187
|
+
switch (productScene) {
|
188
|
+
case ProductSceneEnum.EASY_PAY:
|
189
|
+
return matchEasySafePayV2Url({
|
190
|
+
configs: configs,
|
191
|
+
mid: mid,
|
192
|
+
env: env,
|
193
|
+
pageName: ESP_PAGE_NAME.SDK_PORTAL
|
194
|
+
});
|
195
|
+
default:
|
196
|
+
return defaultCheckoutUrl(productScene, env);
|
197
|
+
}
|
198
|
+
};
|
199
|
+
|
200
|
+
/**
|
201
|
+
* 获取ESP从sessionData.checkoutInfo内动态下发的Url.
|
202
|
+
*/
|
203
|
+
export var matchEasySafePayV2Url = function matchEasySafePayV2Url(params) {
|
204
|
+
var _params$configs = params.configs,
|
205
|
+
configs = _params$configs === void 0 ? [] : _params$configs,
|
206
|
+
_params$mid = params.mid,
|
207
|
+
mid = _params$mid === void 0 ? '' : _params$mid,
|
208
|
+
env = params.env,
|
209
|
+
pageName = params.pageName;
|
210
|
+
var matchURLByMid = function matchURLByMid() {
|
211
|
+
var sortedConfigs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
212
|
+
var targetConfigEntry = sortedConfigs.find(function (configEntry) {
|
213
|
+
var _configEntry$mids;
|
214
|
+
var isMatchMid = !!(configEntry !== null && configEntry !== void 0 && (_configEntry$mids = configEntry.mids) !== null && _configEntry$mids !== void 0 && _configEntry$mids.includes(mid));
|
215
|
+
var isMatchVersion = compareVersion(sdkVersion, configEntry.minSDKVersion) >= 0;
|
216
|
+
if (isMatchMid && isMatchVersion) {
|
217
|
+
return configEntry;
|
218
|
+
}
|
219
|
+
});
|
220
|
+
return targetConfigEntry;
|
221
|
+
};
|
222
|
+
var matchURLBySDKVersion = function matchURLBySDKVersion() {
|
223
|
+
var sortedConfigs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
224
|
+
var targetConfigEntry = sortedConfigs.find(function (configEntry) {
|
225
|
+
var isCommonConfig = (configEntry === null || configEntry === void 0 ? void 0 : configEntry.mids) === undefined;
|
226
|
+
var isMatchVersion = compareVersion(sdkVersion, configEntry.minSDKVersion) >= 0;
|
227
|
+
if (isCommonConfig && isMatchVersion) {
|
228
|
+
return configEntry;
|
229
|
+
}
|
230
|
+
});
|
231
|
+
return targetConfigEntry;
|
232
|
+
};
|
233
|
+
var matchConfig = function matchConfig() {
|
234
|
+
// 按SDK版本降排序
|
235
|
+
var sortedConfig = configs.sort(function (a, b) {
|
236
|
+
return compareVersion(b.minSDKVersion, a.minSDKVersion);
|
237
|
+
});
|
238
|
+
|
239
|
+
// 匹配仅针对部分商户生效(mid),且符合版本号的URL
|
240
|
+
var matchedURLByMid = matchURLByMid(sortedConfig);
|
241
|
+
if (matchedURLByMid) return matchedURLByMid;
|
242
|
+
|
243
|
+
// 匹配对所有商户生效(无mid),且符合版本号的URL
|
244
|
+
var matchedURLBySDKVersion = matchURLBySDKVersion(sortedConfig);
|
245
|
+
if (matchedURLBySDKVersion) return matchedURLBySDKVersion;
|
246
|
+
};
|
247
|
+
var defaultEspUrl = getDefaultEasySafePayPageUrl(pageName, env);
|
248
|
+
|
249
|
+
// 匹配config
|
250
|
+
var config = matchConfig();
|
251
|
+
if (!config) return defaultEspUrl;
|
252
|
+
|
253
|
+
// 根据pageName匹配URL
|
254
|
+
if (pageName == ESP_PAGE_NAME.SDK_PORTAL) return (config === null || config === void 0 ? void 0 : config.url) || defaultEspUrl;
|
255
|
+
if (pageName == ESP_PAGE_NAME.DOUBLE_FA) return (config === null || config === void 0 ? void 0 : config.doubleFa) || defaultEspUrl;
|
256
|
+
return defaultEspUrl;
|
257
|
+
};
|
258
|
+
|
176
259
|
/**
|
177
260
|
* Retrieve the saved checkout URL from localStorage for the specified product scene.
|
178
261
|
* If no url is found, a default checkout url string is returned.
|
179
|
-
*
|
262
|
+
*
|
180
263
|
* @param productScene - The product scene for which the checkout URL should be retrieved.
|
181
264
|
*/
|
182
|
-
export var getLocalCheckoutUrl = function getLocalCheckoutUrl(productScene) {
|
265
|
+
export var getLocalCheckoutUrl = function getLocalCheckoutUrl(productScene, environment) {
|
183
266
|
var key = KEY_CHECKOUT_URL + productScene;
|
184
267
|
var previousCheckoutUrl = localStorage.getItem(key);
|
185
|
-
return previousCheckoutUrl !== null && previousCheckoutUrl !== void 0 ? previousCheckoutUrl : defaultCheckoutUrl(productScene);
|
268
|
+
return previousCheckoutUrl !== null && previousCheckoutUrl !== void 0 ? previousCheckoutUrl : defaultCheckoutUrl(productScene, environment);
|
186
269
|
};
|
187
270
|
|
188
271
|
/**
|
189
272
|
* Provide default checkout URL for the specified product scene.
|
190
273
|
* Return URL for 'EASY_PAY' product scene, while for other product scenes, it returns an empty string as they are not currently in use
|
191
|
-
*
|
274
|
+
*
|
192
275
|
* @param productScene - The product scene for which the default checkout URL should be provided.
|
193
276
|
*/
|
194
277
|
export var defaultCheckoutUrl = function defaultCheckoutUrl(productScene) {
|
195
|
-
var
|
278
|
+
var environment = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "prod";
|
196
279
|
switch (productScene) {
|
197
280
|
case ProductSceneEnum.EASY_PAY:
|
198
|
-
return
|
281
|
+
return getDefaultEasySafePayPageUrl(ESP_PAGE_NAME.SDK_PORTAL, environment);
|
199
282
|
default:
|
200
283
|
return '';
|
201
284
|
}
|
202
285
|
};
|
203
|
-
var getMatchedWebAppV2Url = function getMatchedWebAppV2Url(productScene) {
|
204
|
-
var mid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
205
|
-
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
206
|
-
if (config.length === 0) {
|
207
|
-
// Default checkout url
|
208
|
-
return defaultCheckoutUrl(productScene);
|
209
|
-
}
|
210
|
-
var sortedConfig = config.sort(function (a, b) {
|
211
|
-
return parseFloat(b.version) - parseFloat(a.version);
|
212
|
-
});
|
213
|
-
var targetConfigEntry = sortedConfig.find(function (configEntry) {
|
214
|
-
var _configEntry$mid;
|
215
|
-
var isMatchMid = (_configEntry$mid = configEntry.mid) !== null && _configEntry$mid !== void 0 && _configEntry$mid.trim() ? configEntry.mid.toUpperCase().includes(mid === null || mid === void 0 ? void 0 : mid.toUpperCase()) : true;
|
216
|
-
if (isMatchMid) {
|
217
|
-
return configEntry;
|
218
|
-
}
|
219
|
-
});
|
220
|
-
if (targetConfigEntry) {
|
221
|
-
// Match merchant ID
|
222
|
-
return targetConfigEntry === null || targetConfigEntry === void 0 ? void 0 : targetConfigEntry.url;
|
223
|
-
}
|
224
|
-
var sortedAllMerchantsConfig = sortedConfig.find(function (configEntry) {
|
225
|
-
return configEntry.mid === undefined || configEntry.mid === '';
|
226
|
-
});
|
227
|
-
if (sortedAllMerchantsConfig) {
|
228
|
-
// Match highest version without merchant ID
|
229
|
-
return sortedAllMerchantsConfig === null || sortedAllMerchantsConfig === void 0 ? void 0 : sortedAllMerchantsConfig.url;
|
230
|
-
}
|
231
286
|
|
232
|
-
|
233
|
-
|
287
|
+
/**
|
288
|
+
* V2应用EasySafePay 热更新兜底URL构建规则
|
289
|
+
* 1. 兜底URL版本与sdk版本保持一致
|
290
|
+
* 2. DEV环境下html新增版本前缀
|
291
|
+
**/
|
292
|
+
export var getDefaultEasySafePayPageUrl = function getDefaultEasySafePayPageUrl(pageName, env) {
|
293
|
+
// 生成的URL EXAMPLE:
|
294
|
+
// const DEFAULT_DOUBLE_FA_URL_MAPPING = {
|
295
|
+
// local: 'http://page.alipay.net/page/antom-web-checkout-v2/easysafepay/1.36.0/pages/double-fa/index-1.36.0.html',
|
296
|
+
// dev: 'http://page.alipay.net/page/antom-web-checkout-v2/easysafepay/1.36.0/pages/double-fa/index-1.36.0.html',
|
297
|
+
// sit: 'http://page.test.alipay.net/page/antom-web-checkout-v2/easysafepay/1.36.0/pages/double-fa/index.html',
|
298
|
+
// pre: 'https://pre.ac.alipay.com/page/antom-web-checkout-v2/easysafepay/1.36.0/pages/double-fa/index.html',
|
299
|
+
// prod: 'https://checkout.antom.com/easysafepay/1.36.0/pages/double-fa/index.html',
|
300
|
+
// };
|
301
|
+
var environment = env || "prod";
|
302
|
+
if (environment === "dev") return "".concat(v2AppMarmotMap[environment], "/easysafepay/").concat(sdkVersion, "/pages/").concat(pageName, "/index-").concat(sdkVersion, ".html");else return "".concat(v2AppMarmotMap[environment], "/easysafepay/").concat(sdkVersion, "/pages/").concat(pageName, "/index.html");
|
303
|
+
};
|
304
|
+
|
305
|
+
/**通过sessionData获取doubleFa,于createComponent时传递给WEB应用*/
|
306
|
+
//TODO 后续需要构造一个类,专门用于构造&存储web应用url
|
307
|
+
export var getDoubleFaUrlFromSession = function getDoubleFaUrlFromSession(paymentSessionObj) {
|
308
|
+
var env = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "prod";
|
309
|
+
var mid = paymentSessionObj.clientId;
|
310
|
+
var extendInfo = paymentSessionObj.extendInfo;
|
311
|
+
var configs = parseWebAppUrlMatchConfig(extendInfo);
|
312
|
+
var url = matchEasySafePayV2Url({
|
313
|
+
configs: configs,
|
314
|
+
mid: mid,
|
315
|
+
env: env,
|
316
|
+
pageName: ESP_PAGE_NAME.DOUBLE_FA
|
317
|
+
});
|
318
|
+
return url;
|
234
319
|
};
|
@@ -11,12 +11,14 @@ export type IChannelBehavior = {
|
|
11
11
|
type GetDoubleFaParams = {
|
12
12
|
instanceId: string;
|
13
13
|
paymentSessionData: string;
|
14
|
+
paymentSessionObj: IPaymentSessionMetaData;
|
14
15
|
locale: string;
|
15
16
|
paymentMethodType: string;
|
16
17
|
env: string;
|
17
18
|
sdkVersion: string;
|
19
|
+
notRedirectAfterComplete: boolean;
|
18
20
|
};
|
19
|
-
export declare function getChannelBehavior(paymentSessionMetaData?: IPaymentSessionMetaData): IChannelBehavior | undefined;
|
21
|
+
export declare function getChannelBehavior(paymentSessionMetaData?: IPaymentSessionMetaData, notRedirectAfterComplete?: boolean): IChannelBehavior | undefined;
|
20
22
|
export declare function getDoubleFaUrl(params: GetDoubleFaParams): string;
|
21
23
|
export declare const handleGooglePay: (data: EventPayload) => Promise<unknown>;
|
22
24
|
export declare class ApplePaySdk {
|
@@ -14,6 +14,8 @@ import { getApplePayPaymentSession, submitPayInfo } from "../../service";
|
|
14
14
|
import { EnvironmentEnum } from "../../types";
|
15
15
|
import { device, isEmpty } from "../../util";
|
16
16
|
import { APPLE_PAY_RECURRING_VERSION, APPLE_PAY_VERSION } from "../applepay/interface";
|
17
|
+
import { getDoubleFaUrlFromSession } from "../../foundation/utils/web_app_url_utils";
|
18
|
+
import { MODE } from "../../constant/easysafepay";
|
17
19
|
var APPLEPAYERRORENUM = /*#__PURE__*/function (APPLEPAYERRORENUM) {
|
18
20
|
APPLEPAYERRORENUM["APPLE_PAY_MISSING_DATA"] = "APPLE_PAY_MISSING_DATA";
|
19
21
|
APPLEPAYERRORENUM["APPLE_PAY_NOT_SUPPORTED"] = "APPLE_PAY_NOT_SUPPORTED";
|
@@ -27,7 +29,7 @@ var PAYMENT_STATUS = /*#__PURE__*/function (PAYMENT_STATUS) {
|
|
27
29
|
PAYMENT_STATUS["NORMAL"] = "NORMAL";
|
28
30
|
return PAYMENT_STATUS;
|
29
31
|
}(PAYMENT_STATUS || {});
|
30
|
-
export function getChannelBehavior(paymentSessionMetaData) {
|
32
|
+
export function getChannelBehavior(paymentSessionMetaData, notRedirectAfterComplete) {
|
31
33
|
var _paymentSessionMetaDa, _paymentSessionMetaDa2, _paymentSessionMetaDa3, _paymentSessionMetaDa4, _paymentSessionMetaDa5, _paymentSessionMetaDa6, _paymentSessionMetaDa7, _paymentSessionMetaDa8;
|
32
34
|
// TOSS EASYPAY 2.0
|
33
35
|
if ('BANKTRANSFER_QUICKPAY' === (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa = paymentSessionMetaData.paymentMethodInfoView) === null || _paymentSessionMetaDa === void 0 ? void 0 : _paymentSessionMetaDa.paymentMethodType) && (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa2 = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa2 === void 0 ? void 0 : _paymentSessionMetaDa2.productScene) === 'EASY_PAY' && (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa3 = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa3 === void 0 ? void 0 : _paymentSessionMetaDa3.paymentMethodCategoryType) === 'APM' && (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa4 = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa4 === void 0 ? void 0 : _paymentSessionMetaDa4.productSceneVersion) === '2.0') {
|
@@ -40,7 +42,8 @@ export function getChannelBehavior(paymentSessionMetaData) {
|
|
40
42
|
buildSubmitPayExtParams: function buildSubmitPayExtParams(params) {
|
41
43
|
var callBackUrl = getDoubleFaUrl(params);
|
42
44
|
return {
|
43
|
-
callBackUrl: callBackUrl
|
45
|
+
callBackUrl: callBackUrl,
|
46
|
+
notRedirectAfterComplete: notRedirectAfterComplete === true
|
44
47
|
};
|
45
48
|
}
|
46
49
|
};
|
@@ -65,20 +68,15 @@ export function getDoubleFaUrl(params) {
|
|
65
68
|
var instanceId = params.instanceId,
|
66
69
|
paymentMethodType = params.paymentMethodType,
|
67
70
|
paymentSessionData = params.paymentSessionData,
|
71
|
+
paymentSessionObj = params.paymentSessionObj,
|
68
72
|
locale = params.locale,
|
69
73
|
env = params.env,
|
70
|
-
sdkVersion = params.sdkVersion
|
74
|
+
sdkVersion = params.sdkVersion,
|
75
|
+
notRedirectAfterComplete = params.notRedirectAfterComplete;
|
71
76
|
var isLandscapeOrientation = false; // Web 不含横屏
|
72
77
|
|
73
|
-
var
|
74
|
-
|
75
|
-
dev: 'http://page.alipay.net/page/antom-web-checkout-v2/easysafepay/pages/double-fa/index-1.0.1.html',
|
76
|
-
sit: 'http://page.test.alipay.net/page/antom-web-checkout-v2/easysafepay/pages/double-fa/index.html',
|
77
|
-
pre: 'https://pre.ac.alipay.com/page/antom-web-checkout-v2/easysafepay/pages/double-fa/index.html',
|
78
|
-
prod: 'https://checkout.antom.com/easysafepay/pages/double-fa/index.html'
|
79
|
-
};
|
80
|
-
var doubleFaBaseUrl = DOUBLE_FA_URL_MAPPING[env] || DOUBLE_FA_URL_MAPPING.prod;
|
81
|
-
return "".concat(doubleFaBaseUrl, "?scene=cashierResultPage&instanceId=").concat(instanceId, "&paymentSessionData=").concat(encodeURIComponent(paymentSessionData), "&isLandscape=").concat(isLandscapeOrientation ? 'true' : '', "&pmt=").concat(paymentMethodType, "&locale=").concat(locale, "&sdkVersion=").concat(sdkVersion);
|
78
|
+
var baseDoubleFaUrl = getDoubleFaUrlFromSession(paymentSessionObj, env);
|
79
|
+
return "".concat(baseDoubleFaUrl) + '?' + "scene=cashierResultPage" + '&' + "instanceId=".concat(instanceId) + '&' + "paymentSessionData=".concat(encodeURIComponent(paymentSessionData)) + '&' + "isLandscape=".concat(isLandscapeOrientation ? 'true' : '') + '&' + "pmt=".concat(paymentMethodType) + '&' + "locale=".concat(locale) + '&' + "mode=".concat(MODE.SDK) + '&' + "sdkVersion=".concat(sdkVersion) + '&' + "¬RedirectAfterComplete=".concat(notRedirectAfterComplete);
|
82
80
|
}
|
83
81
|
export var handleGooglePay = function handleGooglePay(data) {
|
84
82
|
return new Promise(function (resolve, reject) {
|