/** PayPal / Stripe 结算货币选项(参考主题同款 26 种)。 */ const currencyOptions = [ { label: '澳元 (AUD)', value: 'AUD' }, { label: '巴西雷亚尔 (BRL)', value: 'BRL' }, { label: '加拿大元 (CAD)', value: 'CAD' }, { label: '人民币 (CNY)', value: 'CNY' }, { label: '克朗 (CZK)', value: 'CZK' }, { label: '丹麦克朗 (DKK)', value: 'DKK' }, { label: '欧元 (EUR)', value: 'EUR' }, { label: '港币 (HKD)', value: 'HKD' }, { label: '匈牙利福林 (HUF)', value: 'HUF' }, { label: '印度卢比 (INR)', value: 'INR' }, { label: '以色列新谢克尔 (ILS)', value: 'ILS' }, { label: '日元 (JPY)', value: 'JPY' }, { label: '马来西亚林吉特 (MYR)', value: 'MYR' }, { label: '墨西哥比索 (MXN)', value: 'MXN' }, { label: '新台币 (TWD)', value: 'TWD' }, { label: '新西兰元 (NZD)', value: 'NZD' }, { label: '挪威克朗 (NOK)', value: 'NOK' }, { label: '菲律宾比索 (PHP)', value: 'PHP' }, { label: '波兰兹罗提 (PLN)', value: 'PLN' }, { label: '英镑 (GBP)', value: 'GBP' }, { label: '俄罗斯卢布 (RUB)', value: 'RUB' }, { label: '新加坡元 (SGD)', value: 'SGD' }, { label: '瑞典克朗 (SEK)', value: 'SEK' }, { label: '瑞士法郎 (CHF)', value: 'CHF' }, { label: '泰铢 (THB)', value: 'THB' }, { label: '美元 (USD)', value: 'USD' }, ] /** * 收款接口 — 参考主题双下拉式重构:微信/支付宝接口选择(官方/易支付/关闭)、 * PayPal/Stripe 独立开关、货币与结算、订单与编号、 * 收款接口显示顺序,以及 5 个凭据配置块(支付宝/微信/PayPal/Stripe/易支付)。 */ export const gatewaySchema = { key: 'payment.gateway', title: '收款接口', icon: 'fa fas fa-credit-card', description: '配置收款通道:微信与支付宝可在官方/易支付之间选择,PayPal 与 Stripe 独立开关。订单、资金流水与提现统一使用同一套自动流水号,无需配置前缀。', defaults: { pay_wechat_sdk_options: 'null', pay_alipay_sdk_options: 'null', pay_paypal_sdk_s: false, pay_stripe_sdk_s: false, pay_currency_mark: '¥', pay_currency_unit: '元', pay_wechat_settle: { settle_rate: '1', settle_mark: '¥', settle_unit: '元' }, pay_alipay_settle: { settle_rate: '1', settle_mark: '¥', settle_unit: '元' }, pay_sdk_custom_title_s: false, pay_sdk_custom_title: '', payment_order_expiry: 30, pay_wait_float_s: true, pay_sdk_order: {}, alipay_appid: '', alipay_privatekey: '', alipay_payment_type: 'page', alipay_app_public_cert_path: '', alipay_public_cert_path: '', alipay_root_cert_path: '', wechat_merchantid: '', wechat_appid: '', wechat_payment_type: 'native', wechat_api_v3_key: '', wechat_private_key_path: '', wechat_cert_path: '', paypal_client_id: '', paypal_client_secret: '', paypal_currency: 'USD', paypal_rates: '0.14', paypal_sandbox: false, stripe_secret_key: '', stripe_publishable_key: '', stripe_webhook_secret: '', stripe_currency: 'USD', stripe_rates: '0.14', stripe_test_mode: false, epay_apiurl: '', epay_pid: '', epay_key: '', epay_device: 'auto', }, groups: [ { key: 'notice', title: '说明', icon: 'fa fas fa-info-circle', fields: [ { key: 'gateway_notice', label: '', type: 'content', ui_only: true, content: '', }, ], }, { key: 'channels', title: '收款接口选择', icon: 'fa fas fa-toggle-on', description: '微信与支付宝各选一种接入方式;选「易支付」后需在下方易支付配置块填写接口信息。', fields: [ { key: 'pay_wechat_sdk_options', label: '微信收款接口', type: 'select', default: 'null', options: [ { label: '微信官方', value: 'official_wechat' }, { label: '易支付-微信', value: 'epay' }, { label: '关闭微信收款', value: 'null' }, ], }, { key: 'pay_alipay_sdk_options', label: '支付宝收款接口', type: 'select', default: 'null', options: [ { label: '支付宝企业支付/当面付', value: 'official_alipay' }, { label: '易支付-支付宝', value: 'epay' }, { label: '关闭支付宝收款', value: 'null' }, ], }, { key: 'pay_paypal_sdk_s', label: 'PayPal支付(贝宝)', type: 'switch', default: false, help: '启用后请在下方配置参数' }, { key: 'pay_stripe_sdk_s', label: 'Stripe支付', type: 'switch', default: false, help: '启用后请在下方配置参数' }, ], }, { key: 'currency', title: '货币与结算', icon: 'fa fas fa-coins', fields: [ { key: 'pay_currency_mark', label: '本地货币符号', type: 'input', default: '¥', help: '显示在金额前面(例如 $ 或 ¥)' }, { key: 'pay_currency_unit', label: '本地货币单位名称', type: 'input', default: '元', help: '金额后缀,例如:人民币填「元」、美元填「dollars」' }, { key: 'pay_wechat_settle', label: '微信结算配置', type: 'fieldset', default: { settle_rate: '1', settle_mark: '¥', settle_unit: '元' }, fields: [ { key: 'settle_rate', label: '结算汇率', type: 'input', default: '1' }, { key: 'settle_mark', label: '结算货币符号', type: 'input', default: '¥' }, { key: 'settle_unit', label: '结算货币单位', type: 'input', default: '元' }, ], }, { key: 'pay_alipay_settle', label: '支付宝结算配置', type: 'fieldset', default: { settle_rate: '1', settle_mark: '¥', settle_unit: '元' }, fields: [ { key: 'settle_rate', label: '结算汇率', type: 'input', default: '1' }, { key: 'settle_mark', label: '结算货币符号', type: 'input', default: '¥' }, { key: 'settle_unit', label: '结算货币单位', type: 'input', default: '元', help: '如果接入的收款方式与本地的货币类型不同,则在此配置结算汇率及单位' }, ], }, { key: 'pay_sdk_custom_title_s', label: '自定义收款标题', type: 'switch', default: false, help: '默认为付款类型加网站名,如需自定义请开启' }, { key: 'pay_sdk_custom_title', label: '自定义收款标题', type: 'input', default: '', dependsOn: { key: 'pay_sdk_custom_title_s', value: true }, help: '可使用变量:订单类型 %order_type%,例如:%order_type%-AKSRT;注意控制总长度,太长会导致部分接口报错' }, ], }, { key: 'order', title: '订单与编号', icon: 'fa fas fa-hashtag', description: '订单支付时效与浮窗提示;订单、资金流水与提现的流水号由系统统一自动分配,无需配置。', fields: [ { key: 'payment_order_expiry', label: '订单支付时效(分钟)', type: 'number', default: 30, min: 5, max: 1440, help: '用户下单后,最大支付时间,超过后订单将自动关闭(不能低于5分钟)' }, { key: 'pay_wait_float_s', label: '浮窗显示待支付订单', type: 'switch', default: true, help: '将用户待支付订单一直显示在右上角,提醒用户付款' }, ], }, { key: 'sdk-order', title: '收款接口显示顺序', icon: 'fa fas fa-sort-amount-down', fields: [ { key: 'pay_sdk_order', label: '显示顺序', type: 'sortable', default: {}, items: [ { key: 'wechat', label: '微信' }, { key: 'alipay', label: '支付宝' }, { key: 'paypal', label: 'PayPal(贝宝)' }, { key: 'stripe', label: 'Stripe' }, { key: 'balance', label: '余额' }, { key: 'card_pass', label: '卡密' }, ], help: '收银台支付方式显示顺序;仅显示已开启的接口', }, ], }, { key: 'alipay', title: '支付宝官方', icon: 'fa fas fa-credit-card', description: '支付宝官方接口(当面付 / 网站应用)。', collapsible: true, expandWhen: 'pay_alipay_sdk_options', dependsOn: { key: 'pay_alipay_sdk_options', value: 'official_alipay' }, fields: [ { key: 'alipay_notice', label: '', type: 'content', ui_only: true, content: '', }, { key: 'alipay_appid', label: '当面付:APPID', type: 'input', default: '' }, { key: 'alipay_privatekey', label: '当面付:应用私钥', type: 'textarea', sanitize_type: 'code', default: '', rows: 4 }, { key: 'alipay_payment_type', label: '支付方式', type: 'select', default: 'page', options: [ { label: '电脑网站支付(web)', value: 'page' }, { label: '手机网站支付(wap)', value: 'wap' }, ], }, { key: 'alipay_app_public_cert_path', label: '应用公钥证书路径', type: 'input', default: '', help: 'appCertPublicKey.crt 绝对路径。' }, { key: 'alipay_public_cert_path', label: '支付宝公钥证书路径', type: 'input', default: '', help: 'alipayCertPublicKey_RSA2.crt 绝对路径。' }, { key: 'alipay_root_cert_path', label: '支付宝根证书路径', type: 'input', default: '', help: 'alipayRootCert.crt 绝对路径。' }, ], }, { key: 'wechat', title: '微信官方', icon: 'fa fab fa-weixin', description: '微信企业支付官方接口。', collapsible: true, expandWhen: 'pay_wechat_sdk_options', dependsOn: { key: 'pay_wechat_sdk_options', value: 'official_wechat' }, fields: [ { key: 'wechat_notice', label: '', type: 'content', ui_only: true, content: '', }, { key: 'wechat_merchantid', label: '商户号 PartnerID', type: 'input', default: '' }, { key: 'wechat_appid', label: '授权绑定的AppID', type: 'input', default: '' }, { key: 'wechat_payment_type', label: '支付方式', type: 'select', default: 'native', options: [ { label: '扫码支付(Native)', value: 'native' }, { label: 'H5支付', value: 'h5' }, ], }, { key: 'wechat_api_v3_key', label: '支付APIv3密钥', type: 'input', default: '', help: '微信商户平台设置的 APIv3 密钥(32位)。' }, { key: 'wechat_private_key_path', label: '商户私钥路径', type: 'input', default: '', help: 'apiclient_key.pem 绝对路径,用于签名。' }, { key: 'wechat_cert_path', label: '商户API证书路径', type: 'input', default: '', help: 'apiclient_cert.pem 绝对路径。' }, ], }, { key: 'paypal', title: 'PayPal(贝宝)', icon: 'fa fab fa-paypal', description: '常见的海外支付接口。', collapsible: true, expandWhen: 'pay_paypal_sdk_s', dependsOn: { key: 'pay_paypal_sdk_s', value: true }, fields: [ { key: 'paypal_notice', label: '', type: 'content', ui_only: true, content: '', }, { key: 'paypal_client_id', label: 'Client ID', type: 'input', default: '' }, { key: 'paypal_client_secret', label: 'Client Secret', type: 'input', default: '' }, { key: 'paypal_currency', label: '结算货币', type: 'select', case_insensitive: true, default: 'USD', options: currencyOptions }, { key: 'paypal_rates', label: '货币汇率', type: 'input', default: '0.14', help: '根据你选择的货币类型与您定价货币的汇率进行填写,例如1元人民币兑换0.137美元(USD),则此处填0.137' }, { key: 'paypal_sandbox', label: '沙盒调试模式', type: 'switch', default: false, help: '沙箱模式(Sandbox)是PayPal支付的测试环境。开启后请使用沙箱环境生成的收款账户和付款账户进行测试。' }, ], }, { key: 'stripe', title: 'Stripe', icon: 'fa fab fa-cc-stripe', description: '常见的海外信用卡收款接口。', collapsible: true, expandWhen: 'pay_stripe_sdk_s', dependsOn: { key: 'pay_stripe_sdk_s', value: true }, fields: [ { key: 'stripe_notice', label: '', type: 'content', ui_only: true, content: '', }, { key: 'stripe_secret_key', label: '私钥Secret Key', type: 'input', default: '', help: 'Stripe Dashboard → Developers → API keys → Secret key' }, { key: 'stripe_publishable_key', label: 'Publishable Key', type: 'input', default: '' }, { key: 'stripe_webhook_secret', label: '签名密钥Webhook Secret', type: 'input', default: '', help: 'Developers → Webhooks → 端点 → Signing secret(whsec_ 开头)' }, { key: 'stripe_currency', label: '结算货币', type: 'select', case_insensitive: true, default: 'USD', options: currencyOptions }, { key: 'stripe_rates', label: '货币汇率', type: 'input', default: '0.14', help: '根据你选择的货币类型与您定价货币的汇率进行填写,例如1元人民币兑换0.137美元(USD),则此处填0.137' }, { key: 'stripe_test_mode', label: '测试模式', type: 'switch', default: false, help: '如果使用的测试开放模式,则请使用 sk_test_ 测试密钥与 Stripe 测试卡进行配置' }, ], }, { key: 'epay', title: '易支付', icon: 'fa fas fa-university', description: '易支付(彩虹协议)聚合收银台;通道由上方微信/支付宝接口选择控制。', collapsible: true, expandWhen: 'pay_wechat_sdk_options', dependsOn: { any: [ { key: 'pay_wechat_sdk_options', value: 'epay' }, { key: 'pay_alipay_sdk_options', value: 'epay' }, ], }, fields: [ { key: 'epay_notice', label: '', type: 'content', ui_only: true, content: '', }, { key: 'epay_apiurl', label: 'API接口网址', type: 'input', default: '', help: '请填写接口地址,例如:https://pay.xxxxxxx.cn/' }, { key: 'epay_pid', label: '商户号', type: 'input', default: '' }, { key: 'epay_key', label: '商户秘钥', type: 'input', default: '', help: 'MD5 通信密钥。' }, { key: 'epay_device', label: '下单终端', type: 'select', default: 'auto', options: [ { label: '自动(按 UA)', value: 'auto' }, { label: '电脑端 submit', value: 'pc' }, { label: '移动端 mapi', value: 'mobile' }, ], }, ], }, ], }