New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@yosle/tropipayjs

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yosle/tropipayjs - npm Package Compare versions

Comparing version 0.1.15 to 0.1.16

src/utils/errors.ts

3

index.d.ts

@@ -228,3 +228,3 @@ import { Axios } from 'axios';

swift?: string;
type?: number;
type: DepositAccountType;
firstName?: string;

@@ -247,2 +247,3 @@ lastName?: string;

type BeneficiaryType = INTERNAL | EXTERNAL;
type DepositAccountType = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11;

@@ -249,0 +250,0 @@ declare class DepositAccounts {

@@ -31,2 +31,47 @@ 'use strict';

function handleExceptions(error) {
if (error instanceof axios.AxiosError) {
if (error.response) {
const axiosResponse = error.response;
const errorMessage = axiosResponse.data?.error?.message || "An error occurred";
switch (axiosResponse.status) {
case 401:
return new TropipayJSException(errorMessage, axiosResponse.status, axiosResponse.data.error);
case 403:
return new TropipayJSException(errorMessage, axiosResponse.status, axiosResponse.data.error);
case 404:
return new TropipayJSException(errorMessage, axiosResponse.status, axiosResponse.data.error);
// case 429:
// return new TooManyRequestsException(errorMessage);
default:
return new TropipayJSException(errorMessage, axiosResponse.status, axiosResponse.data.error);
}
}
else if (error.request) {
// Axios request was made but no response received (e.g., network error)
return new TropipayJSException("Request failed: No response received", 500, null);
}
else {
// Something else went wrong
return new TropipayJSException("An error occurred", 500, null);
}
}
else {
return new TropipayJSException(`jsbfvbsfvbf`, 500, null);
}
}
class TropipayJSException extends Error {
code; // Status code
error;
message;
constructor(message, code, data) {
super(message);
// Set the prototype explicitly.
Object.setPrototypeOf(this, TropipayJSException.prototype);
this.code = code;
this.error = data;
this.message = message;
}
}
class TropipayHooks {

@@ -73,3 +118,3 @@ tropipay;

catch (error) {
throw new Error(`Could not get subscribe new hook`);
throw handleExceptions(error);
}

@@ -99,3 +144,3 @@ }

catch (error) {
throw new Error(`Could not get subscribed hooks`);
throw handleExceptions(error);
}

@@ -122,3 +167,3 @@ }

catch (error) {
throw new Error(`Could not update subscribed hooks`);
throw handleExceptions(error);
}

@@ -142,3 +187,3 @@ }

console.trace(error);
throw new Error(`Could not delete subscribed hooks`);
throw handleExceptions(error);
}

@@ -161,3 +206,3 @@ }

catch (error) {
throw new Error(`Could not get events list for hooks ${error}`);
throw handleExceptions(error);
}

@@ -193,3 +238,3 @@ }

catch (error) {
throw new Error(`TropipayJS - Error creating the Payment Card.`);
throw handleExceptions(error);
}

@@ -235,3 +280,3 @@ }

catch (error) {
throw new Error(`Could not retrieve PaymenCards`);
throw handleExceptions(error);
}

@@ -265,3 +310,3 @@ }

catch (error) {
throw new Error(`Could not retrieve PaymenCards list`);
return handleExceptions(error);
}

@@ -289,3 +334,3 @@ }

catch (error) {
throw new Error(`TropipayJS - Error creating the Deposit Accounts.`);
return handleExceptions(error);
}

@@ -314,3 +359,3 @@ }

catch (error) {
throw new Error(`Could not retrieve deposit account`);
return handleExceptions(error);
}

@@ -338,3 +383,3 @@ }

catch (error) {
throw new Error(`Could not retrieve deposit account`);
return handleExceptions(error);
}

@@ -362,3 +407,3 @@ }

catch (error) {
throw new Error(`Could not retrieve deposit account`);
return handleExceptions(error);
}

@@ -420,6 +465,3 @@ }

catch (error) {
if (axios__default["default"].isAxiosError(error)) {
throw new Error(`Could not obtain the access token from credentials ${error}`);
}
throw new Error(`Could not obtain the access token from credentials ${error}`);
throw handleExceptions(error);
}

@@ -447,3 +489,3 @@ }

catch (error) {
throw new Error(`Could not retrieve the account deposits ${error}`);
throw handleExceptions(error);
}

@@ -462,3 +504,3 @@ }

catch (error) {
throw new Error(`Could not retrieve the countries list`);
throw handleExceptions(error);
}

@@ -485,3 +527,3 @@ }

catch (error) {
throw new Error(`TropipayJS Error - Could not retrieve the user's balance`);
throw handleExceptions(error);
}

@@ -525,3 +567,3 @@ }

catch (error) {
throw new Error(`Could not retrieve favorites list ${error}`);
throw handleExceptions(error);
}

@@ -549,3 +591,3 @@ }

catch (error) {
throw new Error(`Could not retrieve movements list ${error}`);
throw handleExceptions(error);
}

@@ -565,3 +607,3 @@ }

catch (error) {
throw new Error(`Could not retrieve movements list ${error}`);
throw handleExceptions(error);
}

@@ -595,3 +637,3 @@ }

catch (error) {
throw new Error(`Could not retrieve rates ${error}`);
throw handleExceptions(error);
}

@@ -622,3 +664,3 @@ }

catch (error) {
throw new Error(`Could not create mediation payment card`);
throw handleExceptions(error);
}

@@ -628,3 +670,5 @@ }

class ClientSideUtils {
constructor(tropipayInstance) { }
constructor(tropipayInstance) {
throw Error(`Not implemented yet`);
}
}

@@ -631,0 +675,0 @@

@@ -9,3 +9,3 @@ export interface DepositAccountConfig {

swift?: string;
type?: number;
type: DepositAccountType;
firstName?: string;

@@ -28,2 +28,43 @@ lastName?: string;

export type BeneficiaryType = INTERNAL | EXTERNAL;
export declare const DepositAccountTypesList: {
/**
* Banco Metropolitano (Cuba) Bank Account
*/
readonly BANMET_BANK_ACCOUNT: 0;
/**
* Banco Popular de Ahorro
*/
readonly BPA_BANK_ACCOUNT: 1;
/**
* Banco de Credito y Comercio (Cuba) Bank Account
*/
readonly BANDEC_BANK_ACCOUNT: 2;
/**
* Banco Metropilitano (Cuba) card
*/
readonly BANMET_CARD: 3;
/**
* Banco Popular de Ahorro (Cuba) card
*/
readonly BPA_CARD: 4;
/**
* Not available anymore
* @deprecated
*/
readonly AIS_CUC_CARD: 5;
/**
* Not available
* @deprecated
*/
readonly AIS_USD_CARD: 6;
/**
* For international bank accounts
*/
readonly OTHER: 7;
/**
* Banco de Credito y comercio card
*/
readonly BANDEC_CARD: 8;
};
export type DepositAccountType = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11;
export {};
{
"name": "@yosle/tropipayjs",
"version": "0.1.15",
"version": "0.1.16",
"description": "Javascript / Typescript SDK for the Tropipay API",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -23,2 +23,3 @@ /**

import { DepositAccounts } from "../depositAccount/depositAccounts";
import { handleExceptions } from "../utils/errors";
export class Tropipay {

@@ -78,10 +79,3 @@ readonly clientId: string;

} catch (error) {
if (axios.isAxiosError(error)) {
throw new Error(
`Could not obtain the access token from credentials ${error}`
);
}
throw new Error(
`Could not obtain the access token from credentials ${error}`
);
throw handleExceptions(error as any);
}

@@ -109,3 +103,3 @@ }

} catch (error) {
throw new Error(`Could not retrieve the account deposits ${error}`);
throw handleExceptions(error as any);
}

@@ -124,3 +118,3 @@ }

} catch (error) {
throw new Error(`Could not retrieve the countries list`);
throw handleExceptions(error as any);
}

@@ -146,5 +140,3 @@ }

} catch (error) {
throw new Error(
`TropipayJS Error - Could not retrieve the user's balance`
);
throw handleExceptions(error as any);
}

@@ -193,3 +185,3 @@ }

} catch (error) {
throw new Error(`Could not retrieve favorites list ${error}`);
throw handleExceptions(error as any);
}

@@ -217,3 +209,3 @@ }

} catch (error) {
throw new Error(`Could not retrieve movements list ${error}`);
throw handleExceptions(error as any);
}

@@ -232,3 +224,3 @@ }

} catch (error) {
throw new Error(`Could not retrieve movements list ${error}`);
throw handleExceptions(error as any);
}

@@ -269,3 +261,3 @@ }

} catch (error) {
throw new Error(`Could not retrieve rates ${error}`);
throw handleExceptions(error as any);
}

@@ -301,3 +293,3 @@ }

} catch (error) {
throw new Error(`Could not create mediation payment card`);
throw handleExceptions(error as any);
}

@@ -308,3 +300,5 @@ }

export class ClientSideUtils {
constructor(tropipayInstance: Tropipay) {}
constructor(tropipayInstance: Tropipay) {
throw Error(`Not implemented yet`);
}
}

@@ -0,4 +1,5 @@

import { AxiosError } from "axios";
import { Tropipay } from "../api/TropipayAPI";
import { DepositAccountConfig } from "../interfaces/depositaccounts";
import { handleExceptions } from "../utils/errors";
export class DepositAccounts {

@@ -31,3 +32,3 @@ private tropipay: Tropipay;

} catch (error) {
throw new Error(`Could not retrieve PaymenCards list`);
return handleExceptions(error as unknown as any);
}

@@ -58,3 +59,3 @@ }

} catch (error) {
throw new Error(`TropipayJS - Error creating the Deposit Accounts.`);
return handleExceptions(error as unknown as any);
}

@@ -85,3 +86,3 @@ }

} catch (error) {
throw new Error(`Could not retrieve deposit account`);
return handleExceptions(error as unknown as any);
}

@@ -112,3 +113,3 @@ }

} catch (error) {
throw new Error(`Could not retrieve deposit account`);
return handleExceptions(error as unknown as any);
}

@@ -139,5 +140,5 @@ }

} catch (error) {
throw new Error(`Could not retrieve deposit account`);
return handleExceptions(error as unknown as any);
}
}
}
import { HookEventType, UserHookSubscribed } from "../interfaces";
import { Tropipay } from "../api/TropipayAPI";
import { handleExceptions } from "../utils/errors";
export class TropipayHooks {

@@ -55,3 +56,3 @@ private tropipay: Tropipay;

} catch (error) {
throw new Error(`Could not get subscribe new hook`);
throw handleExceptions(error as unknown as any);
}

@@ -83,3 +84,3 @@ }

} catch (error) {
throw new Error(`Could not get subscribed hooks`);
throw handleExceptions(error as unknown as any);
}

@@ -113,3 +114,3 @@ }

} catch (error) {
throw new Error(`Could not update subscribed hooks`);
throw handleExceptions(error as unknown as any);
}

@@ -135,3 +136,3 @@ }

console.trace(error);
throw new Error(`Could not delete subscribed hooks`);
throw handleExceptions(error as unknown as any);
}

@@ -154,5 +155,5 @@ }

} catch (error) {
throw new Error(`Could not get events list for hooks ${error}`);
throw handleExceptions(error as unknown as any);
}
}
}

@@ -9,3 +9,3 @@ export interface DepositAccountConfig {

swift?: string;
type?: number;
type: DepositAccountType;
firstName?: string;

@@ -29,1 +29,44 @@ lastName?: string;

export type BeneficiaryType = INTERNAL | EXTERNAL;
export const DepositAccountTypesList = {
/**
* Banco Metropolitano (Cuba) Bank Account
*/
BANMET_BANK_ACCOUNT: 0,
/**
* Banco Popular de Ahorro
*/
BPA_BANK_ACCOUNT: 1,
/**
* Banco de Credito y Comercio (Cuba) Bank Account
*/
BANDEC_BANK_ACCOUNT: 2,
/**
* Banco Metropilitano (Cuba) card
*/
BANMET_CARD: 3,
/**
* Banco Popular de Ahorro (Cuba) card
*/
BPA_CARD: 4,
/**
* Not available anymore
* @deprecated
*/
AIS_CUC_CARD: 5,
/**
* Not available
* @deprecated
*/
AIS_USD_CARD: 6,
/**
* For international bank accounts
*/
OTHER: 7,
/**
* Banco de Credito y comercio card
*/
BANDEC_CARD: 8,
} as const;
export type DepositAccountType = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11;
import { Tropipay } from "../api/TropipayAPI";
import { PaymentLink } from "../interfaces";
import { PaymentLinkPayload } from "../interfaces";
import { handleExceptions } from "../utils/errors";
export class PaymentCard {

@@ -34,3 +35,3 @@ private tropipay: Tropipay;

} catch (error) {
throw new Error(`TropipayJS - Error creating the Payment Card.`);
throw handleExceptions(error as unknown as any);
}

@@ -81,5 +82,5 @@ }

} catch (error) {
throw new Error(`Could not retrieve PaymenCards`);
throw handleExceptions(error as unknown as any);
}
}
}
import * as crypto from "crypto";
import { Tropipay } from "../api/TropipayAPI";
import { AxiosError, AxiosResponse } from "axios";
export class ServerSideUtils {

@@ -4,0 +7,0 @@ private tropipay: Tropipay;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc