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); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
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; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
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); }
import { request } from "../../../utils";

/**
 * 结算发起接口
 */
export var settlementApi = function settlementApi(data, config) {
  // return new Promise((resolve, reject) => {
  //   setTimeout(() => {
  //     resolve({
  //       status: true,
  //       code: 200,
  //       message: '',
  //       data: {
  //         id: '6cb75d74-b238-4dbb-b03a-4e75fdacefbd',
  //         version: 1,
  //         status: 'PENDING',
  //         message: 'Waiting for terminal to accept settlement enquiry',
  //         merchant_receipt: null,
  //         pos_instructions: {
  //           auto_actions: null,
  //           action_form: {
  //             layout: null,
  //             properties: null,
  //             details: {
  //               'Pairing ID': 'pid_eafc66cc-dd4f-450f-b31b-097d93e379d5',
  //               'Settlement ID': '6cb75d74-b238-4dbb-b03a-4e75fdacefbd',
  //               'Settlement Version': '1',
  //               TID: '3002200705',
  //             },
  //           },
  //         },
  //       },
  //     });
  //   }, 3000);
  // });
  return request.getRequest().post('/shop/pay/card-reader/settlement', data, _objectSpread(_objectSpread({}, config || {}), {}, {
    customMessage: true,
    fullResult: true
  }));
};

/**
 * 结算查询接口
 */
export var settlementQueryApi = function settlementQueryApi(id, data, config) {
  // return new Promise((resolve, reject) => {
  //   setTimeout(() => {
  //     resolve({
  //       status: true,
  //       code: 200,
  //       message: '',
  //       data: {
  //         id: '6cb75d74-b238-4dbb-b03a-4e75fdacefbd',
  //         version: 3,
  //         status: 'FINALISED',
  //         message: '❌ (942) Settlement Not Available',
  //         merchant_receipt:
  //           '\r\n     Gecko Bank\r\n           \r\n\r\nterminal 3002200705\r\n\r\n SETTLEMENT ENQUIRY\r\n\r\nTID       3002200705\r\nMID         30022007\r\n\r\n\r\n       (942)\r\n   Settlement Not\r\n     Available\r\n\r\n',
  //         pos_instructions: {
  //           auto_actions: null,
  //           action_form: {
  //             layout: [
  //               {
  //                 type: 'horizontal_layout',
  //                 elements: [
  //                   {
  //                     label: 'Done',
  //                     key: 'settlement_complete',
  //                   },
  //                   {
  //                     label: 'Retry',
  //                     key: 'retry_settlement',
  //                   },
  //                 ],
  //               },
  //             ],
  //             properties: {
  //               retry_settlement: {
  //                 type: 'button',
  //                 submit_url: null,
  //                 action: 'RETRY_SETTLEMENT',
  //               },
  //               settlement_complete: {
  //                 type: 'button',
  //                 submit_url: null,
  //                 action: 'SETTLEMENT_COMPLETE',
  //               },
  //             },
  //             details: {
  //               'Pairing ID': 'pid_eafc66cc-dd4f-450f-b31b-097d93e379d5',
  //               'Settlement ID': '6cb75d74-b238-4dbb-b03a-4e75fdacefbd',
  //               'Settlement Version': '3',
  //               TID: '3002200705',
  //             },
  //           },
  //         },
  //       },
  //     });
  //   }, 10000);
  // });
  // return new Promise((resolve, reject) => {
  //   setTimeout(() => {
  //     resolve({
  //       status: true,
  //       code: 200,
  //       message: '',
  //       data: {
  //         id: 'e625cdcd-4bc7-495e-b47d-4b8ff393a2d7',
  //         version: 3,
  //         status: 'FINALISED',
  //         message: '✅ (000) SETTLEMENT APPROVED',
  //         merchant_receipt:
  //           '\r\n     Gecko Bank\r\n           \r\n\r\nterminal 3002200705\r\n\r\n     SETTLEMENT\r\n\r\nTID       3002200705\r\nMID         30022007\r\nFrom   17MAR26 18:16\r\nTo     17MAR26 18:16\r\n\r\nVISA\r\nTOT    0       $0.00\r\n\r\nMASTERCARD\r\nTOT    0       $0.00\r\n\r\nAMEX\r\nTOT    0       $0.00\r\n\r\n\r\n       (000)\r\nSETTLEMENT APPROVED\r\n\r\n',
  //         pos_instructions: {
  //           auto_actions: null,
  //           action_form: {
  //             layout: [
  //               {
  //                 type: 'horizontal_layout',
  //                 elements: [
  //                   {
  //                     label: 'Print Merchant Receipt',
  //                     key: 'print_merchant_receipt',
  //                   },
  //                 ],
  //               },
  //               {
  //                 type: 'horizontal_layout',
  //                 elements: [
  //                   {
  //                     label: 'Done',
  //                     key: 'settlement_complete',
  //                   },
  //                 ],
  //               },
  //             ],
  //             properties: {
  //               print_merchant_receipt: {
  //                 type: 'button',
  //                 submit_url: null,
  //                 action: 'PRINT_MERCHANT_RECEIPT',
  //               },
  //               settlement_complete: {
  //                 type: 'button',
  //                 submit_url: null,
  //                 action: 'SETTLEMENT_COMPLETE',
  //               },
  //             },
  //             details: {
  //               'Pairing ID': 'pid_469119fa-ee67-45ec-8843-3f1dc5cda6e1',
  //               'Settlement ID': 'e625cdcd-4bc7-495e-b47d-4b8ff393a2d7',
  //               'Settlement Version': '3',
  //               TID: '3002200705',
  //             },
  //           },
  //         },
  //       },
  //     });
  //   }, 10000);
  // });
  return request.getRequest().get("/shop/pay/card-reader/settlement/".concat(id), data, _objectSpread(_objectSpread({}, config || {}), {}, {
    customMessage: true,
    fullResult: true
  }));
};