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

@luchalupa/csobcz_payment_gateway

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@luchalupa/csobcz_payment_gateway - npm Package Compare versions

Comparing version 0.6.6 to 0.6.8

build/types/Customer.d.ts

2

build/index.d.ts

@@ -21,3 +21,3 @@ import { ApplePayInitPayload, Currency, GooglePayInitPayload, InitPayload, InputPayload, Language, OneClickPaymentInput, PaymentResult, PaymentStatus, ResultCode } from './types/Payment';

refund(id: string, amount: number): Promise<any>;
echo(method?: string, urlPath?: string): Promise<any>;
echo(method?: string, type?: "googlepay" | "applepay"): Promise<any>;
createPayloadMessage(payload: any): any;

@@ -24,0 +24,0 @@ sign(text: string): string;

@@ -39,5 +39,2 @@ "use strict";

try {
console.log('=================================================');
console.log('payload', payload);
console.log('=================================================');
const result = await superagent

@@ -214,3 +211,9 @@ .post(`${this.config.gateUrl}${initUrlPath}`)

}
async echo(method = 'POST', urlPath = '/echo') {
async echo(method = 'POST', type) {
const urlPaths = {
default: "/echo",
googlepay: "/googlepay/echo",
applepay: "/applepay/echo",
};
const urlPath = urlPaths[type] || urlPaths.default;
const payload = {

@@ -217,0 +220,0 @@ merchantId: this.config.merchantId,

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

/// <reference types="node" />
import { Currency } from "./Payment";
export interface Item {

@@ -6,9 +6,31 @@ name: string;

amount: number;
description: string;
description?: string;
}
export interface Order {
id: string;
description: string;
items: Item[];
merchantData: Buffer;
type?: 'purchase' | 'balance' | 'prepaid' | 'cash' | 'check';
availability?: 'now' | 'preorder';
delivery?: 'shipping' | 'shipping_verified' | 'instore' | 'digital' | 'ticket' | 'other';
deliveryMode?: 0 | 1 | 2 | 3;
deliveryEmail?: string;
nameMatch?: boolean;
addressMatch?: boolean;
billing?: Address;
shipping?: Address;
shippingAddedAt?: string;
reorder?: boolean;
giftcards?: GiftCards;
}
export interface Address {
address1: string;
address2?: string;
address3?: string;
city: string;
zip: string;
state?: string;
country: string;
}
export interface GiftCards {
totalAmount?: number;
currency?: Currency;
quantity?: number;
}

@@ -1,2 +0,3 @@

import { Item } from './Order';
import { Customer } from './Customer';
import { Item, Order } from './Order';
export declare enum ResultCode {

@@ -100,9 +101,6 @@ OK = 0,

returnMethod: ReturnMethod;
order?: {
type?: 'purchase' | 'balance' | 'prepaid' | 'cash' | 'check';
availability?: 'now' | 'preorder';
delivery?: 'shipping' | 'shipping_verified' | 'instore' | 'digital' | 'ticket' | 'other';
deliveryMode?: 0 | 1 | 2 | 3;
deliveryEmail?: string;
};
customer?: Customer;
order?: Order;
merchantData?: string;
ttlSec?: number;
}

@@ -115,9 +113,16 @@ export interface InitPayload extends CommonInitPayload {

language: Language;
logoVersion?: number;
colorSchemeVersion?: number;
customExpiry?: number;
}
export interface GooglePayInitPayload extends CommonInitPayload {
clientIp: string;
payload: string;
sdkUsed?: string;
}
export interface ApplePayInitPayload extends CommonInitPayload {
clientIp: string;
payload: string;
sdkUsed?: string;
}
export {};
{
"name": "@luchalupa/csobcz_payment_gateway",
"version": "0.6.6",
"version": "0.6.8",
"description": "CSOB CZ payment gateway module",

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

# ČSOB CZ payment modules [![npm](https://img.shields.io/npm/v/@luchalupa/csobcz_payment_gateway.svg)](https://www.npmjs.com/package/@luchalupa/csobcz_payment_gateway) ![npm type definitions](https://img.shields.io/npm/types/@luchalupa/csobcz_payment_gateway)
[Source](https://github.com/LukasChalupa/node-csobcz-gateway) |
[Gateway documentation](https://github.com/csob/paymentgateway)
Module for ČSOB CZ payment gateway
Module for ČSOB CZ payment gateway, supports gateway version 1.9 (although not all features are yet implemented)

@@ -16,15 +15,18 @@ ## Instalation

## Configuration
### Using environment variables
All keys are strings, for multiline env strings (certificates) check [dotenv#rules](https://www.npmjs.com/package/dotenv#rules).
|variable name | description|
|--------------|------------|
|GATEWAY_URL | payment gateway address|
|MERCHANT_PRIVATE_KEY | merchant private key|
|MERCHANT_PUBLIC_KEY | merchant public key|
|BANK_PUBLIC_KEY | bank public key |
|CALLBACK_URL | url called by gateway after payment|
|MERCHANT_ID | merchant id from gateway provider|
| variable name | description |
| -------------------- | ----------------------------------- |
| GATEWAY_URL | payment gateway address |
| MERCHANT_PRIVATE_KEY | merchant private key |
| MERCHANT_PUBLIC_KEY | merchant public key |
| BANK_PUBLIC_KEY | bank public key |
| CALLBACK_URL | url called by gateway after payment |
| MERCHANT_ID | merchant id from gateway provider |
Alternatively using config:
```javascript

@@ -45,3 +47,3 @@ const { CSOBPaymentModule } = require('csobcz_payment_gateway');

Attribute ```logging``` should be ```boolean``` or ```function``` used for debug info. By setting ```payloadTemplate``` can by overwrited more ```init``` method payload (see [gateway config](https://github.com/csob/paymentgateway/wiki/eAPI-v1.7#-post-httpsapiplatebnibranacsobczapiv17paymentinit-)):
Attribute `logging` should be `boolean` or `function` used for debug info. By setting `payloadTemplate` can by overwrited more `init` method payload (see [gateway config](https://github.com/csob/paymentgateway/wiki/eAPI-v1.7#-post-httpsapiplatebnibranacsobczapiv17paymentinit-)):

@@ -51,8 +53,8 @@ ```json

"merchantId": "...",
"payOperation":"payment",
"payMethod":"card",
"currency":"CZK",
"language":"CZ",
"payOperation": "payment",
"payMethod": "card",
"currency": "CZK",
"language": "CZ",
"returnUrl": "...",
"returnMethod":"POST"
"returnMethod": "POST"
}

@@ -62,18 +64,22 @@ ```

## Available methods
* ```status(string payId)``` - returns payment status
* ```init(json payload)``` - payment init
* ```googlePayInit(json payload)``` - GooglePay payment init (not fully implemented)
* ```applePayInit(json payload)``` - ApplePay payment init (not fully implemented)
* ```reverse(string payId)``` - reverse payment with given payId
* ```close(string payId)``` - close payment with given payId
* ```refund(string payId, int amount)``` - refund payment with given payId, if
amount specified given amount is refunded
* ```echo(string method)``` - echo test, method is either ```GET``` or ```POST``` (default)
* ```verifyResult(json payload)``` - if **success** returns ```payload``` else returns error,
payload is json returned from gateway callback.
-------------------
- `status(string payId)` - returns payment status
- `init(json payload)` - payment init
- `googlePayInit(json payload)` - GooglePay payment init (not fully implemented)
- `applePayInit(json payload)` - ApplePay payment init (not fully implemented)
- `reverse(string payId)` - reverse payment with given payId
- `close(string payId)` - close payment with given payId
- `refund(string payId, int amount)` - refund payment with given payId, if
amount specified given amount is refunded
- `echo(string method)` - echo test, method is either `GET` or `POST` (default)
- `verifyResult(json payload)` - if **success** returns `payload` else returns error,
payload is json returned from gateway callback.
---
### Extra methods
* ```payOrder(json order, boolean close, json options)``` - wrapper for init and getRedirectUrl, ```close``` params is ```closePayment``` value, ```options``` are merged into request payload
order example
- `payOrder(json order, boolean close, json options)` - wrapper for init and getRedirectUrl, `close` params is `closePayment` value, `options` are merged into request payload
order example
```json

@@ -83,3 +89,4 @@ {

"description": "Moje order",
"items": [{
"items": [
{
"name": "Nákup: vasobchod.cz",

@@ -89,13 +96,18 @@ "quantity": 1,

"description": "Produkt 1"
}]
}
]
}
```
allowed is 1-2 items.
* ```getRedirectUrl(string payId)``` - returns gateway url for redirection
- `getRedirectUrl(string payId)` - returns gateway url for redirection
## Return values/format
All methods returns ```Promise``` when **resolved** is ```JSON``` payload specified in
[Gateway documentation](https://github.com/csob/paymentgateway) only **Extra methods** returns custom payload. **Reject** is ```JS Error```.
* ```payOrder```, ```getRedirectUrl``` - returned ```JSON```
All methods returns `Promise` when **resolved** is `JSON` payload specified in
[Gateway documentation](https://github.com/csob/paymentgateway) only **Extra methods** returns custom payload. **Reject** is `JS Error`.
- `payOrder`, `getRedirectUrl` - returned `JSON`
```json

@@ -110,9 +122,12 @@ {

```javascript
const gateway = require('csobcz_payment_gateway');
const gateway = require("csobcz_payment_gateway");
gateway.echo('GET').then(result => {
logger.log(result);
}).catch(e => {
logger.error(e);
});
gateway
.echo("GET")
.then((result) => {
logger.log(result);
})
.catch((e) => {
logger.error(e);
});
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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