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

@falaleev/payment-sdk

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@falaleev/payment-sdk - npm Package Compare versions

Comparing version 1.0.5 to 1.0.7

2

dist/gen/payment/payment.d.ts

@@ -59,3 +59,3 @@ import { type CallContext, type CallOptions } from "nice-grpc-common";

url: string;
original_error: string;
original_error?: string | undefined;
}

@@ -62,0 +62,0 @@ export interface InfoReq {

@@ -7,2 +7,3 @@ "use strict";

var payment_1 = require("./gen/payment/payment");
var nice_grpc_error_details_1 = require("nice-grpc-error-details");
var defaultEndpoint = 'grpc.payment.falaleev.pro:443';

@@ -13,5 +14,5 @@ var createClient = function (token) { return create(defaultEndpoint, token); };

var channel = new nice_grpc_1.Channel(endpoint, grpc_js_1.ChannelCredentials.createSsl(), {});
return (0, nice_grpc_1.createClientFactory)().create(payment_1.PaymentSvcDefinition, channel, {
return (0, nice_grpc_1.createClientFactory)().use(nice_grpc_error_details_1.errorDetailsClientMiddleware).create(payment_1.PaymentSvcDefinition, channel, {
"*": { metadata: (new nice_grpc_1.Metadata()).set('x-api-key', token) }
});
};
{
"name": "@falaleev/payment-sdk",
"version": "1.0.5",
"version": "1.0.7",
"main": "dist/index.js",

@@ -22,2 +22,3 @@ "types": "dist/index.d.ts",

"nice-grpc": "^2.1.8",
"nice-grpc-error-details": "^0.2.5",
"protobufjs": "^7.3.0",

@@ -24,0 +25,0 @@ "ts-proto": "^1.176.1",

@@ -1,25 +0,69 @@

```typescript
import { createClient } from ".";
import { ClientError } from "nice-grpc";
```javascript
const sdk = require('@falaleev/payment-sdk');
const { ClientError, Status } = require('nice-grpc');
const { RichClientError, BadRequest } = require('nice-grpc-error-details');
const client = createClient(
process.env.PAYMENT_TOKEN || 'unknown'
);
const client = sdk.createClient(process.env.PAYMENT_TOKEN || '');
try {
const result = await client.methodList({});
console.log(result);
} catch (e) {
if (e instanceof ClientError) {
console.error({
details: e.details,
name: e.name,
message: e.message,
code: e.code,
path: e.path,
function handleErr(error) {
const validationErrors = {};
if (
error instanceof ClientError &&
error.code === Status.INVALID_ARGUMENT
) {
if (false === error.hasOwnProperty('extra')) {
return;
}
for (const detail of error.extra) {
if (detail.$type !== BadRequest.$type) {
continue
}
for (const violation of detail.fieldViolations) {
if (validationErrors.hasOwnProperty(violation.field)) {
validationErrors[violation.field].push(violation.description);
} else {
validationErrors[violation.field] = [violation.description];
}
}
}
}
if (Object.keys(validationErrors).length > 0) {
console.group('validation errors');
console.log(validationErrors);
console.groupEnd();
} else {
console.error(error);
}
}
async function main() {
try {
const result = await client.create({
method: 0,
duration: 60,
customer: { name: 'ivan bobrov', email: 'vanya@mail.ru', phone: '+79123492503' },
items: [
{
qty: 1,
price: 19098,
name: 'demoror adulatio **test** (abutor assentator **test**)'
}
],
order_uuid: '722cf002-270d-449b-b3a7-3d87f981abc2'
});
console.log(result);
} catch (error) {
handleErr(error);
}
}
process.exit(0);
function shutdown() {
process.exit(0);
}
main().then(shutdown).catch(shutdown);
```

Sorry, the diff of this file is too big to display

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