Comparing version 0.34.4 to 0.34.5
@@ -54,3 +54,3 @@ "use strict"; | ||
var model_1 = require("./model"); | ||
var GET_ACCOUNT = "query {\n viewer {\n mainAccount {\n iban\n balance\n cardHolderRepresentation\n cardHolderRepresentations\n }\n }\n}"; | ||
var GET_ACCOUNT = "query {\n viewer {\n mainAccount {\n iban\n balance\n cardHolderRepresentation\n cardHolderRepresentations\n hasPendingCardFraudCase\n canCreateOverdraft\n }\n }\n}"; | ||
var GET_ACCOUNT_STATS = "query {\n viewer {\n mainAccount {\n stats {\n accountBalance\n main\n yours\n unknown\n vatAmount\n vatTotal\n vatMissing\n taxCurrentYearAmount\n taxPastYearsAmount\n taxTotal\n taxMissing\n }\n }\n }\n}"; | ||
@@ -57,0 +57,0 @@ var Account = /** @class */ (function (_super) { |
@@ -1,2 +0,2 @@ | ||
import { Card as CardModel, CardSettings, MutationActivateCardArgs, MutationChangeCardPinArgs, MutationChangeCardStatusArgs, MutationConfirmChangeCardPinArgs, MutationCreateCardArgs, MutationReorderCardArgs, MutationReplaceCardArgs, MutationUpdateCardSettingsArgs, GooglePayCardToken, MutationAddGooglePayCardTokenArgs, MutationDeleteGooglePayCardTokenArgs } from "./schema"; | ||
import { Card as CardModel, CardSettings, MutationActivateCardArgs, MutationChangeCardPinArgs, MutationChangeCardStatusArgs, MutationConfirmChangeCardPinArgs, MutationCreateCardArgs, MutationReorderCardArgs, MutationReplaceCardArgs, MutationUpdateCardSettingsArgs, GooglePayCardToken, MutationAddGooglePayCardTokenArgs, MutationDeleteGooglePayCardTokenArgs, WhitelistCardResponse, ConfirmFraudResponse } from "./schema"; | ||
import { Model } from "./model"; | ||
@@ -8,2 +8,4 @@ import { ResultPage } from "./resultPage"; | ||
export declare const DELETE_GOOGLE_PAY_CARD_TOKEN = "mutation(\n $id: String!,\n $walletId: String!\n $tokenRefId: String!\n) {\n deleteGooglePayCardToken(\n id: $id,\n walletId: $walletId,\n tokenRefId: $tokenRefId\n ) {\n walletId\n tokenRefId\n }\n}"; | ||
export declare const WHITELIST_CARD = "mutation {\n whitelistCard {\n id\n resolution\n whitelistedUntil\n }\n}"; | ||
export declare const CONFIRM_FRAUD = "\nmutation {\n confirmFraud {\n id\n resolution\n }\n}"; | ||
export declare class Card extends Model<CardModel> { | ||
@@ -107,2 +109,14 @@ /** | ||
deleteGooglePayCardToken(args: MutationDeleteGooglePayCardTokenArgs): Promise<GooglePayCardToken>; | ||
/** | ||
* Whitelist card fraud case | ||
* | ||
* @returns case resolution and timestamp till when the case is whitelisted | ||
*/ | ||
whitelistCard(): Promise<WhitelistCardResponse>; | ||
/** | ||
* Confirm card fraud case | ||
* | ||
* @returns case resolution | ||
*/ | ||
confirmFraud(): Promise<ConfirmFraudResponse>; | ||
} |
@@ -70,2 +70,4 @@ "use strict"; | ||
exports.DELETE_GOOGLE_PAY_CARD_TOKEN = "mutation(\n $id: String!,\n $walletId: String!\n $tokenRefId: String!\n) {\n deleteGooglePayCardToken(\n id: $id,\n walletId: $walletId,\n tokenRefId: $tokenRefId\n ) {\n walletId\n tokenRefId\n }\n}"; | ||
exports.WHITELIST_CARD = "mutation {\n whitelistCard {\n id\n resolution\n whitelistedUntil\n }\n}"; | ||
exports.CONFIRM_FRAUD = "\nmutation {\n confirmFraud {\n id\n resolution\n }\n}"; | ||
var Card = /** @class */ (function (_super) { | ||
@@ -351,2 +353,38 @@ __extends(Card, _super); | ||
}; | ||
/** | ||
* Whitelist card fraud case | ||
* | ||
* @returns case resolution and timestamp till when the case is whitelisted | ||
*/ | ||
Card.prototype.whitelistCard = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var result; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.client.rawQuery(exports.WHITELIST_CARD)]; | ||
case 1: | ||
result = _a.sent(); | ||
return [2 /*return*/, result.whitelistCard]; | ||
} | ||
}); | ||
}); | ||
}; | ||
/** | ||
* Confirm card fraud case | ||
* | ||
* @returns case resolution | ||
*/ | ||
Card.prototype.confirmFraud = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var result; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.client.rawQuery(exports.CONFIRM_FRAUD)]; | ||
case 1: | ||
result = _a.sent(); | ||
return [2 /*return*/, result.confirmFraud]; | ||
} | ||
}); | ||
}); | ||
}; | ||
return Card; | ||
@@ -353,0 +391,0 @@ }(model_1.Model)); |
@@ -455,3 +455,4 @@ export declare type Maybe<T> = T | null; | ||
Banners = "BANNERS", | ||
Signup = "SIGNUP" | ||
Signup = "SIGNUP", | ||
CardFraud = "CARD_FRAUD" | ||
} | ||
@@ -465,2 +466,3 @@ /** The bank account of the current user */ | ||
cardHolderRepresentations: Array<Scalars['String']>; | ||
hasPendingCardFraudCase: Scalars['Boolean']; | ||
transfers: TransfersConnection; | ||
@@ -1265,10 +1267,2 @@ transaction?: Maybe<Transaction>; | ||
}; | ||
export declare type MutationWhitelistCardArgs = { | ||
fraudCaseId: Scalars['String']; | ||
id: Scalars['String']; | ||
}; | ||
export declare type MutationConfirmFraudArgs = { | ||
fraudCaseId: Scalars['String']; | ||
id: Scalars['String']; | ||
}; | ||
export declare type MutationCreateCardArgs = { | ||
@@ -1521,9 +1515,16 @@ type: CardType; | ||
id: Scalars['String']; | ||
resolution: Scalars['String']; | ||
whitelisted_until: Scalars['String']; | ||
resolution: CaseResolution; | ||
whitelistedUntil: Scalars['String']; | ||
}; | ||
export declare enum CaseResolution { | ||
Pending = "PENDING", | ||
Confirmed = "CONFIRMED", | ||
Whitelisted = "WHITELISTED", | ||
TimedOut = "TIMED_OUT", | ||
Timeout = "TIMEOUT" | ||
} | ||
export declare type ConfirmFraudResponse = { | ||
__typename?: 'ConfirmFraudResponse'; | ||
id: Scalars['String']; | ||
resolution: Scalars['String']; | ||
resolution: CaseResolution; | ||
}; | ||
@@ -1635,2 +1636,5 @@ export declare type CardSettingsInput = { | ||
taxAdvisoryTermsVersionAccepted?: Maybe<Scalars['String']>; | ||
subjectToAccounting?: Maybe<ThreeStateAnswer>; | ||
workingInEcommerce?: Maybe<Scalars['Boolean']>; | ||
hasMoreThanOneBusiness?: Maybe<Scalars['Boolean']>; | ||
idnowReminderType?: Maybe<IdnowReminderType>; | ||
@@ -1654,2 +1658,7 @@ idnowReminderTime?: Maybe<Scalars['DateTime']>; | ||
} | ||
export declare enum ThreeStateAnswer { | ||
Yes = "YES", | ||
No = "NO", | ||
NotSure = "NOT_SURE" | ||
} | ||
export declare enum IdnowReminderType { | ||
@@ -1656,0 +1665,0 @@ Email = "EMAIL", |
@@ -485,3 +485,4 @@ // @flow | ||
Banners: 'BANNERS', | ||
Signup: 'SIGNUP' | ||
Signup: 'SIGNUP', | ||
CardFraud: 'CARD_FRAUD' | ||
}); | ||
@@ -499,2 +500,3 @@ | ||
cardHolderRepresentations: Array<$ElementType<Scalars, 'String'>>, | ||
hasPendingCardFraudCase: $ElementType<Scalars, 'Boolean'>, | ||
transfers: TransfersConnection, | ||
@@ -1459,14 +1461,2 @@ transaction?: ?Transaction, | ||
export type MutationWhitelistCardArgs = {| | ||
fraudCaseId: $ElementType<Scalars, 'String'>, | ||
id: $ElementType<Scalars, 'String'>, | ||
|}; | ||
export type MutationConfirmFraudArgs = {| | ||
fraudCaseId: $ElementType<Scalars, 'String'>, | ||
id: $ElementType<Scalars, 'String'>, | ||
|}; | ||
export type MutationCreateCardArgs = {| | ||
@@ -1790,10 +1780,21 @@ type: CardType, | ||
id: $ElementType<Scalars, 'String'>, | ||
resolution: $ElementType<Scalars, 'String'>, | ||
whitelisted_until: $ElementType<Scalars, 'String'>, | ||
resolution: CaseResolution, | ||
whitelistedUntil: $ElementType<Scalars, 'String'>, | ||
|}; | ||
export const CaseResolutionValues = Object.freeze({ | ||
Pending: 'PENDING', | ||
Confirmed: 'CONFIRMED', | ||
Whitelisted: 'WHITELISTED', | ||
TimedOut: 'TIMED_OUT', | ||
Timeout: 'TIMEOUT' | ||
}); | ||
export type CaseResolution = $Values<typeof CaseResolutionValues>; | ||
export type ConfirmFraudResponse = {| | ||
__typename?: 'ConfirmFraudResponse', | ||
id: $ElementType<Scalars, 'String'>, | ||
resolution: $ElementType<Scalars, 'String'>, | ||
resolution: CaseResolution, | ||
|}; | ||
@@ -1920,2 +1921,5 @@ | ||
taxAdvisoryTermsVersionAccepted?: ?$ElementType<Scalars, 'String'>, | ||
subjectToAccounting?: ?ThreeStateAnswer, | ||
workingInEcommerce?: ?$ElementType<Scalars, 'Boolean'>, | ||
hasMoreThanOneBusiness?: ?$ElementType<Scalars, 'Boolean'>, | ||
idnowReminderType?: ?IdnowReminderType, | ||
@@ -1952,2 +1956,11 @@ idnowReminderTime?: ?$ElementType<Scalars, 'DateTime'>, | ||
export const ThreeStateAnswerValues = Object.freeze({ | ||
Yes: 'YES', | ||
No: 'NO', | ||
NotSure: 'NOT_SURE' | ||
}); | ||
export type ThreeStateAnswer = $Values<typeof ThreeStateAnswerValues>; | ||
export const IdnowReminderTypeValues = Object.freeze({ | ||
@@ -1954,0 +1967,0 @@ Email: 'EMAIL', |
@@ -333,2 +333,3 @@ "use strict"; | ||
ScopeType["Signup"] = "SIGNUP"; | ||
ScopeType["CardFraud"] = "CARD_FRAUD"; | ||
})(ScopeType = exports.ScopeType || (exports.ScopeType = {})); | ||
@@ -560,2 +561,10 @@ var TransferStatus; | ||
})(SepaTransferStatus = exports.SepaTransferStatus || (exports.SepaTransferStatus = {})); | ||
var CaseResolution; | ||
(function (CaseResolution) { | ||
CaseResolution["Pending"] = "PENDING"; | ||
CaseResolution["Confirmed"] = "CONFIRMED"; | ||
CaseResolution["Whitelisted"] = "WHITELISTED"; | ||
CaseResolution["TimedOut"] = "TIMED_OUT"; | ||
CaseResolution["Timeout"] = "TIMEOUT"; | ||
})(CaseResolution = exports.CaseResolution || (exports.CaseResolution = {})); | ||
var CardAction; | ||
@@ -585,2 +594,8 @@ (function (CardAction) { | ||
})(PermanentExtensionStatus = exports.PermanentExtensionStatus || (exports.PermanentExtensionStatus = {})); | ||
var ThreeStateAnswer; | ||
(function (ThreeStateAnswer) { | ||
ThreeStateAnswer["Yes"] = "YES"; | ||
ThreeStateAnswer["No"] = "NO"; | ||
ThreeStateAnswer["NotSure"] = "NOT_SURE"; | ||
})(ThreeStateAnswer = exports.ThreeStateAnswer || (exports.ThreeStateAnswer = {})); | ||
var IdnowReminderType; | ||
@@ -587,0 +602,0 @@ (function (IdnowReminderType) { |
{ | ||
"name": "kontist", | ||
"version": "0.34.4", | ||
"version": "0.34.5", | ||
"description": "Kontist client SDK", | ||
@@ -5,0 +5,0 @@ "main": "dist/lib/index.js", |
@@ -75,3 +75,5 @@ import { expect } from "chai"; | ||
cardHolderRepresentation: null, | ||
cardHolderRepresentations: ["STEPHEN/JAMES"] | ||
cardHolderRepresentations: ["STEPHEN/JAMES"], | ||
hasPendingCardFraudCase: false, | ||
canCreateOverdraft: true, | ||
}, | ||
@@ -88,2 +90,6 @@ }, | ||
expect(result?.balance).to.eq(1234); | ||
expect(result?.cardHolderRepresentation).to.eq(null); | ||
expect(result?.cardHolderRepresentations[0]).to.eq("STEPHEN/JAMES"); | ||
expect(result?.hasPendingCardFraudCase).to.eq(false); | ||
expect(result?.canCreateOverdraft).to.eq(true); | ||
}); | ||
@@ -106,2 +112,3 @@ | ||
}); | ||
describe("#getStats", () => { | ||
@@ -129,3 +136,3 @@ it("should call rawQuery and return correct stats", async () => { | ||
// arrange | ||
const account = new Account(client.graphQL); | ||
const account = new Account(client.graphQL); | ||
const spyOnRawQuery = sandbox.stub(client.graphQL, "rawQuery").resolves({ | ||
@@ -132,0 +139,0 @@ viewer: {}, |
import { expect } from "chai"; | ||
import * as sinon from "sinon"; | ||
import { CardAction, CardStatus, CardType } from "../../lib/graphql/schema"; | ||
import { | ||
CardAction, | ||
CardStatus, | ||
CardType, | ||
CaseResolution, | ||
} from "../../lib/graphql/schema"; | ||
@@ -454,2 +459,47 @@ import { Client } from "../../lib"; | ||
}); | ||
describe("#whitelistCard", () => { | ||
it("should call rawQuery and return WhitelistCardResponse", async () => { | ||
// arrange; | ||
const response = { | ||
id: cardData.id, | ||
resolution: CaseResolution.Whitelisted, | ||
whitelistedUntil: new Date().toISOString(), | ||
}; | ||
const card = new Card(client.graphQL); | ||
const spyOnRawQuery = sandbox.stub(client.graphQL, "rawQuery").resolves({ | ||
whitelistCard: response, | ||
} as any); | ||
// act | ||
const result = await card.whitelistCard(); | ||
// assert | ||
sinon.assert.calledOnce(spyOnRawQuery); | ||
expect(result).to.eql(response); | ||
}); | ||
}); | ||
describe("#confirmFraud", () => { | ||
it("should call rawQuery and return ConfirmFraudResponse", async () => { | ||
// arrange; | ||
const response = { | ||
id: cardData.id, | ||
resolution: CaseResolution.Confirmed, | ||
}; | ||
const card = new Card(client.graphQL); | ||
const spyOnRawQuery = sandbox.stub(client.graphQL, "rawQuery").resolves({ | ||
confirmFraud: response, | ||
} as any); | ||
// act | ||
const result = await card.confirmFraud(); | ||
// assert | ||
sinon.assert.calledOnce(spyOnRawQuery); | ||
expect(result).to.eql(response); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is too big to display
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
661091
11323