Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@chuxingpay/junting-sdk

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chuxingpay/junting-sdk - npm Package Compare versions

Comparing version
1.0.2
to
1.0.3
+25
-36
lib/sdk.js

@@ -80,4 +80,4 @@ 'use strict'

HotelCity: '',
StartDate: StartDate ? StartDate : '2000-01-01T00:00:00.00Z',
EndDate: EndDate ? EndDate : '2222-01-01T00:00:00.000Z',
StartDate: StartDate ? StartDate : moment().startOf('day').add(0, 'days').format('YYYY-MM-DD'),
EndDate: EndDate ? EndDate : moment().startOf('day').add(89, 'days').format('YYYY-MM-DD'),
Status: '',

@@ -110,4 +110,4 @@ Id: 0,

HotelCity: '',
StartDate: StartDate ? StartDate : '2000-01-01T00:00:00.00Z',
EndDate: EndDate ? EndDate : '2222-01-01T00:00:00.000Z',
StartDate: StartDate ? StartDate : moment().startOf('day').add(0, 'days').format('YYYY-MM-DD'),
EndDate: EndDate ? EndDate : moment().startOf('day').add(89, 'days').format('YYYY-MM-DD'),
Status: '',

@@ -127,3 +127,3 @@ Id: 0,

*/
async getHotelRoomTypeList(GroupCode, HotelCode, ChannelCode) {
async getHotelRoomTypeList(GroupCode, HotelCode, ChannelCode, pageIndex, pageSize) {
if (!GroupCode) throw new Error('GroupCode is required')

@@ -134,3 +134,3 @@ if (!HotelCode) throw new Error('HotelCode is required')

ChannelCode: ChannelCode,
Status: '',
Status: 'A',
Id: 0,

@@ -141,4 +141,4 @@ GroupCode: GroupCode,

DescFields: '',
pageIndex: 0,
pageSize: 100
pageIndex: pageIndex ? pageIndex : 0,
pageSize: pageSize ? pageSize : 100
}

@@ -149,3 +149,3 @@ return this.request.post(uri, query)

/**
* 房型基础信息
* 房型基础信息 接口不存在
* @param {Date} StartDate 非必填 默认2000

@@ -180,4 +180,4 @@ * @param {Date} EndDate 非必填 默认

* 获取酒店房价列表
* @param {Date} StartDate 非必填 默认
* @param {Date} EndDate 非必填 默认
* @param {Date} StartDate 非必填 默认今天
* @param {Date} EndDate 非必填 默认今天+89
* @param {String} ChannelCode 必填 渠道编码

@@ -206,6 +206,3 @@ * @param {String} RateCode 必填 房价码

AscFields: '',
DescFields: '',
pageIndex: 0,
pageSize: 100
}
DescFields: ''}
return this.request.post(uri, query)

@@ -216,4 +213,4 @@ }

* 获取房价变化增量列表
* @param {Date} StartDate 非必填 默认
* @param {Date} EndDate 非必填 默认
* @param {Date} StartDate 非必填 默认今天
* @param {Date} EndDate 非必填 默认今天+89
* @param {String} ChannelCode 必填 渠道编码

@@ -243,5 +240,3 @@ * @param {String} RateCode 必填 房价码

AscFields: '',
DescFields: '',
pageIndex: 0,
pageSize: 100
DescFields: ''
}

@@ -254,9 +249,9 @@ return this.request.post(uri, query)

* 获取酒店库存
* @param {Date} StartDate 非必填 默认
* @param {Date} EndDate 非必填 默认
* @param {Date} StartDate 非必填 默认今天
* @param {Date} EndDate 非必填 默认今天+89
* @param {String} ChannelCode 必填 渠道编码
* @param {String} RateCode 必填 房价码
* @param {String} RateCode 非必填 房价码
* @param {String} HotelCode 必填 酒店code
* @param {String} GroupCode 必填 集团code
* @param {String} RoomType 必填 房型code
* @param {String} RoomType 非必填 房型code
* @returns Response

@@ -267,3 +262,2 @@ */

if (!HotelCode) throw new Error('HotelCode is required')
if (!RoomType) throw new Error('RoomType is required')
if (!ChannelCode) throw new Error('ChannelCode is required')

@@ -273,13 +267,8 @@ const uri = '/Cms/GetRoomStockList'

ChannelCode: ChannelCode,
StartDate: StartDate ? StartDate : '2020-03-18T09:31:07.305Z',
EndDate: EndDate ? EndDate : '2020-03-19T09:31:07.305Z',
RoomType: RoomType,
StartDate: StartDate ? StartDate : moment().startOf('day').add(0, 'days').format('YYYY-MM-DD'),
EndDate: EndDate ? EndDate : moment().startOf('day').add(89, 'days').format('YYYY-MM-DD'),
RoomType: RoomType?RoomType:'',
RateCode: RateCode?RateCode:'',
//Id: 0,
GroupCode: GroupCode,
HotelCode: HotelCode,
//AscFields: '',
//DescFields: '',
//pageIndex: 0,
//pageSize: 100
HotelCode: HotelCode
}

@@ -385,6 +374,6 @@ return this.request.post(uri, query)

NoofDays: NoofDays,
Status: Status,
Status: 'R',
Remarks: Remarks ? Remarks : '',
CreateUser: CreateUser ? CreateUser : '',
CreateDate: CreateDate ? CreateDate : Date.now(),
CreateDate: CreateDate ? CreateDate : moment().startOf('day').add(0, 'days').format('YYYY-MM-DD'),
SalesId: SalesId,

@@ -391,0 +380,0 @@ TotalAmount: TotalAmount,

{
"name": "@chuxingpay/junting-sdk",
"version": "1.0.2",
"version": "1.0.3",
"description": "",

@@ -5,0 +5,0 @@ "author": "anxing <chuanxing.huang@chuxingpay.com>",

@@ -10,3 +10,3 @@ const { expect } = require('chai')

let RoomType
let BusinessDate,Id,amount
let BusinessDate,Id,amount,orderNo
before(async function () {

@@ -19,3 +19,3 @@ await sdk.initReuqest()

//OK
//OK 酒店列表
describe('getHotelList', async () => {

@@ -29,3 +29,3 @@ it('should be run success', async () => {

//OK
//OK 酒店详情
describe('getHotelInfo', async () => {

@@ -38,3 +38,3 @@ it('should be run success', async () => {

//OK
//OK 房型列表
describe('getHotelRoomTypeList', async () => {

@@ -49,11 +49,3 @@ it('should be run success', async () => {

//接口不存在 房型详情
describe.skip('getRoomTypeInfo', async () => {
it('should be run success', async () => {
let res = await sdk.getRoomTypeInfo(config.jtTConfig.GroupCode, config.jtTConfig.HotelCode, RoomType, config.jtTConfig.ChannelCode)
expect(res.Code).to.eql(0)
})
})
//todo 房量
//OK 房态
describe('getHotelInventoryList', async () => {

@@ -63,6 +55,6 @@ it('should be run success', async () => {

config.jtTConfig.ChannelCode,
RoomType,
'',
'',
config.jtTConfig.GroupCode, config.jtTConfig.HotelCode)
console.log('=======房量========',res.Data.length)
console.log('=======房量========',res.Data.length,res.Data[0])
expect(res.Code).to.eql(0)

@@ -102,3 +94,3 @@ })

//YES
//YES 预试订单
describe('createTrialOrder', async () => {

@@ -125,3 +117,2 @@ it('should be run success', async () => {

it('should be run success', async () => {
console.log('======================================',RoomType,BusinessDate,amount)
let res = await sdk.createOrder(

@@ -138,5 +129,5 @@ 'test',

0,
'VIP1',
'',
'',
'',
'BRK1',

@@ -146,7 +137,7 @@ '',

config.jtTConfig.ChannelCode,
moment().startOf('day').add(0, 'days').format('YYYY-MM-DD'),
moment().startOf('day').add(1, 'days').format('YYYY-MM-DD'),
moment().startOf('day').add(2, 'days').format('YYYY-MM-DD'),
'18:00',
1,
'A',
'R',
'',

@@ -160,8 +151,8 @@ '',

'ChannelCode': config.jtTConfig.ChannelCode,
'BusinessDate': '2020-03-19T00:00:00',
'RoomType': 'BDKS',
'BusinessDate': moment().startOf('day').add(1, 'days').format('YYYY-MM-DD hh:mm:ss'),
'RoomType': RoomType,
'RoomTypeAlias': null,
'RateCode': 'VIP1',
'RoomRate': 2888,
'ActualRate': 2888,
'RoomRate': amount,
'ActualRate': amount,
'IsContainBreakfast': false,

@@ -177,5 +168,5 @@ 'PackeagesCode': 'NET',

'BatchContent': {},
'BusinessDateText': '03月13日',
'RoomPrice': 11,
'ActualRateText': '¥11'
'BusinessDateText': '',
'RoomPrice': amount,
'ActualRateText': ''
}

@@ -189,2 +180,3 @@ ],

console.log('======res==============', res)
orderNo = res.Data.UnionSerial
expect(res.Code).to.eql(0)

@@ -194,12 +186,9 @@ })

describe('cancelOrder', async () => {
describe('queryOrder', async () => {
it('should be run success', async () => {
let res = await sdk.cancelOrder(
'180313142504941032',
let res = await sdk.queryOrder(
orderNo,
'',
'xhy',
'2018-03-13T01:32:11.928Z',
config.jtTConfig.GroupCode,
config.jtTConfig.HotelCode,
'xhy'
config.jtTConfig.HotelCode
)

@@ -211,9 +200,13 @@ console.log('======res==============', res)

describe('queryOrder', async () => {
describe('cancelOrder', async () => {
it('should be run success', async () => {
let res = await sdk.queryOrder(
'180313113407796135',
let res = await sdk.cancelOrder(
orderNo,
'',
'test',
moment().startOf('day').add(1, 'days').format('YYYY-MM-DD hh:mm:ss'),
config.jtTConfig.GroupCode,
config.jtTConfig.HotelCode
config.jtTConfig.HotelCode,
'xhy'
)

@@ -225,12 +218,12 @@ console.log('======res==============', res)

describe('prepayOrder', async () => {
describe.skip('prepayOrder', async () => {
it('should be run success', async () => {
let res = await sdk.prepayOrder(
'180313113407796135',
'klas',
100,
orderNo,
'VIP1',
amount,
3,
'',
'dasd',
'xhy',
Date.now(),
moment().startOf('day').add(1, 'days').format('YYYY-MM-DD hh:mm:ss'),
config.jtTConfig.GroupCode,

@@ -244,4 +237,2 @@ config.jtTConfig.HotelCode,

})
})