require("../../../../../_virtual/_rolldown/runtime.js");
const require_asyncToGenerator = require("../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
const require_useEngineContext = require("../../../../../hooks/useEngineContext.js");
const require_model = require("../../model.js");
const require_usePaymentLogger = require("../../../../../hooks/usePaymentLogger.js");
let react = require("react");
require("./index.less");
//#region src/components/pay/toC/PaymentMethods/GlobePayQrcode/index.tsx
/**
* @title: GlobePayQrcode
* @description:
* @param {GlobePayQrcodeProps} props
* @param {React} ref
* @return {*}
* @Author: zhiwei.Wang
* @Date: 2024-08-16 11:17
*/
const GlobePayQrcode = (props, ref) => {
	var _state$payGroup;
	const { state } = (0, react.useContext)(require_model.Context);
	require_useEngineContext.default();
	const paymentLogger = require_usePaymentLogger.default({
		orderId: ((_state$payGroup = state.payGroup) === null || _state$payGroup === void 0 ? void 0 : _state$payGroup.order_id) || "unknown",
		step: "2"
	});
	/**
	* @title: 初始化
	* @description:
	* @param {any} param1
	* @return {*}
	* @Author: zhiwei.Wang
	* @Date: 2024-08-16 11:17
	*/
	const init = function() {
		var _ref = require_asyncToGenerator._asyncToGenerator(function* ({ payGroup }) {
			paymentLogger.addLog({
				key: "GlobePayQrcode初始化开始",
				value: ""
			});
			try {
				let _item = payGroup === null || payGroup === void 0 ? void 0 : payGroup.otherPayment;
				paymentLogger.addLog({
					key: "GlobePayQrcode获取支付配置",
					value: ""
				});
				paymentLogger.addLog({
					key: "GlobePayQrcode准备回调",
					value: ""
				});
				paymentLogger.sendLogs("GlobePayQrcode处理成功");
				state.payCallback({
					key: _item.service,
					data: payGroup
				});
				return;
			} catch (err) {
				paymentLogger.addLog({
					key: "GlobePayQrcode处理错误",
					value: {
						title: `订单${payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id} GlobePayQrcode处理失败: ${(err === null || err === void 0 ? void 0 : err.message) || "未知错误"}`,
						data: { payGroup }
					}
				});
				paymentLogger.sendLogs("GlobePayQrcode处理失败", err);
			}
		});
		return function init(_x) {
			return _ref.apply(this, arguments);
		};
	}();
	(0, react.useImperativeHandle)(ref, () => ({ init }));
	return null;
};
var GlobePayQrcode_default = (0, react.forwardRef)(GlobePayQrcode);
//#endregion
exports.default = GlobePayQrcode_default;
