import { BlLifeRechargeServicesOptions } from './types';
|
import { LifeRechargeConstants } from './lifeRechargeConstants';
|
import { Request, IRequest } from 'senior-request';
|
|
export interface RequestConfig {}
|
|
export class BlLifeRechargeServices<TResponse = any, TRequestOptions = any> {
|
private request: IRequest;
|
constructor({ axiosConfig }: BlLifeRechargeServicesOptions<TResponse, TRequestOptions>) {
|
this.request = Request.create(axiosConfig);
|
}
|
|
async lifePayPhoneMesssageCodeLogin(body: PhoneMesssageCodeLoginInput, options?: RequestConfig) {
|
return this.request<string>('/api/Account/LifePayPhoneMesssageCodeLogin', {
|
method: 'POST',
|
headers: {
|
'Content-Type': 'application/json',
|
},
|
data: body,
|
...(options || {}),
|
});
|
}
|
|
/** 获取折扣 GET /api/LifePay/GetRate */
|
async getRate(options?: RequestConfig) {
|
return this.request<LifePayRateListOutput[]>('/api/LifePay/GetRate', {
|
method: 'GET',
|
...(options || {}),
|
});
|
}
|
|
/** 获取电费充值区域 GET /api/LifePay/GetElectricSupportArea */
|
async getElectricSupportArea(options?: RequestConfig) {
|
return this.request<ElectricSupportAreaResponse>('/api/LifePay/GetElectricSupportArea', {
|
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 || {}),
|
}
|
);
|
}
|
|
async setLifePayOrderPayType(body: SetLifePayOrderPayTypeInput, options?: RequestConfig) {
|
return this.request<string>('/api/LifePay/SetLifePayOrderPayType', {
|
method: 'POST',
|
headers: {
|
'Content-Type': 'application/json',
|
},
|
data: body,
|
...(options || {}),
|
});
|
}
|
|
/** 获取我的订单分页数据 POST /api/LifePay/GetUserLifePayOrderPage */
|
async getUserLifePayOrderPage(body: QueryLifePayOrderListInput, options?: RequestConfig) {
|
return this.request<UserLifePayOrderOutputPageOutput>('/api/LifePay/GetUserLifePayOrderPage', {
|
method: 'POST',
|
headers: {
|
'Content-Type': 'application/json',
|
},
|
data: body,
|
...(options || {}),
|
});
|
}
|
|
/** 获取生活缴费用户身份会话信息 GET /api/Account/GetLifePayWxIndentity */
|
async getLifePayWxIndentity(
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
params: APIgetLifePayWxIndentityParams,
|
options?: RequestConfig
|
) {
|
return this.request<WxMiniAppIndentityInfo>('/api/Account/GetLifePayWxIndentity', {
|
method: 'GET',
|
params: {
|
...params,
|
},
|
...(options || {}),
|
});
|
}
|
|
/** 获取微信支付的JSAPI POST /api/LifePay/GetPayOrderForJsAPI */
|
async getPayOrderForJsAPI(body: GetPayOrderForJsAPIInput, options?: RequestConfig) {
|
return this.request<ModelPaymentMiniPay>('/api/LifePay/GetPayOrderForJsAPI', {
|
method: 'POST',
|
headers: {
|
'Content-Type': 'application/json',
|
},
|
data: body,
|
...(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?: boolean;
|
requestNo?: string;
|
partnerId?: string;
|
service?: string;
|
version?: string;
|
protocol?: string;
|
context?: string;
|
ext?: any;
|
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;
|
productData?: LifePhoneData;
|
}
|
|
export interface LifePhoneData {
|
/** 运营商编码,例如:"yidong", "dianxin", "liantong"。 */
|
ispCode: string;
|
/** 充值面额,单位为元。测试账户:parValue=100:缴费成功,parValue>100:缴费失败。 */
|
parValue: number;
|
/** 手机号。 */
|
phone: string;
|
/** 机主名称(电信手机号必填) */
|
name?: string;
|
}
|
|
export interface CreateLifePayOrderOutput {
|
orderNo?: string;
|
}
|
|
export interface LifeElectricDataCreateLifePayOrderInput {
|
userId?: string;
|
productData?: LifeElectricData;
|
}
|
|
export interface LifeElectricData {
|
/** 充值面额,单位为元。 */
|
parValue: number;
|
/** 电网类型,例如:"guowang"代表国家电网,"nanwang"代表南方电网。 */
|
electricType: string;
|
/** 电费类型,国网必传:住宅、企事业、店铺三个选项。 */
|
electricAccountType: string;
|
/** 电费户号。 */
|
electricAccount: string;
|
/** 省份。 */
|
province: string;
|
/** 城市。 */
|
city: string;
|
/** 客户身份证后6位,南网必传。 */
|
sixID?: string;
|
}
|
|
export interface APIgetPayStatusByOrderNoParams {
|
orderNo?: string;
|
}
|
|
export interface SetLifePayOrderPayTypeInput {
|
orderNo: string;
|
lifePayType?: LifeRechargeConstants.LifePayTypeEnum;
|
}
|
|
export interface QueryLifePayOrderListInput {
|
pageModel?: Pagination;
|
lifePayOrderType?: LifeRechargeConstants.LifePayOrderTypeEnum;
|
/** 开始支付时间 */
|
beginPayTime?: string;
|
/** 结束支付时间 */
|
endPayTime?: string;
|
payStatus?: LifeRechargeConstants.LifePayStatusEnum;
|
lifePayOrderStatus?: LifeRechargeConstants.LifePayOrderStatusEnum;
|
/** 开始完成时间 */
|
beginFinishTime?: string;
|
/** 结束完成时间 */
|
endFinishTime?: string;
|
/** 用户Id */
|
userId?: string;
|
}
|
|
export interface Pagination {
|
rows?: number;
|
page?: number;
|
orderInput?: OrderInput[];
|
totalCount?: number;
|
totalPage?: number;
|
}
|
|
export interface OrderInput {
|
property?: string;
|
order?: any;
|
}
|
|
export interface UserLifePayOrderOutputPageOutput {
|
pageModel?: Pagination;
|
objectData?: any;
|
data?: UserLifePayOrderOutput[];
|
}
|
|
export interface UserLifePayOrderOutput {
|
id?: string;
|
lifePayType?: LifeRechargeConstants.LifePayTypeEnum;
|
lifePayOrderType?: LifeRechargeConstants.LifePayOrderTypeEnum;
|
/** 订单号 */
|
orderNo?: string;
|
/** 充值金额 */
|
rechargeAmount?: number;
|
/** 优惠金额 */
|
discountAmount?: number;
|
/** 实付金额 */
|
payAmount?: number;
|
/** 支付时间 */
|
payTime?: string;
|
payStatus?: LifeRechargeConstants.LifePayStatusEnum;
|
lifePayOrderStatus?: LifeRechargeConstants.LifePayOrderStatusEnum;
|
/** 完成时间 */
|
finishTime?: string;
|
/** 订单详细数据 */
|
orderParamDetailJsonStr?: string;
|
/** 下单时间 */
|
creationTime?: string;
|
/** 退款时间 */
|
refundTime?: string;
|
}
|
|
export interface ElectricSupportAreaResponse {
|
success?: boolean;
|
requestNo?: string;
|
partnerId?: string;
|
service?: string;
|
version?: string;
|
protocol?: string;
|
context?: string;
|
ext?: any;
|
code?: string;
|
message?: string;
|
detail?: string;
|
electricAreaList?: ElectricSupportAreaListOutput[];
|
}
|
|
export interface ElectricSupportAreaListOutput {
|
childCityList?: ElectricSupportAreaChildCityListOutput[];
|
cityName?: string;
|
cityParentId?: string;
|
ciytId?: string;
|
electricType?: string;
|
parValue?: string[];
|
rate?: number;
|
}
|
|
export interface ElectricSupportAreaChildCityListOutput {
|
cityName?: string;
|
cityParentId?: string;
|
ciytId?: string;
|
}
|
export interface APIgetLifePayWxIndentityParams {
|
/** 用户登录凭证 */
|
code?: string;
|
}
|
|
export interface WxMiniAppIndentityInfo {
|
/** 会话密钥 */
|
sessionKey?: string;
|
/** 小程序OpenId */
|
openId?: string;
|
/** 用户名(该值为空则需手机授权登录,不为空则已有该小程序用户) */
|
userName?: string;
|
unionId?: string;
|
}
|
|
export interface GetPayOrderForJsAPIInput {
|
orderNo: string;
|
lifePayType?: LifeRechargeConstants.LifePayTypeEnum;
|
openId?: string;
|
attach?: string;
|
}
|
|
export interface ModelPaymentMiniPay {
|
nonceStr?: string;
|
package?: string;
|
signType?: string;
|
paySign?: string;
|
timestamp?: string;
|
timeExpire?: string;
|
message?: string;
|
}
|