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.2 to 0.1.4

dist/index.d.ts

57

index.d.ts

@@ -0,1 +1,40 @@

import { Axios } from 'axios';
interface PaymentLinkPayload {
reference: string;
concept: string;
favorite: boolean;
amount: number;
currency: string;
description: string;
singleUse: boolean;
reasonId: number;
expirationDays: number;
lang: string;
urlSuccess: string;
urlFailed: string;
urlNotification: string;
serviceDate: string;
client: {
name: string;
lastName: string;
address: string;
phone: string;
email: string;
countryId: number;
termsAndConditions: boolean;
};
directPayment: boolean;
paymentMethods?: string[];
}
interface PaymentLink extends PaymentLinkPayload {
expirationDate: string;
hasClient: boolean;
updatedAt: string;
createdAt: string;
qrImage: string;
shortUrl: string;
paymentUrl: string;
}
/**

@@ -7,4 +46,3 @@ * Tropipayjs is a wrapper for the Tropipay API. It was made in

*/
import { Axios } from "axios";
import { PaymentLink, PaymentLinkPayload } from './interfaces/paymentlink';
declare type ServerMode = 'Development' | 'Production';

@@ -24,3 +62,3 @@ declare class Tropipay {

* @returns Promise<PaymentLink> or Error
* @see {https} ://tpp.stoplight.io/docs/tropipay-api-doc/b3A6ODgyNTM3OQ-create-a-new-pay-link-charge
* @see https://tpp.stoplight.io/docs/tropipay-api-doc/b3A6ODgyNTM3OQ-create-a-new-pay-link-charge
*/

@@ -30,3 +68,3 @@ createPayLink(payload: PaymentLinkPayload): Promise<PaymentLink>;

* Get all deposits in this account.
* @returns Promise of AccountDeposits Object or Error
* @returns A Promise of an Array of AccountDeposits or throws an Exception
* @see https://tpp.stoplight.io/docs/tropipay-api-doc/b3A6OTgyOTQ1Mg-get-deposit-accounts-list

@@ -36,4 +74,4 @@ */

/**
* Get the list of all supported countries.
* @returns
* Get the list of all supported countries by Tropipay.
* @returns Array of Countries
* @see

@@ -43,3 +81,3 @@ */

/**
*
* Get list of all the favorites accounts.
* @returns

@@ -56,3 +94,3 @@ * @see

/**
* Return user profile
* Return profile data for this account.
* @returns

@@ -65,2 +103,3 @@ */

}
export default Tropipay;
export { Tropipay };

287

index.js

@@ -1,2 +0,11 @@

"use strict";
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var axios = require('axios');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
/**

@@ -8,17 +17,9 @@ * Tropipayjs is a wrapper for the Tropipay API. It was made in

*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const axios_1 = __importDefault(require("axios"));
class Tropipay {
client_id;
client_secret;
request;
access_token;
refresh_token;
server_mode;
constructor(client_id, client_secret, server_mode = 'Development') {

@@ -28,3 +29,3 @@ this.client_id = client_id;

this.server_mode = server_mode;
this.request = axios_1.default.create({
this.request = axios__default["default"].create({
baseURL: this.server_mode === 'Production'

@@ -40,28 +41,26 @@ ? 'https://www.tropipay.com'

}
login() {
return __awaiter(this, void 0, void 0, function* () {
try {
const { data } = yield this.request.post('/api/v2/access/token', {
client_id: this.client_id,
client_secret: this.client_secret,
grant_type: "client_credentials",
scope: "ALLOW_GET_PROFILE_DATA ALLOW_PAYMENT_IN ALLOW_EXTERNAL_CHARGE KYC3_FULL_ALLOW ALLOW_PAYMENT_OUT ALLOW_MARKET_PURCHASES ALLOW_GET_BALANCE ALLOW_GET_MOVEMENT_LIST ALLOW_GET_CREDENTIAL "
}, {
// headers: {
// 'Content-Type': 'application/json',
// Accept: 'application/json',
// }
});
this.access_token = data.access_token;
this.refresh_token = data.refresh_token;
return data;
async login() {
try {
const { data } = await this.request.post('/api/v2/access/token', {
client_id: this.client_id,
client_secret: this.client_secret,
grant_type: "client_credentials",
scope: "ALLOW_GET_PROFILE_DATA ALLOW_PAYMENT_IN ALLOW_EXTERNAL_CHARGE KYC3_FULL_ALLOW ALLOW_PAYMENT_OUT ALLOW_MARKET_PURCHASES ALLOW_GET_BALANCE ALLOW_GET_MOVEMENT_LIST ALLOW_GET_CREDENTIAL "
}, {
// headers: {
// 'Content-Type': 'application/json',
// Accept: 'application/json',
// }
});
this.access_token = data.access_token;
this.refresh_token = data.refresh_token;
return data;
}
catch (error) {
if (axios__default["default"].isAxiosError(error)) {
// 👇️ error: AxiosError<any, any>
throw new Error("Conection error: " + error.message);
}
catch (error) {
if (axios_1.default.isAxiosError(error)) {
// 👇️ error: AxiosError<any, any>
throw new Error("Conection error: " + error.message);
}
throw new Error("Could not obtain the access token from credentials ");
}
});
throw new Error("Could not obtain the access token from credentials ");
}
}

@@ -74,21 +73,19 @@ /**

*/
createPayLink(payload) {
return __awaiter(this, void 0, void 0, function* () {
if (!this.access_token) {
yield this.login();
}
try {
const paylink = yield this.request.post('/api/v2/paymentcards', payload, {
headers: {
// 'Content-Type': 'application/json',
Authorization: `Bearer ${this.access_token}`,
// Accept: 'application/json'
}
});
return paylink.data;
}
catch (error) {
throw new Error(`Error tryng to get the access token`);
}
});
async createPayLink(payload) {
if (!this.access_token) {
await this.login();
}
try {
const paylink = await this.request.post('/api/v2/paymentcards', payload, {
headers: {
// 'Content-Type': 'application/json',
Authorization: `Bearer ${this.access_token}`,
// Accept: 'application/json'
}
});
return paylink.data;
}
catch (error) {
throw new Error(`Error tryng to get the access token`);
}
}

@@ -100,15 +97,13 @@ /**

*/
getDepositAccounts() {
return __awaiter(this, void 0, void 0, function* () {
if (!this.access_token) {
yield this.login();
}
try {
const deposits = yield this.request.get('/api/v2/deposit_accounts', {});
return deposits.data;
}
catch (error) {
throw new Error(`Could not retrieve the account deposits ${error}`);
}
});
async getDepositAccounts() {
if (!this.access_token) {
await this.login();
}
try {
const deposits = await this.request.get('/api/v2/deposit_accounts', {});
return deposits.data;
}
catch (error) {
throw new Error(`Could not retrieve the account deposits ${error}`);
}
}

@@ -120,15 +115,13 @@ /**

*/
countries() {
return __awaiter(this, void 0, void 0, function* () {
if (!this.access_token) {
yield this.login();
}
try {
const countries = yield this.request.get('/api/countries');
return countries.data;
}
catch (error) {
throw new Error(`Could not retrieve the countries list`);
}
});
async countries() {
if (!this.access_token) {
await this.login();
}
try {
const countries = await this.request.get('/api/countries');
return countries.data;
}
catch (error) {
throw new Error(`Could not retrieve the countries list`);
}
}

@@ -140,15 +133,13 @@ /**

*/
favorites() {
return __awaiter(this, void 0, void 0, function* () {
if (!this.access_token) {
yield this.login();
}
try {
const favorites = yield this.request.get('/api/v2/paymentcards/favorites');
return favorites.data;
}
catch (error) {
throw new Error(`Could not retrieve favorites list`);
}
});
async favorites() {
if (!this.access_token) {
await this.login();
}
try {
const favorites = await this.request.get('/api/v2/paymentcards/favorites');
return favorites.data;
}
catch (error) {
throw new Error(`Could not retrieve favorites list`);
}
}

@@ -160,20 +151,18 @@ /**

*/
movements(offset = 0, limit = 10) {
return __awaiter(this, void 0, void 0, function* () {
if (!this.access_token) {
yield this.login();
}
try {
const movements = yield this.request.get('/api/v2/movements', { params: { limit: limit, offset: offset },
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
Authorization: `Bearer ${this.access_token}`,
} });
return movements.data;
}
catch (error) {
throw new Error(`Could not retrieve movements list`);
}
});
async movements(offset = 0, limit = 10) {
if (!this.access_token) {
await this.login();
}
try {
const movements = await this.request.get('/api/v2/movements', { params: { limit: limit, offset: offset },
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
Authorization: `Bearer ${this.access_token}`,
} });
return movements.data;
}
catch (error) {
throw new Error(`Could not retrieve movements list`);
}
}

@@ -184,37 +173,35 @@ /**

*/
profile() {
return __awaiter(this, void 0, void 0, function* () {
if (!this.access_token) {
yield this.login();
}
try {
const profile = yield this.request.get('/api/users/profile');
return profile.data;
}
catch (error) {
throw new Error(`Could not retrieve movements list ${error}`);
}
});
async profile() {
if (!this.access_token) {
await this.login();
}
try {
const profile = await this.request.get('/api/users/profile');
return profile.data;
}
catch (error) {
throw new Error(`Could not retrieve movements list ${error}`);
}
}
getRates(payload = { currencyFrom: "EUR" }) {
return __awaiter(this, void 0, void 0, function* () {
console.log(payload);
if (!this.access_token) {
yield this.login();
}
try {
const rates = yield this.request.post('/api/v2/movements/get_rate', { payload,
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
Authorization: `Bearer ${this.access_token}`,
} });
return rates.data;
}
catch (error) {
throw new Error(`Could not retrieve rates ${error}`);
}
});
async getRates(payload = { currencyFrom: "EUR" }) {
console.log(payload);
if (!this.access_token) {
await this.login();
}
try {
const rates = await this.request.post('/api/v2/movements/get_rate', { payload,
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
Authorization: `Bearer ${this.access_token}`,
} });
return rates.data;
}
catch (error) {
throw new Error(`Could not retrieve rates ${error}`);
}
}
}
exports.default = Tropipay;
exports.Tropipay = Tropipay;
//# sourceMappingURL=index.js.map

@@ -15,3 +15,3 @@ /**

class Tropipay {
export class Tropipay {
readonly client_id: string;

@@ -213,4 +213,3 @@ readonly client_secret: string;

export default Tropipay
"use strict";
//# sourceMappingURL=index.js.map
"use strict";
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=index.js.map
{
"name": "@yosle/tropipayjs",
"version": "0.1.2",
"description": " Javascript / Typescript SDK for Tropipay API",
"version": "0.1.4",
"description": "Javascript / Typescript SDK for the Tropipay API",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc"
"_clear": "rimraf build/compiled/*",
"_tsc": "tsc",
"_make-bundle": "rollup --config",
"build": "run-s _clear _tsc _make-bundle"
},

@@ -25,4 +28,12 @@ "repository": {

"dependencies": {
"axios": "^0.27.2"
"axios": "^0.27.2",
"tslib": "^2.4.0"
},
"devDependencies": {
"@rollup/plugin-typescript": "^8.5.0",
"rimraf": "^3.0.2",
"rollup": "^2.79.1",
"rollup-plugin-dts": "^4.2.2",
"run-s": "^0.0.0"
}
}
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */
/* Projects */

@@ -12,5 +11,4 @@ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */

// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
/* Language and Environment */
"target": "es2015", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */

@@ -27,7 +25,6 @@ // "jsx": "preserve", /* Specify what JSX code is generated. */

// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
/* Modules */
"module": "commonjs", /* Specify what module code is generated. */
"module": "esnext", /* Specify what module code is generated. */
// "rootDir": "./", /* Specify the root folder within your source files. */
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */

@@ -42,3 +39,2 @@ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */

// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
/* JavaScript Support */

@@ -48,11 +44,10 @@ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */

// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
/* Emit */
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
// "outDir": "./", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
"outDir": "dist/", /* Specify an output folder for all emitted files. */
"removeComments": false, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */

@@ -74,12 +69,10 @@ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */

// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
/* Interop Constraints */
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
/* Type Checking */
"strict": true, /* Enable all strict type-checking options. */
"strict": true, /* Enable all strict type-checking options. */
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */

@@ -102,8 +95,7 @@ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */

// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
"allowUnreachableCode": false, /* Disable error reporting for unreachable code. */
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
}
}
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