@alipay/ams-checkout 0.0.1710748686-dev.2 → 0.0.1711691167-dev.2
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/constant/index.d.ts +2 -2
- package/esm/constant/index.js +4 -4
- package/esm/core/bus/ability/callback.d.ts +9 -0
- package/esm/core/bus/ability/callback.js +55 -0
- package/esm/core/bus/ability/security.d.ts +10 -0
- package/esm/core/bus/ability/security.js +104 -0
- package/esm/core/bus/ability/tracker.d.ts +9 -0
- package/esm/core/bus/ability/tracker.js +77 -0
- package/esm/core/bus/index.d.ts +125 -0
- package/esm/core/bus/index.js +366 -0
- package/esm/core/bus/interface.d.ts +36 -0
- package/esm/core/bus/interface.js +40 -0
- package/esm/core/component/index.d.ts +15 -1
- package/esm/core/component/index.js +189 -26
- package/esm/core/instance/index.d.ts +12 -1
- package/esm/core/instance/index.js +54 -11
- package/esm/index.d.ts +0 -3
- package/esm/index.js +8 -18
- package/esm/{core/applepay/index.d.ts → plugin/applepay/component.d.ts} +27 -8
- package/esm/{core/applepay/index.js → plugin/applepay/component.js} +150 -180
- package/esm/plugin/applepay/index.d.ts +17 -0
- package/esm/plugin/applepay/index.js +117 -0
- package/esm/{common → plugin}/applepay/interface.d.ts +62 -3
- package/esm/plugin/applepay/interface.js +69 -0
- package/esm/{common/applepay/index.d.ts → plugin/applepay/service.d.ts} +13 -7
- package/esm/{common/applepay/index.js → plugin/applepay/service.js} +159 -41
- package/esm/plugin/component/index.d.ts +2 -2
- package/esm/plugin/component/index.js +68 -46
- package/esm/plugin/const.d.ts +2 -0
- package/esm/plugin/const.js +33 -0
- package/esm/plugin/paypal/index.d.ts +20 -0
- package/esm/plugin/paypal/index.js +377 -0
- package/esm/plugin/type.d.ts +33 -0
- package/esm/plugin/utils.d.ts +6 -0
- package/esm/plugin/utils.js +21 -0
- package/esm/request/index.d.ts +1 -1
- package/esm/service/index.d.ts +1 -1
- package/esm/types/index.d.ts +108 -6
- package/esm/types/index.js +26 -1
- package/esm/util/index.d.ts +2 -1
- package/esm/util/index.js +4 -2
- package/esm/util/logger.d.ts +4 -0
- package/esm/util/logger.js +23 -3
- package/esm/util/versionCompare.d.ts +1 -1
- package/package.json +1 -1
- /package/esm/{common/applepay/interface.js → plugin/type.js} +0 -0
@@ -0,0 +1,377 @@
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
5
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
7
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
8
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
9
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
10
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
11
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
12
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
13
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
14
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
15
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
17
|
+
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); }
|
18
|
+
import { BusManager, BusMessage, BusSubscriber } from "../../core/bus";
|
19
|
+
import { PaypalActionEnum, SDKCallbackActionEnum } from "../../core/bus/interface";
|
20
|
+
import { submitPayInfo } from "../../service";
|
21
|
+
import { eventCodeEnum, payPalConfigurationIntentEnum, PaypalMethodEnum } from "../../types";
|
22
|
+
import { isFunction } from "../../util";
|
23
|
+
import { appendLoadingIcon, isShowLoading } from "../utils";
|
24
|
+
export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
25
|
+
_inherits(PaypalBusSubscriber, _BusSubscriber);
|
26
|
+
var _super = _createSuper(PaypalBusSubscriber);
|
27
|
+
function PaypalBusSubscriber(logger) {
|
28
|
+
var _this;
|
29
|
+
_classCallCheck(this, PaypalBusSubscriber);
|
30
|
+
_this = _super.call(this);
|
31
|
+
_defineProperty(_assertThisInitialized(_this), "logger", void 0);
|
32
|
+
_defineProperty(_assertThisInitialized(_this), "onEventCallback", function (state) {
|
33
|
+
BusManager.publish(new BusMessage(SDKCallbackActionEnum.onEventCallback, JSON.stringify(state)));
|
34
|
+
});
|
35
|
+
_defineProperty(_assertThisInitialized(_this), "appendPaypalLoading", function (_ref) {
|
36
|
+
var selector = _ref.selector;
|
37
|
+
if (document.querySelector('.paypal-loading')) {
|
38
|
+
return;
|
39
|
+
}
|
40
|
+
var container = document.querySelector(selector);
|
41
|
+
container.innerHTML = '';
|
42
|
+
var loadingDiv = document.createElement('div');
|
43
|
+
loadingDiv.className = 'paypal-loading';
|
44
|
+
loadingDiv.style.backgroundColor = '#EBEBEB';
|
45
|
+
loadingDiv.style.width = '100%';
|
46
|
+
loadingDiv.style.height = '64px';
|
47
|
+
loadingDiv.style.borderRadius = '4px';
|
48
|
+
var loadingImage = document.createElement('div');
|
49
|
+
loadingImage.style.position = 'absolute';
|
50
|
+
loadingImage.style.top = '50%';
|
51
|
+
loadingImage.style.left = '50%';
|
52
|
+
loadingImage.style.transform = 'translate(-50%, -50%)';
|
53
|
+
loadingDiv.style.maxWidth = '750px';
|
54
|
+
loadingDiv.style.position = 'relative';
|
55
|
+
appendLoadingIcon({
|
56
|
+
htmlElement: loadingImage,
|
57
|
+
loadingWidth: '25px',
|
58
|
+
loadingHeight: '25px'
|
59
|
+
});
|
60
|
+
loadingDiv.appendChild(loadingImage);
|
61
|
+
container.appendChild(loadingDiv);
|
62
|
+
});
|
63
|
+
_defineProperty(_assertThisInitialized(_this), "removePaypalLoading", function () {
|
64
|
+
var loadingDiv = document.querySelector('.paypal-loading');
|
65
|
+
|
66
|
+
// 如果找到了该类元素,则从DOM中移除
|
67
|
+
if (loadingDiv) {
|
68
|
+
loadingDiv.remove();
|
69
|
+
}
|
70
|
+
});
|
71
|
+
_defineProperty(_assertThisInitialized(_this), "preCheck", function (paypalPluginProps) {
|
72
|
+
var _paypalPluginProps$pa, _paypalPluginProps$pa2;
|
73
|
+
var boundPaymentMethod = (_paypalPluginProps$pa = paypalPluginProps.paymentSessionFactor) === null || _paypalPluginProps$pa === void 0 || (_paypalPluginProps$pa = _paypalPluginProps$pa.paymentMethodInfo) === null || _paypalPluginProps$pa === void 0 || (_paypalPluginProps$pa = _paypalPluginProps$pa.paymentMethodMetaData) === null || _paypalPluginProps$pa === void 0 ? void 0 : _paypalPluginProps$pa.boundPaymentMethod;
|
74
|
+
var paymentMethodType = (_paypalPluginProps$pa2 = paypalPluginProps.paymentSessionFactor) === null || _paypalPluginProps$pa2 === void 0 || (_paypalPluginProps$pa2 = _paypalPluginProps$pa2.paymentMethodInfo) === null || _paypalPluginProps$pa2 === void 0 ? void 0 : _paypalPluginProps$pa2.paymentMethodType;
|
75
|
+
if (boundPaymentMethod && PaypalMethodEnum.PAYPAL_VAULT === paymentMethodType) {
|
76
|
+
_this.onEventCallback({
|
77
|
+
code: eventCodeEnum.SDK_PAYMENT_WARN,
|
78
|
+
message: 'You can directly request the server interface without antom-sdk.'
|
79
|
+
});
|
80
|
+
}
|
81
|
+
return Promise.resolve(paypalPluginProps);
|
82
|
+
});
|
83
|
+
// 加载paypal资源
|
84
|
+
_defineProperty(_assertThisInitialized(_this), "loadPaypalResource", function (paypalPluginProps) {
|
85
|
+
return new Promise(function (resolve, reject) {
|
86
|
+
var _paypalPluginProps$ap;
|
87
|
+
if (isShowLoading((_paypalPluginProps$ap = paypalPluginProps.appearance) === null || _paypalPluginProps$ap === void 0 ? void 0 : _paypalPluginProps$ap.showLoading)) {
|
88
|
+
_this.appendPaypalLoading({
|
89
|
+
selector: paypalPluginProps.selector
|
90
|
+
});
|
91
|
+
}
|
92
|
+
var paypalScript = _this.createPaypalScript(paypalPluginProps);
|
93
|
+
// 在script加载完成后执行回调函数
|
94
|
+
paypalScript.onload = function () {
|
95
|
+
resolve('loading successfully');
|
96
|
+
};
|
97
|
+
// 如果有错误则输出错误信息
|
98
|
+
paypalScript.onerror = function (error) {
|
99
|
+
reject(error);
|
100
|
+
};
|
101
|
+
// 将script标签添加到DOM中
|
102
|
+
document.body.appendChild(paypalScript);
|
103
|
+
});
|
104
|
+
});
|
105
|
+
_defineProperty(_assertThisInitialized(_this), "createPaypalScript", function (paypalPluginProps) {
|
106
|
+
var _paypalPluginProps$pa3, _paypalPluginProps$pa4, _paypalPluginProps$pa5, _paypalPluginProps$pa6;
|
107
|
+
var channelMerchantAccountId = (_paypalPluginProps$pa3 = paypalPluginProps.paymentSessionFactor) === null || _paypalPluginProps$pa3 === void 0 || (_paypalPluginProps$pa3 = _paypalPluginProps$pa3.merchantInfo) === null || _paypalPluginProps$pa3 === void 0 ? void 0 : _paypalPluginProps$pa3.channelMerchantAccountId;
|
108
|
+
var accessToken = (_paypalPluginProps$pa4 = paypalPluginProps.paymentSessionFactor) === null || _paypalPluginProps$pa4 === void 0 || (_paypalPluginProps$pa4 = _paypalPluginProps$pa4.paymentMethodInfo) === null || _paypalPluginProps$pa4 === void 0 || (_paypalPluginProps$pa4 = _paypalPluginProps$pa4.paypal) === null || _paypalPluginProps$pa4 === void 0 ? void 0 : _paypalPluginProps$pa4.accessToken;
|
109
|
+
var locale = paypalPluginProps.locale;
|
110
|
+
var currency = (_paypalPluginProps$pa5 = paypalPluginProps.paymentSessionFactor) === null || _paypalPluginProps$pa5 === void 0 || (_paypalPluginProps$pa5 = _paypalPluginProps$pa5.paymentMethodInfo) === null || _paypalPluginProps$pa5 === void 0 || (_paypalPluginProps$pa5 = _paypalPluginProps$pa5.paymentAmount) === null || _paypalPluginProps$pa5 === void 0 ? void 0 : _paypalPluginProps$pa5.currency;
|
111
|
+
var paymentMethodType = (_paypalPluginProps$pa6 = paypalPluginProps.paymentSessionFactor) === null || _paypalPluginProps$pa6 === void 0 || (_paypalPluginProps$pa6 = _paypalPluginProps$pa6.paymentMethodInfo) === null || _paypalPluginProps$pa6 === void 0 ? void 0 : _paypalPluginProps$pa6.paymentMethodType;
|
112
|
+
var _ref2 = (paypalPluginProps === null || paypalPluginProps === void 0 ? void 0 : paypalPluginProps.paypalConfiguration) || {},
|
113
|
+
blockPayPalCreditButton = _ref2.blockPayPalCreditButton,
|
114
|
+
blockPayPalPayLaterButton = _ref2.blockPayPalPayLaterButton,
|
115
|
+
displayPayPalPayLaterButtonOnly = _ref2.displayPayPalPayLaterButtonOnly,
|
116
|
+
enableMessages = _ref2.enableMessages,
|
117
|
+
intent = _ref2.intent;
|
118
|
+
var script = document.createElement('script');
|
119
|
+
var src = "https://www.paypal.com/sdk/js?";
|
120
|
+
var urlSearchParams = new URLSearchParams({
|
121
|
+
currency: currency,
|
122
|
+
locale: locale,
|
123
|
+
'client-id': channelMerchantAccountId
|
124
|
+
});
|
125
|
+
if (displayPayPalPayLaterButtonOnly) {
|
126
|
+
urlSearchParams.append('disable-funding', 'credit,card');
|
127
|
+
} else {
|
128
|
+
var disableFundingArr = [];
|
129
|
+
if (blockPayPalCreditButton) {
|
130
|
+
disableFundingArr.push('card');
|
131
|
+
}
|
132
|
+
if (blockPayPalPayLaterButton) {
|
133
|
+
disableFundingArr.push('credit');
|
134
|
+
}
|
135
|
+
if (disableFundingArr.length) {
|
136
|
+
urlSearchParams.append('disable-funding', disableFundingArr.join(','));
|
137
|
+
}
|
138
|
+
}
|
139
|
+
if (enableMessages) {
|
140
|
+
urlSearchParams.append('components', 'messages,buttons');
|
141
|
+
} else {
|
142
|
+
urlSearchParams.append('components', 'buttons');
|
143
|
+
}
|
144
|
+
if (payPalConfigurationIntentEnum.intent === intent && PaypalMethodEnum.PAYPAL_CHECKOUT === paymentMethodType) {
|
145
|
+
urlSearchParams.append('intent', 'authorize');
|
146
|
+
urlSearchParams.append('commit', 'false');
|
147
|
+
}
|
148
|
+
if (PaypalMethodEnum.PAYPAL_VAULT === paymentMethodType) {
|
149
|
+
urlSearchParams.append('vault', 'true');
|
150
|
+
}
|
151
|
+
src += urlSearchParams.toString();
|
152
|
+
script.src = src;
|
153
|
+
script['data-user-id-token'] = accessToken;
|
154
|
+
return script;
|
155
|
+
});
|
156
|
+
_defineProperty(_assertThisInitialized(_this), "onShippingChange", /*#__PURE__*/function () {
|
157
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
|
158
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
159
|
+
while (1) switch (_context.prev = _context.next) {
|
160
|
+
case 0:
|
161
|
+
_this.onEventCallback({
|
162
|
+
code: eventCodeEnum.SDK_PAYMENT_SHIPPINGCHANGE,
|
163
|
+
result: {
|
164
|
+
data: data
|
165
|
+
}
|
166
|
+
});
|
167
|
+
case 1:
|
168
|
+
case "end":
|
169
|
+
return _context.stop();
|
170
|
+
}
|
171
|
+
}, _callee);
|
172
|
+
}));
|
173
|
+
return function (_x) {
|
174
|
+
return _ref3.apply(this, arguments);
|
175
|
+
};
|
176
|
+
}());
|
177
|
+
_defineProperty(_assertThisInitialized(_this), "createOrder", /*#__PURE__*/function () {
|
178
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_data, _action, paymentSessionData) {
|
179
|
+
var _submitPayInfoRes$ext;
|
180
|
+
var submitPayInfoRes;
|
181
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
182
|
+
while (1) switch (_context2.prev = _context2.next) {
|
183
|
+
case 0:
|
184
|
+
_context2.next = 2;
|
185
|
+
return submitPayInfo(paymentSessionData, {}, _this.logger);
|
186
|
+
case 2:
|
187
|
+
submitPayInfoRes = _context2.sent;
|
188
|
+
if (!(!(submitPayInfoRes !== null && submitPayInfoRes !== void 0 && submitPayInfoRes.success) || !(submitPayInfoRes !== null && submitPayInfoRes !== void 0 && (_submitPayInfoRes$ext = submitPayInfoRes.extendInfo) !== null && _submitPayInfoRes$ext !== void 0 && _submitPayInfoRes$ext.channelOrderId))) {
|
189
|
+
_context2.next = 7;
|
190
|
+
break;
|
191
|
+
}
|
192
|
+
_this.logger.logInfo({
|
193
|
+
title: 'paypal_payment_failed'
|
194
|
+
});
|
195
|
+
_this.onEventCallback({
|
196
|
+
code: eventCodeEnum.SDK_PAYMENT_FAIL,
|
197
|
+
message: 'Create order failed.'
|
198
|
+
});
|
199
|
+
return _context2.abrupt("return");
|
200
|
+
case 7:
|
201
|
+
return _context2.abrupt("return", submitPayInfoRes.extendInfo.channelOrderId);
|
202
|
+
case 8:
|
203
|
+
case "end":
|
204
|
+
return _context2.stop();
|
205
|
+
}
|
206
|
+
}, _callee2);
|
207
|
+
}));
|
208
|
+
return function (_x2, _x3, _x4) {
|
209
|
+
return _ref4.apply(this, arguments);
|
210
|
+
};
|
211
|
+
}());
|
212
|
+
_defineProperty(_assertThisInitialized(_this), "onApprove", /*#__PURE__*/function () {
|
213
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(onApproveData) {
|
214
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
215
|
+
while (1) switch (_context3.prev = _context3.next) {
|
216
|
+
case 0:
|
217
|
+
_this.onEventCallback({
|
218
|
+
code: eventCodeEnum.SDK_PAYMENT_APPROVE,
|
219
|
+
result: {
|
220
|
+
onApproveData: onApproveData
|
221
|
+
}
|
222
|
+
});
|
223
|
+
if (_this.logger && isFunction(_this.logger.logInfo)) {
|
224
|
+
_this.logger.logInfo({
|
225
|
+
title: 'paypal_payment_approved'
|
226
|
+
});
|
227
|
+
}
|
228
|
+
case 2:
|
229
|
+
case "end":
|
230
|
+
return _context3.stop();
|
231
|
+
}
|
232
|
+
}, _callee3);
|
233
|
+
}));
|
234
|
+
return function (_x5) {
|
235
|
+
return _ref5.apply(this, arguments);
|
236
|
+
};
|
237
|
+
}());
|
238
|
+
_defineProperty(_assertThisInitialized(_this), "onCancel", /*#__PURE__*/function () {
|
239
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(orderId) {
|
240
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
241
|
+
while (1) switch (_context4.prev = _context4.next) {
|
242
|
+
case 0:
|
243
|
+
_this.onEventCallback({
|
244
|
+
code: eventCodeEnum.SDK_PAYMENT_CANCEL,
|
245
|
+
result: {
|
246
|
+
orderId: orderId
|
247
|
+
}
|
248
|
+
});
|
249
|
+
if (_this.logger && isFunction(_this.logger.logInfo)) {
|
250
|
+
_this.logger.logInfo({
|
251
|
+
title: 'paypal_payment_cancelled'
|
252
|
+
});
|
253
|
+
}
|
254
|
+
case 2:
|
255
|
+
case "end":
|
256
|
+
return _context4.stop();
|
257
|
+
}
|
258
|
+
}, _callee4);
|
259
|
+
}));
|
260
|
+
return function (_x6) {
|
261
|
+
return _ref6.apply(this, arguments);
|
262
|
+
};
|
263
|
+
}());
|
264
|
+
_defineProperty(_assertThisInitialized(_this), "destroyComponent", /*#__PURE__*/function () {
|
265
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(context, message) {
|
266
|
+
var data;
|
267
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
268
|
+
while (1) switch (_context5.prev = _context5.next) {
|
269
|
+
case 0:
|
270
|
+
data = message.getJSONObject();
|
271
|
+
_this.logger.logInfo({
|
272
|
+
title: 'sdk_event_clean_component'
|
273
|
+
}).send();
|
274
|
+
if (document.querySelector(data === null || data === void 0 ? void 0 : data.selector)) {
|
275
|
+
document.querySelector(data === null || data === void 0 ? void 0 : data.selector).innerHTML = '';
|
276
|
+
console.log('paypal: destroy Component');
|
277
|
+
}
|
278
|
+
case 3:
|
279
|
+
case "end":
|
280
|
+
return _context5.stop();
|
281
|
+
}
|
282
|
+
}, _callee5);
|
283
|
+
}));
|
284
|
+
return function (_x7, _x8) {
|
285
|
+
return _ref7.apply(this, arguments);
|
286
|
+
};
|
287
|
+
}());
|
288
|
+
_this.logger = logger;
|
289
|
+
return _this;
|
290
|
+
}
|
291
|
+
_createClass(PaypalBusSubscriber, [{
|
292
|
+
key: "actionNames",
|
293
|
+
value: function actionNames() {
|
294
|
+
return Object.values(PaypalActionEnum);
|
295
|
+
}
|
296
|
+
}, {
|
297
|
+
key: "renderPaypalButton",
|
298
|
+
value: function renderPaypalButton(context, message) {
|
299
|
+
var _data$options,
|
300
|
+
_data$appendParams,
|
301
|
+
_data$appendParams2,
|
302
|
+
_data$appendParams3,
|
303
|
+
_data$appendParams4,
|
304
|
+
_data$appendParams5,
|
305
|
+
_this2 = this;
|
306
|
+
var data = message.getJSONObject();
|
307
|
+
var paypalPluginProps = {
|
308
|
+
locale: (_data$options = data.options) === null || _data$options === void 0 ? void 0 : _data$options.locale,
|
309
|
+
paymentSessionData: (_data$appendParams = data.appendParams) === null || _data$appendParams === void 0 || (_data$appendParams = _data$appendParams.iframeNodesParams) === null || _data$appendParams === void 0 ? void 0 : _data$appendParams.sessionData,
|
310
|
+
paymentSessionFactor: (_data$appendParams2 = data.appendParams) === null || _data$appendParams2 === void 0 || (_data$appendParams2 = _data$appendParams2.iframeNodesParams) === null || _data$appendParams2 === void 0 || (_data$appendParams2 = _data$appendParams2.paymentSessionMetaData) === null || _data$appendParams2 === void 0 ? void 0 : _data$appendParams2.paymentSessionFactor,
|
311
|
+
selector: (_data$appendParams3 = data.appendParams) === null || _data$appendParams3 === void 0 || (_data$appendParams3 = _data$appendParams3.iframeNodesParams) === null || _data$appendParams3 === void 0 ? void 0 : _data$appendParams3.selector,
|
312
|
+
paypalConfiguration: (_data$appendParams4 = data.appendParams) === null || _data$appendParams4 === void 0 || (_data$appendParams4 = _data$appendParams4.iframeNodesParams) === null || _data$appendParams4 === void 0 ? void 0 : _data$appendParams4.paypalConfiguration,
|
313
|
+
appearance: (_data$appendParams5 = data.appendParams) === null || _data$appendParams5 === void 0 || (_data$appendParams5 = _data$appendParams5.iframeNodesParams) === null || _data$appendParams5 === void 0 ? void 0 : _data$appendParams5.appearance
|
314
|
+
};
|
315
|
+
return this.preCheck(paypalPluginProps).then(function (paypalPluginProps) {
|
316
|
+
return _this2.loadPaypalResource(paypalPluginProps).then(function () {
|
317
|
+
var _paypalPluginProps$pa7, _paypalPluginProps$pa8, _paypalPluginProps$pa9;
|
318
|
+
var createButtonConfig = {
|
319
|
+
style: (_paypalPluginProps$pa7 = (_paypalPluginProps$pa8 = paypalPluginProps.paypalConfiguration) === null || _paypalPluginProps$pa8 === void 0 ? void 0 : _paypalPluginProps$pa8.style) !== null && _paypalPluginProps$pa7 !== void 0 ? _paypalPluginProps$pa7 : {},
|
320
|
+
fundingSource: undefined,
|
321
|
+
onShippingChange: _this2.onShippingChange,
|
322
|
+
createOrder: function createOrder(data, action) {
|
323
|
+
return _this2.createOrder(data, action, paypalPluginProps.paymentSessionData);
|
324
|
+
},
|
325
|
+
onApprove: _this2.onApprove,
|
326
|
+
onCancel: _this2.onCancel
|
327
|
+
};
|
328
|
+
if ((_paypalPluginProps$pa9 = paypalPluginProps.paypalConfiguration) !== null && _paypalPluginProps$pa9 !== void 0 && _paypalPluginProps$pa9.displayPayPalPayLaterButtonOnly) {
|
329
|
+
createButtonConfig.fundingSource = window.paypal.FUNDING.PAYLATER;
|
330
|
+
}
|
331
|
+
try {
|
332
|
+
window.paypal.Buttons(createButtonConfig).render(paypalPluginProps.selector);
|
333
|
+
} catch (error) {
|
334
|
+
_this2.logger.logError({
|
335
|
+
title: 'button_render_failed'
|
336
|
+
}, {
|
337
|
+
message: error
|
338
|
+
});
|
339
|
+
_this2.onEventCallback({
|
340
|
+
code: eventCodeEnum.SDK_PAYMENT_FAIL,
|
341
|
+
message: 'Button render failed.'
|
342
|
+
});
|
343
|
+
return Promise.reject(error);
|
344
|
+
}
|
345
|
+
}).catch(function (error) {
|
346
|
+
_this2.logger.logError({
|
347
|
+
title: 'paypal_payment_loadSDK_failed'
|
348
|
+
});
|
349
|
+
_this2.onEventCallback({
|
350
|
+
code: eventCodeEnum.SDK_PAYMENT_FAIL,
|
351
|
+
message: 'Loading paypal sdk failed.'
|
352
|
+
});
|
353
|
+
return Promise.reject(error);
|
354
|
+
}).finally(function () {
|
355
|
+
var _paypalPluginProps$ap2;
|
356
|
+
if (isShowLoading((_paypalPluginProps$ap2 = paypalPluginProps.appearance) === null || _paypalPluginProps$ap2 === void 0 ? void 0 : _paypalPluginProps$ap2.showLoading)) {
|
357
|
+
_this2.removePaypalLoading();
|
358
|
+
}
|
359
|
+
});
|
360
|
+
});
|
361
|
+
}
|
362
|
+
}, {
|
363
|
+
key: "onMessage",
|
364
|
+
value: function onMessage(context, message) {
|
365
|
+
switch (message.getAction()) {
|
366
|
+
case PaypalActionEnum.mountComponent:
|
367
|
+
this.renderPaypalButton(context, message);
|
368
|
+
break;
|
369
|
+
case PaypalActionEnum.destroyComponent:
|
370
|
+
this.destroyComponent(context, message);
|
371
|
+
default:
|
372
|
+
console.log('Unknown action: ' + message.getAction());
|
373
|
+
}
|
374
|
+
}
|
375
|
+
}]);
|
376
|
+
return PaypalBusSubscriber;
|
377
|
+
}(BusSubscriber);
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import { BusSubscriber } from 'src/core/bus';
|
2
|
+
import { paymentMethodCategoryTypeEnum, productSceneEnum, ProductSceneVersion } from '../types';
|
3
|
+
export type IExtendPlugin = IExtendPluginItem[];
|
4
|
+
export interface ComponentActionNamesType {
|
5
|
+
canMakePayments?: string;
|
6
|
+
optional_init?: string;
|
7
|
+
createComponent?: string;
|
8
|
+
mountComponent?: string;
|
9
|
+
submit?: string;
|
10
|
+
destroyComponent?: string;
|
11
|
+
}
|
12
|
+
export type IExtendPluginItem = {
|
13
|
+
/**
|
14
|
+
* 以下为sessionData匹配的场景
|
15
|
+
*/
|
16
|
+
sessionMatcher?: {
|
17
|
+
productScene: productSceneEnum;
|
18
|
+
productSceneVersion: ProductSceneVersion;
|
19
|
+
paymentMethodCategoryType: paymentMethodCategoryTypeEnum;
|
20
|
+
paymentMethodTypes: string[];
|
21
|
+
};
|
22
|
+
/**
|
23
|
+
* 用于无sessionData场景,比如:canMakePayments
|
24
|
+
*/
|
25
|
+
paymentChannelMatcher?: {
|
26
|
+
paymentMethod: string;
|
27
|
+
};
|
28
|
+
/**
|
29
|
+
* 以下plugin 实现的定义
|
30
|
+
*/
|
31
|
+
busActionNames: ComponentActionNamesType;
|
32
|
+
busSubscriber?: BusSubscriber;
|
33
|
+
};
|
@@ -0,0 +1,21 @@
|
|
1
|
+
export var appendLoadingIcon = function appendLoadingIcon(props) {
|
2
|
+
var htmlElement = props.htmlElement,
|
3
|
+
loadingHeight = props.loadingHeight,
|
4
|
+
loadingWidth = props.loadingWidth;
|
5
|
+
var spinStyles = "\n @keyframes loadingSpin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n }\n ";
|
6
|
+
var loadingImg = document.createElement('img');
|
7
|
+
loadingImg.src = 'https://mdn.alipayobjects.com/huamei_saktgs/afts/img/A*vmqbT6W9g4oAAAAAAAAAAAAADviCAQ/original';
|
8
|
+
loadingImg.classList.add('atom-loading');
|
9
|
+
loadingImg.style.width = loadingWidth;
|
10
|
+
loadingImg.style.height = loadingHeight;
|
11
|
+
loadingImg.style.animation = 'loadingSpin 0.8s linear infinite';
|
12
|
+
var styleElement = document.createElement('style');
|
13
|
+
styleElement.textContent = spinStyles;
|
14
|
+
document.head.appendChild(styleElement);
|
15
|
+
if (htmlElement) {
|
16
|
+
htmlElement.appendChild(loadingImg);
|
17
|
+
}
|
18
|
+
};
|
19
|
+
export var isShowLoading = function isShowLoading(showLoading) {
|
20
|
+
return showLoading = typeof showLoading === 'boolean' ? showLoading : true;
|
21
|
+
};
|
package/esm/request/index.d.ts
CHANGED
package/esm/service/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ApplePayPaymentSessionRequest, ApplePayPaymentSessionResult, CashierSdkActionQueryRequest, CashierSdkActionQueryResult, CashierSubmitPayRequest, CashierSubmitPayResult, RequestConfig } from '../types';
|
2
|
-
import { Logger } from '../util/logger';
|
2
|
+
import type { Logger } from '../util/logger';
|
3
3
|
export declare function queryPaymentInfo(params: CashierSdkActionQueryRequest, options: RequestConfig, logger: Logger): Promise<CashierSdkActionQueryResult>;
|
4
4
|
export declare function antomConfig(options: RequestConfig, logger: Logger): Promise<any>;
|
5
5
|
export declare function submitPayInfo(params: CashierSubmitPayRequest, options: RequestConfig, logger: Logger): Promise<CashierSubmitPayResult>;
|
package/esm/types/index.d.ts
CHANGED
@@ -81,6 +81,19 @@ export interface IappendIframeNodesParams extends IcreateComponent {
|
|
81
81
|
paymentSessionMetaData: IpaymentSessionMetaData;
|
82
82
|
renderDisplayType: renderDisplayTypeEnum;
|
83
83
|
selector?: Iselector;
|
84
|
+
paypalConfiguration?: IPaypalConfiguration;
|
85
|
+
}
|
86
|
+
export interface IPaypalConfiguration {
|
87
|
+
style?: Object;
|
88
|
+
blockPayPalCreditButton?: boolean;
|
89
|
+
blockPayPalPayLaterButton?: boolean;
|
90
|
+
displayPayPalPayLaterButtonOnly?: boolean;
|
91
|
+
enableMessages?: boolean;
|
92
|
+
intent?: payPalConfigurationIntentEnum;
|
93
|
+
}
|
94
|
+
export declare enum payPalConfigurationIntentEnum {
|
95
|
+
'intent' = "intent",
|
96
|
+
'capture' = "capture"
|
84
97
|
}
|
85
98
|
export interface IMerchantAppointParam {
|
86
99
|
storedCard?: IStoredCard;
|
@@ -135,16 +148,17 @@ export interface IpaymentSessionMetaData {
|
|
135
148
|
skipSdkQuery: boolean;
|
136
149
|
};
|
137
150
|
paymentSessionFactor?: {
|
138
|
-
|
151
|
+
extendInfo?: {
|
139
152
|
merchantCapabilities?: string[];
|
140
153
|
supportedNetworks?: string[];
|
141
154
|
};
|
142
155
|
merchantInfo?: {
|
143
156
|
registeredCountry?: string;
|
144
157
|
partnerId?: string;
|
158
|
+
merchantName?: string;
|
145
159
|
};
|
146
160
|
order?: {
|
147
|
-
orderDescription
|
161
|
+
orderDescription: string;
|
148
162
|
};
|
149
163
|
paymentAmount?: {
|
150
164
|
value?: string;
|
@@ -156,8 +170,72 @@ export interface IpaymentSessionMetaData {
|
|
156
170
|
paymentMethodViewMetaData?: any;
|
157
171
|
paymentRequestId?: string;
|
158
172
|
supportedLanguages?: any;
|
173
|
+
/**
|
174
|
+
* 当前为苹果分期场景的信息
|
175
|
+
*/
|
176
|
+
recurringInfo?: {
|
177
|
+
/**
|
178
|
+
* 代扣协议开始日期 不传为当前系统时间
|
179
|
+
*/
|
180
|
+
startDate?: number;
|
181
|
+
/**
|
182
|
+
* 代扣协议结束日期 不传不限制结束时间
|
183
|
+
*/
|
184
|
+
endDate?: number;
|
185
|
+
/**
|
186
|
+
* 付款时间间隔单位,支持:"year" "month" "day" "hour" "minute" 不传默认month
|
187
|
+
*/
|
188
|
+
intervalUnit?: string;
|
189
|
+
/**
|
190
|
+
* 付款时间间隔。比如每过6个月付款一次,intervalCount就是6, 不传默认为1
|
191
|
+
*/
|
192
|
+
intervalCount?: number;
|
193
|
+
/**
|
194
|
+
* 分期标题信息
|
195
|
+
*/
|
196
|
+
title?: string;
|
197
|
+
/**
|
198
|
+
* 分期管理页面
|
199
|
+
*/
|
200
|
+
managementURL?: string;
|
201
|
+
/**
|
202
|
+
* 苹果通知ipay MAPN信息变更的地址
|
203
|
+
*/
|
204
|
+
tokenNotificationURL?: string;
|
205
|
+
/**
|
206
|
+
* 分期协议描述
|
207
|
+
*/
|
208
|
+
agreementDescription?: string;
|
209
|
+
};
|
159
210
|
};
|
160
211
|
}
|
212
|
+
export interface IPaymentSessionFactor {
|
213
|
+
merchantInfo?: IMerchantInfo;
|
214
|
+
paymentMethodInfo: IPaymentMethodInfo;
|
215
|
+
}
|
216
|
+
export interface IPaymentMethodInfo {
|
217
|
+
paymentAmount?: IPaymentAmount;
|
218
|
+
paymentMethodMetaData?: IPaymentMethodMetaData;
|
219
|
+
paymentMethodType?: PaypalMethodEnum;
|
220
|
+
paypal?: IPaypalConfig;
|
221
|
+
}
|
222
|
+
export type IPaypalConfig = {
|
223
|
+
accessToken: string;
|
224
|
+
};
|
225
|
+
export interface IPaymentMethodMetaData {
|
226
|
+
bindPaymentMethod?: string;
|
227
|
+
boundPaymentMethod?: string;
|
228
|
+
}
|
229
|
+
export interface IMerchantInfo {
|
230
|
+
channelMerchantAccountId?: string;
|
231
|
+
}
|
232
|
+
export interface IPaymentAmount {
|
233
|
+
value?: string;
|
234
|
+
currency?: PaymentAmountEnum;
|
235
|
+
}
|
236
|
+
export declare enum PaymentAmountEnum {
|
237
|
+
USD = "USD"
|
238
|
+
}
|
161
239
|
export declare enum localeEnum {
|
162
240
|
'en-US' = "en-US"
|
163
241
|
}
|
@@ -201,8 +279,8 @@ export declare enum platformEnum {
|
|
201
279
|
desktop = "desktop",
|
202
280
|
mobile = "mobile"
|
203
281
|
}
|
204
|
-
type EventCallbackResult = {
|
205
|
-
result
|
282
|
+
export type EventCallbackResult = {
|
283
|
+
result?: {
|
206
284
|
resultCode: string;
|
207
285
|
resultStatus: string;
|
208
286
|
resultMessage: string;
|
@@ -410,9 +488,17 @@ export declare enum eventCodeEnum {
|
|
410
488
|
SDK_CREATECOMPONENT_ERROR = "SDK_CREATECOMPONENT_ERROR",
|
411
489
|
SDK_CALL_URL_ERROR = "SDK_CALL_URL_ERROR",
|
412
490
|
SDK_CALL_URL_SUCCESS = "SDK_CALL_URL_SUCCESS",
|
413
|
-
|
491
|
+
SDK_PAYMENT_SUCCESSFUL = "SDK_PAYMENT_SUCCESSFUL",
|
414
492
|
SDK_PAYMENT_FAIL = "SDK_PAYMENT_FAIL",
|
415
|
-
|
493
|
+
SDK_PAYMENT_ERROR = "SDK_PAYMENT_ERROR",
|
494
|
+
SDK_PAYMENT_CANCEL = "SDK_PAYMENT_CANCEL",
|
495
|
+
/**
|
496
|
+
* 当前为Apple Pay发起了Pay请求,但是用户关闭了页面
|
497
|
+
*/
|
498
|
+
SDK_PAYMENT_PROCESSING = "SDK_PAYMENT_PROCESSING",
|
499
|
+
SDK_PAYMENT_WARN = "SDK_PAYMENT_WARN",
|
500
|
+
SDK_PAYMENT_SHIPPINGCHANGE = "SDK_PAYMENT_SHIPPINGCHANGE",
|
501
|
+
SDK_PAYMENT_APPROVE = "SDK_PAYMENT_APPROVE"
|
416
502
|
}
|
417
503
|
export declare enum RedirectType {
|
418
504
|
ApplinkUrl = "ApplinkUrl",
|
@@ -433,4 +519,20 @@ export interface CallbackEventInfo {
|
|
433
519
|
export interface MultipleCallbackEvents {
|
434
520
|
[key: string]: CallbackEventInfo;
|
435
521
|
}
|
522
|
+
export declare enum PaypalMethodEnum {
|
523
|
+
PAYPAL_CHECKOUT = "PAYPAL_CHECKOUT",
|
524
|
+
PAYPAL_VAULT = "PAYPAL_VAULT",
|
525
|
+
PAYPAL_PAYLATER = "PAYPAL_PAYLATER"
|
526
|
+
}
|
527
|
+
export type PaymentMethodTypeEnum = 'ApplePay';
|
528
|
+
export type ApplePaySubTypeEnum = 'ApplePayRecurringPayment';
|
529
|
+
export type SubPaymentMethodTypeEnum = ApplePaySubTypeEnum;
|
530
|
+
export declare enum ProductSceneVersion {
|
531
|
+
V1 = "1.0",
|
532
|
+
V2 = "2.0"
|
533
|
+
}
|
534
|
+
export type IAppendParams = {
|
535
|
+
componentSign: componentSignEnum;
|
536
|
+
iframeNodesParams: IappendIframeNodesParams;
|
537
|
+
};
|
436
538
|
export {};
|