@ns8/ns8-switchboard-operator
Advanced tools
Comparing version
import { CreateOrderSwitch, SwitchContext } from 'ns8-switchboard-interfaces'; | ||
import V2Client from './V2Client'; | ||
import { Protect } from 'ns8-api-interfaces'; | ||
import { Order } from 'ns8-protect-models'; | ||
export declare class CreateOrderOperator { | ||
@@ -8,3 +8,3 @@ private readonly createOrderSwitches; | ||
constructor(createOrderSwitches?: CreateOrderSwitch[], v2Client?: V2Client); | ||
create(switchContext: SwitchContext): Promise<Protect.Order>; | ||
create(switchContext: SwitchContext): Promise<Order>; | ||
} |
@@ -10,2 +10,3 @@ "use strict"; | ||
async create(switchContext) { | ||
console.dir(switchContext.merchant); | ||
let hasValidOrder = true; | ||
@@ -20,3 +21,3 @@ let switchIndex = 0; | ||
const v2BaseUrl = switchContext.apiBaseUrl; | ||
const v2Token = switchContext.authorization.accessToken; | ||
const v2Token = switchContext.merchant.shops[0].accessTokens[0].id; | ||
return this.v2Client.withAuthToken(v2Token) | ||
@@ -23,0 +24,0 @@ .withBaseUrl(v2BaseUrl) |
@@ -19,3 +19,3 @@ "use strict"; | ||
const v2BaseUrl = switchContext.apiBaseUrl; | ||
const v2Token = switchContext.authorization.accessToken; | ||
const v2Token = switchContext.merchant.shops[0].accessTokens[0].id; | ||
return this.v2Client.withAuthToken(v2Token) | ||
@@ -22,0 +22,0 @@ .withBaseUrl(v2BaseUrl) |
@@ -19,3 +19,3 @@ "use strict"; | ||
const v2BaseUrl = switchContext.apiBaseUrl; | ||
const v2Token = switchContext.authorization.accessToken; | ||
const v2Token = switchContext.merchant.shops[0].accessTokens[0].id; | ||
return this.v2Client.withAuthToken(v2Token) | ||
@@ -22,0 +22,0 @@ .withBaseUrl(v2BaseUrl) |
@@ -1,2 +0,2 @@ | ||
import { Protect } from 'ns8-api-interfaces'; | ||
import { Order } from 'ns8-protect-models'; | ||
export default class V2Client { | ||
@@ -8,5 +8,5 @@ private static MAX_SUCCESS_CODE; | ||
withAuthToken(authToken: string): V2Client; | ||
postOrder(order: Protect.Order): Promise<Protect.Order>; | ||
postOrder(order: Order): Promise<Order>; | ||
updateShop(shop: any): Promise<any>; | ||
uninstall(uninstall: any): Promise<any>; | ||
} |
{ | ||
"name": "@ns8/ns8-switchboard-operator", | ||
"version": "1.0.13", | ||
"version": "1.0.14", | ||
"description": "Operator project contains switchboard interfaces and orchestration code", | ||
@@ -23,2 +23,3 @@ "main": "dist/index.js", | ||
"chai": "^4.2.0", | ||
"class-transformer": "^0.2.0", | ||
"fastify": "^1.12.1", | ||
@@ -34,5 +35,5 @@ "mocha": "^5.2.0", | ||
"isomorphic-fetch": "^2.2.1", | ||
"ns8-api-interfaces": "^2.0.84", | ||
"ns8-switchboard-interfaces": "^1.0.4" | ||
"ns8-protect-models": "^1.0.18", | ||
"ns8-switchboard-interfaces": "^1.0.5" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
13470
2.16%185
0.54%13
8.33%+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed