Huge News!Announcing our $40M Series B led by Abstract Ventures.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.8 to 0.6.9

8

build/index.d.ts

@@ -1,6 +0,6 @@

import { ApplePayInitPayload, Currency, GooglePayInitPayload, InitPayload, InputPayload, Language, OneClickPaymentInput, PaymentResult, PaymentStatus, ResultCode } from './types/Payment';
import { ApplePayInitPayload, GooglePayInitPayload, InitPayload, InputPayload, OneClickInitPayload, PaymentResult } from './types/Payment';
import { Config } from './types/Config';
import GatewayError from './types/GatewayError';
import VerificationError from './types/VerificationError';
export { Currency, Language, ResultCode, PaymentStatus, GatewayError, VerificationError };
export { GatewayError, VerificationError };
export declare class CSOBPaymentModule {

@@ -14,3 +14,3 @@ private logger;

applePayInit(input: ApplePayInitPayload): Promise<PaymentResult>;
oneClickPayment(input: OneClickPaymentInput): Promise<PaymentResult>;
oneClickPayment(input: OneClickInitPayload): Promise<PaymentResult>;
createPaymentPayload(payload: InputPayload, oneClick: boolean): any;

@@ -22,3 +22,3 @@ getRedirectUrl(id: string): string;

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

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

@@ -17,6 +17,2 @@ "use strict";

const Payment_1 = require("./types/Payment");
exports.Currency = Payment_1.Currency;
exports.Language = Payment_1.Language;
exports.PaymentStatus = Payment_1.PaymentStatus;
exports.ResultCode = Payment_1.ResultCode;
const moment_1 = __importDefault(require("moment"));

@@ -72,3 +68,3 @@ const GatewayError_1 = __importDefault(require("./types/GatewayError"));

payload['signature'] = this.sign(this.createPayloadMessage(payload));
payload['payload'] = '@TODO';
payload['payload'] = input.payload;
return this.commonInit(input, '/googlepay/init');

@@ -81,55 +77,11 @@ }

payload['signature'] = this.sign(this.createPayloadMessage(payload));
payload['payload'] = '@TODO';
payload['payload'] = input.payload;
return this.commonInit(input, '/applepay/init');
}
async oneClickPayment(input) {
const payload = {
merchantId: this.config.merchantId,
origPayId: input.templatePaymentId,
orderNo: input.orderNumber,
dttm: this.createDttm(),
totalAmount: input.amount,
currency: input.currency
};
const payload = input;
payload['merchantId'] = this.config.merchantId;
payload['dttm'] = this.createDttm();
payload['signature'] = this.sign(this.createPayloadMessage(payload));
let result;
try {
result = await superagent
.post(`${this.config.gateUrl}/payment/oneclick/init`)
.send(payload);
if (this.verify(this.createResultMessage(result.body), result.body.signature)) {
if (result.body.resultCode.toString() === '0') {
const startPayload = {
merchantId: this.config.merchantId,
payId: result.body.payId,
dttm: this.createDttm()
};
let startResult;
startPayload['signature'] = this.sign(this.createPayloadMessage(startPayload));
startResult = await superagent
.post(`${this.config.gateUrl}/payment/oneclick/start`)
.send(startPayload);
if (this.verify(this.createResultMessage(startResult.body), startResult.body.signature)) {
if (startResult.body.resultCode.toString() === '0') {
return startResult.body;
}
}
else {
this.logger.error({ result: startResult }, 'Verification failed');
throw new VerificationError_1.default('Verification failed');
}
this.logger.error({ result: startResult }, 'One click payment failed');
}
this.logger.error({ result }, 'One click payment failed');
throw new GatewayError_1.default('Payment failed', result.body);
}
else {
this.logger.error({ result }, 'Verification failed');
throw new VerificationError_1.default('Verification failed');
}
}
catch (err) {
this.logger.error({ err }, 'Unknown error');
throw new Error(err);
}
return this.commonInit(input, '/oneclick/init');
}

@@ -213,3 +165,3 @@ createPaymentPayload(payload, oneClick) {

}
async echo(method = 'POST', type) {
async echo(method = 'POST', type, origPayId) {
const urlPaths = {

@@ -219,2 +171,3 @@ default: "/echo",

applepay: "/applepay/echo",
oneclick: "/oneclick/echo",
};

@@ -225,3 +178,4 @@ const urlPath = urlPaths[type] || urlPaths.default;

dttm: this.createDttm(),
signature: null
origPayId,
signature: null,
};

@@ -228,0 +182,0 @@ payload['signature'] = this.sign(this.createPayloadMessage(payload));

@@ -126,2 +126,8 @@ import { Customer } from './Customer';

}
export interface OneClickInitPayload extends CommonInitPayload {
origPayId?: string;
clientIp?: string;
clientInitiated?: boolean;
sdkUsed?: string;
}
export {};
{
"name": "@luchalupa/csobcz_payment_gateway",
"version": "0.6.8",
"version": "0.6.9",
"description": "CSOB CZ payment gateway module",

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

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