diff --git a/samples/fraud/AddCardFingerprintToFraudValueList.js b/samples/fraud/AddCardFingerprintToFraudValueList.js new file mode 100644 index 0000000..153ea6d --- /dev/null +++ b/samples/fraud/AddCardFingerprintToFraudValueList.js @@ -0,0 +1,20 @@ + +const Craftgate = require('../../dist'); + +const craftgate = new Craftgate.Client({ + apiKey: 'api-key', + secretKey: 'secret-key', + baseUrl: 'https://sandbox-api.craftgate.io' +}); + +//request +const request = { + listName: 'cardList', + type: Craftgate.Model.FraudValueType.Card, + label: "John Doe's Card", + paymentId: 11675 +}; + +craftgate.fraud().addValueToValueList(request) + .then(() => console.info('Value added to fraud value list')) + .catch(err => console.error('Failed to add value to fraud value list', err)); diff --git a/samples/fraud/AddTemporaryValueToFraudValueList.js b/samples/fraud/AddTemporaryValueToFraudValueList.js index ad5f31b..15aabf7 100644 --- a/samples/fraud/AddTemporaryValueToFraudValueList.js +++ b/samples/fraud/AddTemporaryValueToFraudValueList.js @@ -1,4 +1,3 @@ - const Craftgate = require('../../dist'); const craftgate = new Craftgate.Client({ @@ -7,6 +6,15 @@ const craftgate = new Craftgate.Client({ baseUrl: 'https://sandbox-api.craftgate.io' }); -craftgate.fraud().addValueToValueList("ipList", "127.0.0.2", 60) +//request +const request = { + listName: 'ipList', + type: Craftgate.Model.FraudValueType.Ip, + label: "local ip 2", + value: "127.0.0.2", + durationInSeconds: 60 +}; + +craftgate.fraud().addValueToValueList(request) .then(() => console.info('Value added to fraud value list')) .catch(err => console.error('Failed to add value to fraud value list', err)); diff --git a/samples/fraud/AddValueToFraudValueList.js b/samples/fraud/AddValueToFraudValueList.js index d9d67d1..6afab03 100644 --- a/samples/fraud/AddValueToFraudValueList.js +++ b/samples/fraud/AddValueToFraudValueList.js @@ -7,6 +7,14 @@ const craftgate = new Craftgate.Client({ baseUrl: 'https://sandbox-api.craftgate.io' }); -craftgate.fraud().addValueToValueList("ipList", "127.0.0.1", null) +//request +const request = { + listName: 'ipList', + type: Craftgate.Model.FraudValueType.Ip, + label: "local ip 1", + value: "127.0.0.1" +}; + +craftgate.fraud().addValueToValueList(request) .then(() => console.info('Value added to fraud value list')) .catch(err => console.error('Failed to add value to fraud value list', err)); diff --git a/samples/fraud/CreateFraudValueList.js b/samples/fraud/CreateFraudValueList.js index 4a5b717..44904ce 100644 --- a/samples/fraud/CreateFraudValueList.js +++ b/samples/fraud/CreateFraudValueList.js @@ -7,6 +7,6 @@ const craftgate = new Craftgate.Client({ baseUrl: 'https://sandbox-api.craftgate.io' }); -craftgate.fraud().createValueList("ipList") +craftgate.fraud().createValueList("ipList", Craftgate.Model.FraudValueType.Ip) .then(() => console.info('Fraud value list created')) .catch(err => console.error('Failed to create fraud value list', err)); diff --git a/samples/fraud/RemoveValueFromFraudValueList.js b/samples/fraud/RemoveValueFromFraudValueList.js index cc80131..532cf17 100644 --- a/samples/fraud/RemoveValueFromFraudValueList.js +++ b/samples/fraud/RemoveValueFromFraudValueList.js @@ -7,6 +7,6 @@ const craftgate = new Craftgate.Client({ baseUrl: 'https://sandbox-api.craftgate.io' }); -craftgate.fraud().removeValueFromValueList("ipList", "127.0.0.1") +craftgate.fraud().removeValueFromValueList("ipList", "5758a029-4a82-4e47-a0cf-36d34052b8e5") .then(() => console.info('Value removed from fraud value list')) .catch(err => console.error('Failed to remove value from fraud value list', err)); diff --git a/samples/payment/BnplPaymentOffer.js b/samples/payment/BnplPaymentOffer.js index 6444b9a..517938e 100644 --- a/samples/payment/BnplPaymentOffer.js +++ b/samples/payment/BnplPaymentOffer.js @@ -23,7 +23,7 @@ const request = { id: "100", name: "Test Elektronik 1", brandName: "Samsung", - type: Craftgate.Model.BnplCartItemType.MobilePhoneOver5000Try, + type: Craftgate.Model.BnplCartItemType.MobilePhonePriceAboveRegulationLimit, unitPrice: 4000, quantity: 1, } diff --git a/samples/payment/InitBnplPayment.js b/samples/payment/InitBnplPayment.js index 188173a..f5ede70 100644 --- a/samples/payment/InitBnplPayment.js +++ b/samples/payment/InitBnplPayment.js @@ -42,7 +42,7 @@ const request = { id: "100", name: "Test Elektronik 1", brandName:"Samsung", - type: Craftgate.Model.BnplCartItemType.MobilePhoneOver5000Try, + type: Craftgate.Model.BnplCartItemType.MobilePhonePriceAboveRegulationLimit, unitPrice: 4000, quantity: 1, } diff --git a/src/adapter/FraudAdapter.ts b/src/adapter/FraudAdapter.ts index 6060c10..7a8a1a6 100644 --- a/src/adapter/FraudAdapter.ts +++ b/src/adapter/FraudAdapter.ts @@ -1,6 +1,8 @@ import {ClientCreationOptions} from '../lib/HttpClient'; import FraudCheckStatus from '../model/FraudCheckStatus'; +import FraudValueType from '../model/FraudValueType'; +import FraudValueListRequest from '../request/FraudValueListRequest'; import SearchFraudChecksRequest from '../request/SearchFraudChecksRequest'; import FraudAllValueListsResponse from '../response/FraudAllValueListsResponse'; @@ -30,23 +32,22 @@ export default class FraudAdapter extends BaseAdapter { return this._client.get(`/fraud/v1/value-lists/${listName}`); } - async createValueList(listName: string): Promise { - await this.addValueToValueList(listName, null, null); + async createValueList(listName: string, type: FraudValueType): Promise { + await this.addValueToValueList({ + listName: listName, + type: type + }); } async deleteValueList(listName: string): Promise { await this._client.delete(`/fraud/v1/value-lists/${listName}`); } - async addValueToValueList(listName: string, value: string, expireInSeconds: number): Promise { - await this._client.post(`/fraud/v1/value-lists`, { - listName: listName, - value: value, - durationInSeconds: expireInSeconds - }); + async addValueToValueList(request: FraudValueListRequest): Promise { + await this._client.post(`/fraud/v1/value-lists`, request); } - async removeValueFromValueList(listName: string, value: string): Promise { - await this._client.delete(`/fraud/v1/value-lists/${listName}/values/${value}`); + async removeValueFromValueList(listName: string, valueId: string): Promise { + await this._client.delete(`/fraud/v1/value-lists/${listName}/values/${valueId}`); } } diff --git a/src/model/ApmType.ts b/src/model/ApmType.ts index 4eed7bf..cee037f 100644 --- a/src/model/ApmType.ts +++ b/src/model/ApmType.ts @@ -14,7 +14,8 @@ enum ApmType { CashOnDelivery = 'CASH_ON_DELIVERY', Maslak = 'MASLAK', ALFABANK = 'ALFABANK', - TomFinance = 'TOM_FINANCE' + TomFinance = 'TOM_FINANCE', + Haso = 'HASO' } export default ApmType; diff --git a/src/model/BnplCartItemType.ts b/src/model/BnplCartItemType.ts index be45fc8..1d4fc0d 100644 --- a/src/model/BnplCartItemType.ts +++ b/src/model/BnplCartItemType.ts @@ -1,6 +1,6 @@ enum BnplCartItemType { - MobilePhoneOver5000Try = 'MOBILE_PHONE_OVER_5000_TRY', - MobilePhoneBelow5000Try = 'MOBILE_PHONE_BELOW_5000_TRY', + MobilePhonePriceAboveRegulationLimit = 'MOBILE_PHONE_PRICE_ABOVE_REGULATION_LIMIT', + MobilePhonePriceBelowRegulationLimit = 'MOBILE_PHONE_PRICE_BELOW_REGULATION_LIMIT', Tablet = 'TABLET', Computer = 'COMPUTER', ConstructionMarket = 'CONSTRUCTION_MARKET', diff --git a/src/model/Currency.ts b/src/model/Currency.ts index 269dba8..994a950 100644 --- a/src/model/Currency.ts +++ b/src/model/Currency.ts @@ -9,7 +9,12 @@ enum Currency { AED = 'AED', IQD = 'IQD', AZN = 'AZN', - KZT = 'KZT' + KZT = 'KZT', + KWD = 'KWD', + SAR = 'SAR', + BHD = 'BHD', + RUB = 'RUB', + JPY = 'JPY' } export default Currency; diff --git a/src/model/FraudValueType.ts b/src/model/FraudValueType.ts new file mode 100644 index 0000000..e7c059b --- /dev/null +++ b/src/model/FraudValueType.ts @@ -0,0 +1,9 @@ +enum FraudValueType { + Card = 'CARD', + Ip = 'IP', + PhoneNumber = 'PHONE_NUMBER', + Email = 'EMAIL', + Other = 'OTHER' +} + +export default FraudValueType; diff --git a/src/model/PaymentProvider.ts b/src/model/PaymentProvider.ts index 7025670..33398b4 100644 --- a/src/model/PaymentProvider.ts +++ b/src/model/PaymentProvider.ts @@ -12,7 +12,8 @@ enum PaymentProvider { YkbWorldPay = 'YKB_WORLD_PAY', ApplePay = 'APPLEPAY', GooglePay = 'GOOGLEPAY', - Stripe = 'STRIPE' + Stripe = 'STRIPE', + Haso = 'HASO' } export default PaymentProvider; diff --git a/src/model/PosIntegrator.ts b/src/model/PosIntegrator.ts index 06cea86..642f90d 100644 --- a/src/model/PosIntegrator.ts +++ b/src/model/PosIntegrator.ts @@ -34,7 +34,10 @@ enum PosIntegrator { ALGORITMA = 'ALGORITMA', PAYCELL = 'PAYCELL', TAMI = 'TAMI', - QNB_PAY = 'QNB_PAY' + QNB_PAY = 'QNB_PAY', + AKBANK_VPOS = 'AKBANK_VPOS', + TAP = 'TAP', + RUBIK = 'RUBIK' } export default PosIntegrator; diff --git a/src/model/index.ts b/src/model/index.ts index 6ebf483..8672458 100644 --- a/src/model/index.ts +++ b/src/model/index.ts @@ -12,6 +12,7 @@ import Currency from './Currency'; import FileStatus from './FileStatus'; import FraudAction from './FraudAction'; import FraudCheckStatus from './FraudCheckStatus'; +import FraudValueType from './FraudValueType'; import LoyaltyType from './LoyaltyType'; import MemberType from './MemberType'; import MerchantType from './MerchantType'; @@ -62,6 +63,7 @@ export = { FileStatus, FraudAction, FraudCheckStatus, + FraudValueType, LoyaltyType, MemberType, MerchantType, diff --git a/src/request/FraudValueListRequest.ts b/src/request/FraudValueListRequest.ts new file mode 100644 index 0000000..e610287 --- /dev/null +++ b/src/request/FraudValueListRequest.ts @@ -0,0 +1,12 @@ +import FraudValueType from '../model/FraudValueType'; + +type FraudValueListRequest = { + listName: string; + type: FraudValueType; + label?: string; + value?: string; + durationInSeconds?: number; + paymentId?: number; +}; + +export default FraudValueListRequest; diff --git a/src/response/dto/FraudPaymentData.ts b/src/response/dto/FraudPaymentData.ts index 1166d2b..bf7f9b9 100644 --- a/src/response/dto/FraudPaymentData.ts +++ b/src/response/dto/FraudPaymentData.ts @@ -3,8 +3,6 @@ type FraudPaymentData = { conversationId: string; paidPrice: number; currency: string; - cardFingerprintId: string; - cardFingerprintExpirationDate: Date; buyerId: number; clientIp: string; }; diff --git a/src/response/dto/FraudValue.ts b/src/response/dto/FraudValue.ts index 716fa77..9b73c37 100644 --- a/src/response/dto/FraudValue.ts +++ b/src/response/dto/FraudValue.ts @@ -1,4 +1,6 @@ type FraudValue = { + id: string; + label: string; value: string; expireInSeconds: number; };