ezly
Version:
An easy API wrapper for Izly.
637 lines (605 loc) • 18.4 kB
TypeScript
import { Fetcher } from '@literate.ink/utilities';
type Balance = Readonly<{
cashValue: number;
g7CardValue: number;
lastUpdate: Date;
value: number;
}>;
type Configuration = Readonly<{
currency: string;
moneyInMaximum: number;
moneyInMinimum: number;
moneyOutMaximum: number;
moneyOutMinimum: number;
paymentMaximum: number;
paymentMinimum: number;
paymentPartMaximum: number;
paymentPartMinimum: number;
}>;
declare class NotRefreshableError extends Error {
constructor();
}
declare class ReauthenticateError extends Error {
constructor();
}
/**
* Can only be retrieved during `tokenize()` process,
* so make sure to save it !
*/
type Identification = Readonly<{
/**
* Identifier of the user, probably the phone number.
* @from Logon.UID
*/
identifier: string;
/**
* Key used to generate QR code for payment.
* If you want to generate a QR code, use `izly.qrPay()`.
* Not relevant to users, should only be used internally.
* @from Logon.QR_CODE_PRIVATE_KEY
*/
qrCodePrivateKey: string;
/**
* Not relevant to users, should only be used internally.
* @from Logon.SEED
*/
seed: string;
/**
* Token used for SOAP requests.
* Not relevant to users, should only be used internally.
* @from Logon.TOKEN
*/
token: string;
/**
* @from Logon.USER_ID
*/
userID: string;
/**
* Also known as `GUID` in the app internals.
* Not relevant to users, should only be used internally.
* @from Logon.USER_PUBLIC_ID
*/
userPublicID: string;
}> & {
/**
* OAuth token used for REST requests.
* Not relevant to users, should only be used internally.
* @from Logon.OAUTH.ACCESS_TOKEN
*/
accessToken: string;
/**
* Time when the OAuth token used for REST requests expires.
* @from Logon.OAUTH.EXPIRES_IN
*/
accessTokenExpiresIn: number;
/**
* Incremented each time `otp()` is called.
* Not relevant to users, should only be used internally.
*/
counter: number;
/**
* Not relevant to users, should only be used internally.
* @from Logon.NSSE
*/
nsse: string;
/**
* Not relevant to users, should only be used internally.
* @from Logon.OAUTH.ACCESS_TOKEN
*/
refreshToken: string;
/**
* ID of the session.
* Required for most requests and is renewed at when `izly.refresh()` is called.
* Not relevant to users, should only be used internally.
* @from Logon.SID
*/
sessionID: string;
};
declare enum OperationType {
None = 0,
Unused = 1,
Client_Payment = 2,
Client_AgentToAgentIn = 3,
Client_AgentToAgentOut = 4,
Client_TicketIn = 5,
Client_TicketOut = 6,
/** @original `Client_MoneyInCb` */
Client_MoneyInCreditCard = 7,
Client_MoneyOutTransfer = 8,
Client_PaymentRequest = 10,
User_InvoicingChargeOperation = 52,
Flux_MoneyInCB_Refund = 56,
Flux_MoneyOutTransfer_Refund = 57,
User_PayInCard = 159,
User_PayInCard_Refund = 160,
User_PayOut = 166,
User_PayInCard_Refund_Modify = 167,
User_PayInCard_Refund_Cancel = 176,
User_PayInDomain = 178,
User_PayInDomain_Refund = 179,
User_PayOutDomain = 180,
User_PayOutDomain_Refund = 183,
User_RefundCommission_Modify = 186,
User_RefundCommission_Cancel = 187,
User_BulkTransfer = 188,
Client_Cash_MoneyIn = 212,
Flux_Client_Cash_MoneyIn_Refund = 213,
Client_MoneyInBankAccount = 215,
Client_PayInBankAccount = 217,
User_PayInRequest = 218,
User_PayInBankTransfer = 221,
User_MoneyInBankTransfer = 222,
User_MoneyIn_Refund_Cancel = 223,
User_MoneyIn_Refund_Modify = 224,
Virement_Multiple = 225,
Money_Out_Prepaid = 226,
Client_NouveauMonde_MoneyIn = 231,
Flux_Client_NouveauMonde_MoneyIn_Refund = 232,
MoneyIn_Cheque = 234,
MoneyIn_Cheque_Refund = 235,
PayIn_Cheque = 236,
PayIn_Cheque_Refund = 237,
PayIn_TPE = 241,
PayIn_TPE_Refund = 242,
FeeCharge_Operation = 502,
FeeCharge_Operation_Refund = 503,
InstantPayment_SCT_MoneyIn = 530,
InstantPayment_SCT_MoneyOut = 531,
InstantPayment_SCT_PayIn = 532,
InstantPayment_SCT_PayOut = 533,
InstantPayment_SCT_RefundIn = 534,
InstantPayment_SCT_RefundOut = 535,
Regul_DebitMoney = 500,
Regul_CreditMoney = 501,
User_BookMark = 25,
User_IsBookMarkable = 26,
User_Block = 27,
User_IsBlockable = 28,
User_SendMoney = 29,
User_ReceiveMoney = 30,
User_SendPaymentRequest = 31,
User_ReceivePaymentRequest = 32,
User_ExpiredPaymentRefund = 33,
User_EcommerceOperation = 34,
User_EditProfile = 35,
User_IsNameEditable = 36,
User_IsAliasEditable = 37,
User_IsEmailEditable = 38,
User_IsAddressEditable = 39,
User_IsActivityEditable = 40,
User_IsWebSiteEditable = 41,
User_IsNameDeletable = 42,
User_IsAliasDeletable = 43,
User_IsEmailDeletable = 44,
User_IsAddressDeletable = 45,
User_IsActivityDeletable = 46,
User_IsWebSiteDeletable = 47,
User_Make_KYCExtended = 48,
User_MakeOpposition = 49,
User_CancelOpposition = 50,
User_InvoicingSubscribeEngagement = 51,
Enrollment = 53,
Logon = 54,
User_PaymentDistributeurNFC = 55,
User_EditIdentity = 59,
Pro_GetCashingModel = 68,
Pro_CreateCashingModel = 69,
User_EcommerceOperationIn = 70,
User_EcommerceOperationOut = 71,
User_EcommerceRefund = 72,
Pro_CreateProCashier = 87,
Pro_EditProCashier = 88,
Pro_DeleteProCashier = 89,
User_AddCard = 90,
User_EditCard = 91,
User_DeleteCard = 92,
User_AddBankAccount = 93,
User_EditBankAccount = 94,
User_DeleteBankAccount = 95,
User_ChangePhoneNumber = 96,
User_ChangePhoneModel = 97,
User_ChangePassword = 98,
User_CloseAccount = 99,
User_AddPhoto = 100,
User_DeletePhoto = 101,
User_Contact_Delete = 102,
User_Contact_GetHistory = 103,
User_GetSecuritySettings = 104,
User_EditSecuritySettings = 105,
Pro_GetProCashier = 106,
Pro_EditOpeningHours = 109,
User_AddPromoOfferPhoto = 110,
User_SubscribePromoOfferPass = 111,
User_Contact_GetDetails = 112,
User_SubscribeProPremiumPass = 113,
User_ApprouveOperation = 114,
User_RefundPayment = 143,
User_Send_Chat_Message = 150,
User_Promo_Offer = 153,
User_RefundCommission = 156,
User_PaymentAuthorization = 158,
Pro_MoneyOutParameters_Manage = 161,
Pro_PrivateSale_Get = 163,
Pro_PrivateSale_Manage = 164,
User_GetDetails = 168,
User_SubAccount_GetDetails = 169,
User_SubAccount_Create = 170,
User_BankAccount_GetDetails = 171,
User_CBCard_GetDetails = 172,
User_GetHistory = 173,
User_Pool_Create = 184,
User_Pool_GetDetails = 185,
User_CreateMandate = 220,
Cashin_GetToken = 227,
Cashin_Payment = 228,
User_CreateRib = 233,
G7_JustificativeVouchersInsert = 238,
User_CadoCarte = 400,
User_CadoCarte_Edit_Status = 401,
User_CadoCarte_Create_EditAmount = 402,
User_Terminal_Display = 403,
User_Terminal_Associate = 404,
User_Terminal_Create = 405,
Admin_User_Display = 11,
Admin_User_Create = 12,
Admin_User_Edit = 13,
Admin_User_Close = 14,
Admin_Role_Display = 15,
Admin_Role_Create = 16,
Admin_Role_Edit = 17,
Admin_Role_Delete = 18,
Admin_Operation_Display = 19,
Admin_Operation_Create = 20,
Admin_Operation_Edit = 21,
Admin_Operation_Delete = 22,
Admin_Flux_MoneyIn = 23,
Admin_Flux_MoneyOut = 24,
LogonAdmin = 58,
Admin_Offer_Display = 60,
Admin_Offer_Create = 61,
Admin_Offer_Edit = 62,
Admin_Offer_Delete = 63,
Admin_ComMessage_Display = 64,
Admin_ComMessage_Create = 65,
Admin_ComMessage_Edit = 66,
Admin_ComMessage_Delete = 67,
Admin_Ecommerce_ListCVD = 73,
Admin_Ecommerce_UploadCVD = 74,
Admin_Notification_Display = 75,
Admin_Notification_Create = 76,
Admin_Notification_Edit = 77,
Admin_Notification_Delete = 78,
Admin_Stats = 79,
Admin_ListPendingMoneyIn = 80,
Admin_ConfirmKYC = 81,
Admin_ConfirmIdentityChange = 82,
Admin_Invitations = 83,
Admin_Fircosoft = 84,
Admin_Fircosoft_GetCompleteFile = 85,
Admin_Fircosoft_GetDeltaFile = 86,
Admin_UserDemands_View = 107,
Admin_GetAttachments_Actions = 108,
Admin_Notification_Send = 115,
Admin_Alert_Send_Attachment = 116,
Admin_Alert_List = 117,
Admin_Alert_List_Proved = 118,
Admin_Alert_GetDetails = 119,
Admin_Alert_UpdateDetails = 120,
Admin_Alert_List_Export = 121,
Admin_User_Vigilance_Level = 122,
Admin_Refbic_Update = 123,
Admin_Vigilance_Level_Export = 124,
Admin_ProUser_Inactive_Export = 125,
Admin_User_List_Part = 126,
Admin_User_List_Pro = 127,
Admin_User_List_Part_Unrestricted = 128,
Admin_User_List_Pro_Unrestricted = 129,
Admin_Technical_Account_List = 130,
Admin_ProUser_Inactive_Export_Unrestricted = 131,
Admin_User_CRUD_Part = 132,
Admin_User_CRUD_Pro = 133,
Admin_Technical_Account_CRUD = 134,
Admin_Role_List_Unrestricted = 135,
Admin_User_ProContract_Create = 136,
Admin_User_ProContract_Validate = 137,
Admin_User_ProContract_List = 138,
Admin_User_ProContract_List_Unrestricted = 139,
Admin_ActivityStat_Get = 140,
Admin_ActivityStat_Get_Unrestricted = 141,
Admin_User_Block = 142,
Admin_Activity_BI_SmoneyReporting = 144,
Admin_Activity_BI_TechnicalReporting = 145,
Admin_Transfer_Client_Portfolio = 146,
Admin_Notification_ConnectionParameters = 147,
Admin_ActivityStat_Get_Global = 148,
Admin_Agencies_Multiple = 149,
Admin_User_List_Technical_Unrestricted = 151,
Admin_User_List_Pro_AgencyWide = 152,
Admin_Documentation = 154,
Admin_User_Notification_History = 155,
Admin_User_Bic_Iban_History = 157,
Admin_BatchClientStatus = 162,
Admin_User_EditCustomParameters = 165,
Admin_Flux_Commission = 177,
BlackLister = 9,
Admin_API_Stats = 181,
Admin_API_Invoices = 182,
Izly_ADRead = 189,
Izly_ADInsert = 190,
Izly_ADEdit = 191,
Izly_ADDetails = 192,
Izly_CommercantRead = 193,
Izly_CommercantInsert = 194,
Izly_CommercantEdit = 195,
Izly_CommercantDetails = 196,
Izly_GestionnaireRead = 197,
Izly_GestionnaireInsert = 198,
Izly_GestionnaireEdit = 199,
Izly_GestionnaireDetails = 200,
Izly_AdminRegionalRead = 201,
Izly_AdminRegionalInsert = 202,
Izly_AdminRegionalEdit = 203,
Izly_AdminRegionalDetails = 204,
Izly_AdminNationalRead = 205,
Izly_AdminNationalInsert = 206,
Izly_AdminNationalEdit = 207,
Izly_AdminNationalDetails = 208,
Izly_CashingPoint_List = 209,
Izly_CashingPoint_Create = 210,
Izly_CashingPoint_Edit = 211,
Izly_CommercantCloseAccountRequest = 214,
Izly_CashingPoint_Aggregate = 216,
Izly_Admin_CrousLoad = 219,
Izly_ExportCSV = 239,
Izly_Export = 240,
Izly_CommunicationNational_Read = 243,
Izly_CommunicationRegional_Read = 244,
Izly_Reversements_Read = 245,
Izly_Recettes_Read = 246,
Izly_Facturation_Read = 247,
Izly_RechargementEspece_Read = 248,
Izly_TransactionRefused_Read = 249,
Izly_ActivityMonitoring_Read = 250,
Izly_ActusAnalytics_Read = 251,
Izly_UserCounts_Read = 252,
Izly_RightsAndAuthorizations_Read = 253,
Izly_BusinessRulesAndSteps_Read = 254,
Izly_ActuAddOrUpdate_Read = 255,
Izly_ActusList_Read = 256,
Izly_ReconciliationByCashingPoint_Read = 257,
Izly_Support_Read = 258
}
declare enum TransactionGroupStatus {
Success = 0,
Pending = 1,
Refunded = 2
}
type Operation = Readonly<{
amount: number;
date: Date;
id: number;
isCredit: boolean;
message: null | string;
status: TransactionGroupStatus;
type: OperationType;
}>;
type Profile = Readonly<{
email: string;
firstName: string;
/** an alias identifier */
identifier: string;
lastName: string;
}>;
declare const balance: (identification: Identification, fetcher?: Fetcher) => Promise<Balance>;
type UP = Readonly<{
BAL: number;
CASHBAL: number;
G7CARDBAL: number;
LUD: string;
}>;
declare const contact: (identification: Identification, fetcher?: Fetcher) => Promise<{
Result: {
Actions: null;
ActiveAlias: string;
ActivePhone: {
PhoneDisplayInternationalNumber: string;
PhoneDisplayNumber: string;
PhoneInternationalNumber: string;
};
CanDisplayPhoto: boolean;
Children: Array<{
DisplayName: null;
Identifier: null;
IsSmoneyPro: boolean;
IsSmoneyUser: boolean;
}>;
DisplayName: string;
HasPhoto: boolean;
Identifier: string;
IsBlocked: boolean;
IsBookmarked: boolean;
IsMe: boolean;
IsSmoneyPro: boolean;
IsSmoneyUser: boolean;
IzlyProfile: {
CardNumber: string;
CodeSociete: number;
DateValidity: Date;
IzlyEmail: string;
NumeroTarif: number;
};
Operations: null;
OptIn: boolean;
OptInPartners: boolean;
PreAuthorization: null;
Profile: {
Address: {
City: string;
Country: number;
Name: string;
ZipCode: string;
};
BirthDate: Date;
Civility: number;
Email: string;
FirstName: string;
LastName: string;
};
ProInfos: null;
SecondDisplayName: string;
};
UP: UP;
}>;
interface IzlyCrous {
IsDefault: boolean;
Name: string;
Number: number;
}
declare const crousContacts: (identification: Identification, fetcher?: Fetcher) => Promise<{
Result: {
CrousList: Array<IzlyCrous>;
UserContact: {
Email: string;
Name: string;
Phone: string;
};
};
}>;
declare const information: (identification: Identification, fetcher?: Fetcher) => Promise<{
balance: Readonly<{
cashValue: number;
g7CardValue: number;
lastUpdate: Date;
value: number;
}>;
configuration: Configuration;
profile: Profile;
}>;
declare enum DurationType {
Unitary = 0,
Day = 1,
Week = 2,
Month = 3,
Year = 4,
Unlimited = 5
}
declare enum LimitType {
CumulatedAmount = 0,
CumulatedNumberOfOperations = 1,
Balance = 2
}
type OperationTypeGroup = Readonly<{
Description: string;
Id: number;
Name: string;
}>;
declare enum UserRole {
None = -1,
Client = 0,
ExtendedClient = 1,
Minor = 2,
Administrator = 3,
ExtendedProfessional = 4,
PSP = 5,
Reseller = 6,
Distributeur = 7,
ClientNotBanked = 8,
ProCashier = 12,
Professional = 15,
BOCustomerRelationship = 16,
CallCenterCustomerRelationship = 17,
BOManager = 18,
ChiefOperatingOfficer = 19,
TechnicalDirector = 20,
OperationManager = 21,
MarketingManager = 22,
BOAdministrator = 23,
FluxManager = 24,
PermanentController = 25,
OAuthClient = 26,
AdministratorPro = 27,
UserPool = 28,
AdministratorThirdParty = 29,
ProOperatorIzly = 30,
ManagerIzly = 31,
RegionalAdministratorIzly = 32,
NationalAdministratorIzly = 33,
CustomerCashAccount = 34,
CashingPointAggregate = 35,
SpacePartnerSuperAdmin = 36,
CommunicationRegional = 38,
CommunicationNational = 39
}
type Role = Readonly<{
Id: number;
Name: string;
Value: UserRole;
}>;
type Limit = Readonly<{
Description: string;
DurationType: DurationType;
Max: number;
Min: number;
OperationType: OperationType;
OperationTypeGroup: null | OperationTypeGroup;
Role: Role;
Type: LimitType;
}>;
declare const limits: (identification: Identification, fetcher?: Fetcher) => Promise<{
CurrentLimits: Array<Limit>;
CurrentRole: number;
ExtendedLimits: Array<Limit>;
ExtendedRole: number;
KycStatus: number;
}>;
declare const login: (identifier: string, secret: string, fetcher?: Fetcher) => Promise<{
salt: string;
uid: string;
}>;
declare enum TransactionGroup {
TopUp = 0,
BankAccountTransfer = 1,
Payments = 2
}
/**
* @returns a list of the last operations
*/
declare const operations: (identification: Identification, group: TransactionGroup, limit?: number, fetcher?: Fetcher) => Promise<Array<Operation>>;
/**
* Generates the payload that are contained
* in the QR codes for the payment in the app.
*/
declare const qrPay: (identification: Identification) => string;
declare enum ClientUserStatus {
ClientAnonymous = 0,
ClientAnonymousWithAddress = 1,
ClientAnonymousBanked = 2,
ClientKYC = 3
}
type Tokens = Readonly<{
AccessToken: string;
ExpiresIn: number;
RefreshToken: string;
TokenType: string;
}>;
declare const refresh: (identification: Identification, secret: string, fetcher?: Fetcher) => Promise<void>;
declare const extractActivationURL: (url: string, fetcher?: Fetcher) => Promise<string>;
declare const tokenize: (url: string, fetcher?: Fetcher) => Promise<{
balance: Readonly<{
cashValue: number;
g7CardValue: number;
lastUpdate: Date;
value: number;
}>;
configuration: Configuration;
identification: Identification;
profile: Profile;
}>;
declare const userEvents: (identification: Identification, itemPerPage?: number, page?: number, fetcher?: Fetcher) => Promise<{
/**
* formatted as `le D/M/YYYY à H:mm AM/PM`
*/
EventFormattedDate: string;
EventMessage: string;
}[]>;
export { type Balance, ClientUserStatus, type Configuration, type Identification, type IzlyCrous, type Limit, NotRefreshableError, type Operation, OperationType, type Profile, ReauthenticateError, type Tokens, TransactionGroup, TransactionGroupStatus, balance, contact, crousContacts, extractActivationURL, information, limits, login, operations, qrPay, refresh, tokenize, userEvents };