@chuxingpay/dongcheng
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -10,6 +10,6 @@ const Teambition = require('teambition') | ||
class Request extends Teambition { | ||
constructor ( apiHost, dctoken) { | ||
constructor(apiHost, dctoken) { | ||
const protocol = apiHost.startsWith('https:') ? 'https' : 'http' | ||
const temp = _.split(apiHost, `${protocol}://`) | ||
const host = temp.length === 1 ? temp[0] : temp[1] | ||
const host = temp.length === 1 ? temp[0] : temp[1] | ||
super(null, { | ||
@@ -36,3 +36,3 @@ token: dctoken, | ||
*/ | ||
invokeGeneric (method, apiURL, params, callback) { | ||
invokeGeneric(method, apiURL, params, callback) { | ||
let headers = {} | ||
@@ -50,3 +50,3 @@ if (typeof params === 'function') { | ||
// 'clientCode': this.clientCode, | ||
'token': this.dctoken, | ||
token: this.dctoken, | ||
timestamp: this.timestamp | ||
@@ -99,6 +99,3 @@ // 'sign': this.sign | ||
} else { | ||
resolve( | ||
this.resolveWithFullResponse | ||
? resp | ||
: body) | ||
resolve(this.resolveWithFullResponse ? resp : body) | ||
} | ||
@@ -105,0 +102,0 @@ }) |
@@ -223,5 +223,22 @@ const debug = require('debug')('DongchengSDK') | ||
* @param {String} SumPrice 总价 必填 | ||
* @param {String} ActivityCode 活动码 | ||
* @param {String} AgreementNo 协议号 | ||
* @param {String} CouponCode 优惠券 | ||
* @returns Response | ||
*/ | ||
async createOrder(HotelID, RoomTypeID, MebName, Tel, Num, CheckInDate, CheckOutDate, SumPrice, OutOrderID, Remark) { | ||
async createOrder( | ||
HotelID, | ||
RoomTypeID, | ||
MebName, | ||
Tel, | ||
Num, | ||
CheckInDate, | ||
CheckOutDate, | ||
SumPrice, | ||
OutOrderID, | ||
Remark, | ||
ActivityCode, | ||
AgreementNo, | ||
CouponCode | ||
) { | ||
if (!HotelID) throw new Error('HotelID is required') | ||
@@ -255,2 +272,6 @@ if (!RoomTypeID) throw new Error('RoomTypeID is required') | ||
} | ||
if (ActivityCode) query.ActivityCode = ActivityCode | ||
if (AgreementNo) query.AgreementNo = AgreementNo | ||
if (CouponCode) query.CouponCode = CouponCode | ||
// HTTP请求重试次数设置为1 | ||
@@ -303,3 +324,3 @@ const options = { maxAttempts: 1 } | ||
*/ | ||
async checkPriceAndCount(HotelID, CheckInDate, CheckOutDate, RoomTypeID, Num) { | ||
async checkPriceAndCount(HotelID, CheckInDate, CheckOutDate, RoomTypeID, Num, ActivityCode, CouponCode, SumPrice) { | ||
const uri = '/CheckPriceAndCount' | ||
@@ -320,2 +341,6 @@ if (!HotelID) throw new Error('HotelID is required') | ||
} | ||
if (ActivityCode) query.ActivityCode = ActivityCode | ||
if (SumPrice) query.SumPrice = SumPrice | ||
if (CouponCode) query.CouponCode = CouponCode | ||
return this.request.get(uri, query) | ||
@@ -322,0 +347,0 @@ } |
{ | ||
"name": "@chuxingpay/dongcheng", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "license": "ISC", |
19368
12
456