From bc9db06646fc925635dd5995d521bcf9fd05aa93 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期五, 21 二月 2025 16:35:04 +0800
Subject: [PATCH] fix: 对接
---
packages/components/src/utils/lifeRechargeServices.ts | 184 ++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 177 insertions(+), 7 deletions(-)
diff --git a/packages/components/src/utils/lifeRechargeServices.ts b/packages/components/src/utils/lifeRechargeServices.ts
index 7493a37..f8f6b2b 100644
--- a/packages/components/src/utils/lifeRechargeServices.ts
+++ b/packages/components/src/utils/lifeRechargeServices.ts
@@ -1,12 +1,6 @@
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
import { IRequest, BlLifeRechargeServicesOptions } from './types';
-
-export interface PhoneMesssageCodeLoginInput {
- /** 鎵嬫満鍙� */
- phoneNumber: string;
- /** 楠岃瘉鐮� */
- code: string;
-}
+import { LifeRechargeConstants } from './lifeRechargeConstants';
export interface RequestConfig {}
@@ -26,4 +20,180 @@
...(options || {}),
});
}
+
+ /** 鑾峰彇鎶樻墸 GET /api/LifePay/GetRate */
+ async getRate(options?: RequestConfig) {
+ return this.request<LifePayRateListOutput[]>('/api/LifePay/GetRate', {
+ method: 'GET',
+ ...(options || {}),
+ });
+ }
+
+ /** 鑾峰彇鐢佃垂闈㈠�� GET /api/LifePay/GetElectricParValue */
+ async getElectricParValue(options?: RequestConfig) {
+ return this.request<ElectricParValueResponse>('/api/LifePay/GetElectricParValue', {
+ method: 'GET',
+ ...(options || {}),
+ });
+ }
+
+ /** 鑾峰彇璇濊垂闈㈠�� GET /api/LifePay/GetPhoneParValue */
+ async getPhoneParValue(options?: RequestConfig) {
+ return this.request<PhoneParValueResponse>('/api/LifePay/GetPhoneParValue', {
+ method: 'GET',
+ ...(options || {}),
+ });
+ }
+
+ /** 鍒涘缓鐢熸椿缂磋垂璇濊垂璁㈠崟 POST /api/LifePay/CreateLifePayPhoneOrder */
+ async createLifePayPhoneOrder(
+ body: LifePhoneDataCreateLifePayOrderInput,
+ options?: RequestConfig
+ ) {
+ return this.request<CreateLifePayOrderOutput>('/api/LifePay/CreateLifePayPhoneOrder', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ data: body,
+ ...(options || {}),
+ });
+ }
+
+ /** 鍒涘缓鐢熸椿缂磋垂鐢佃垂璁㈠崟 POST /api/LifePay/CreateLifePayElectricOrder */
+ async createLifePayElectricOrder(
+ body: LifeElectricDataCreateLifePayOrderInput,
+ options?: RequestConfig
+ ) {
+ return this.request<CreateLifePayOrderOutput>('/api/LifePay/CreateLifePayElectricOrder', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ data: body,
+ ...(options || {}),
+ });
+ }
+
+ /** 鏍规嵁璁㈠崟鍙疯幏鍙栨敮浠樼姸鎬� GET /api/LifePay/GetPayStatusByOrderNo */
+ async getPayStatusByOrderNo(params: APIgetPayStatusByOrderNoParams, options?: RequestConfig) {
+ return this.request<LifeRechargeConstants.LifePayStatusEnum>(
+ '/api/LifePay/GetPayStatusByOrderNo',
+ {
+ method: 'GET',
+ params: {
+ ...params,
+ },
+ ...(options || {}),
+ }
+ );
+ }
+}
+
+export interface PhoneMesssageCodeLoginInput {
+ /** 鎵嬫満鍙� */
+ phoneNumber: string;
+ /** 楠岃瘉鐮� */
+ code: string;
+}
+
+export interface LifePayRateListOutput {
+ rateType?: LifeRechargeConstants.LifePayRateTypeEnum;
+ rate?: number;
+}
+
+export interface ElectricParValueResponse {
+ success?: string;
+ requestNo?: string;
+ partnerId?: string;
+ service?: string;
+ version?: string;
+ protocol?: string;
+ context?: string;
+ ext?: string;
+ code?: string;
+ message?: string;
+ detail?: string;
+ electricParValue?: ElectricParValueOutput[];
+}
+
+export interface ElectricParValueOutput {
+ electricType?: string;
+ areaName?: string;
+ parValue?: string;
+ rate?: number;
+ comments?: string;
+}
+
+export interface PhoneParValueResponse {
+ success?: string;
+ requestNo?: string;
+ partnerId?: string;
+ service?: string;
+ version?: string;
+ protocol?: string;
+ context?: string;
+ ext?: string;
+ code?: string;
+ message?: string;
+ detail?: string;
+ phoneParValue?: PhoneParValueOutput[];
+}
+
+export interface PhoneParValueOutput {
+ ispCode?: string;
+ ispName?: string;
+ parValue?: string;
+ rate?: number;
+ phoneSection?: string;
+ comments?: string;
+}
+
+export interface LifePhoneDataCreateLifePayOrderInput {
+ userId?: string;
+ lifePayType?: LifeRechargeConstants.LifePayTypeEnum;
+ productData?: LifePhoneData;
+}
+
+export interface LifePhoneData {
+ /** 杩愯惀鍟嗙紪鐮侊紝渚嬪锛�"yidong", "dianxin", "liantong"銆� */
+ ispCode: string;
+ /** 鍏呭�奸潰棰濓紝鍗曚綅涓哄厓銆傛祴璇曡处鎴凤細parValue=100:缂磋垂鎴愬姛锛宲arValue>100锛氱即璐瑰け璐ャ�� */
+ parValue: number;
+ /** 鎵嬫満鍙枫�� */
+ phone: string;
+ /** 鏈轰富鍚嶇О(鐢典俊鎵嬫満鍙峰繀濉�) */
+ name?: string;
+}
+
+export interface CreateLifePayOrderOutput {
+ orderNo?: string;
+ payUrl?: string;
+}
+
+export interface LifeElectricDataCreateLifePayOrderInput {
+ userId?: string;
+ lifePayType?: LifeRechargeConstants.LifePayTypeEnum;
+ productData?: LifeElectricData;
+}
+
+export interface LifeElectricData {
+ /** 鍏呭�奸潰棰濓紝鍗曚綅涓哄厓銆� */
+ parValue: number;
+ /** 鐢电綉绫诲瀷锛屼緥濡傦細"guowang"浠h〃鍥藉鐢电綉锛�"nanwang"浠h〃鍗楁柟鐢电綉銆� */
+ electricType: string;
+ /** 鐢佃垂绫诲瀷锛屽浗缃戝繀浼狅細浣忓畢銆佷紒浜嬩笟銆佸簵閾轰笁涓�夐」銆� */
+ electricAccountType: string;
+ /** 鐢佃垂鎴峰彿銆� */
+ electricAccount: string;
+ /** 鐪佷唤銆� */
+ province: string;
+ /** 鍩庡競銆� */
+ city: string;
+ /** 瀹㈡埛韬唤璇佸悗6浣嶏紝鍗楃綉蹇呬紶銆� */
+ sixID?: string;
+}
+
+export interface APIgetPayStatusByOrderNoParams {
+ orderNo?: string;
}
--
Gitblit v1.9.1