Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@commercetools/connect-payments-sdk

Package Overview
Dependencies
Maintainers
12
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commercetools/connect-payments-sdk - npm Package Compare versions

Comparing version 0.4.2 to 0.4.3

6

CHANGELOG.md
# @commercetools/connect-payments-sdk
## 0.4.3
### Patch Changes
- f155772: fix payment modification validations by checking that a payment could contain a cancelAuthorization transaction
## 0.4.2

@@ -4,0 +10,0 @@

17

dist/commercetools/services/ct-payment.service.js

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

}
const totalCancelled = this.calculateTotalAmount(opts.payment, 'CancelAuthorization', opts.payment.amountPlanned.currencyCode);
if (totalCancelled > 0) {
return { isValid: false, reason: `Resource ${opts.payment.id} has already been cancelled.` };
}
const totalCaptured = this.calculateTotalAmount(opts.payment, 'Charge', opts.payment.amountPlanned.currencyCode);

@@ -70,2 +74,6 @@ if (totalCaptured > 0) {

}
const totalCancelled = this.calculateTotalAmount(opts.payment, 'CancelAuthorization', opts.payment.amountPlanned.currencyCode);
if (totalCancelled > 0) {
return { isValid: false, reason: `Resource ${opts.payment.id} has already been cancelled.` };
}
const totalCaptured = this.calculateTotalAmount(opts.payment, 'Charge', opts.amount.currencyCode);

@@ -88,2 +96,6 @@ const allowedAmount = totalAuthorized - totalCaptured;

}
const totalCancelled = this.calculateTotalAmount(opts.payment, 'CancelAuthorization', opts.payment.amountPlanned.currencyCode);
if (totalCancelled > 0) {
return { isValid: false, reason: `Resource ${opts.payment.id} has already been cancelled.` };
}
const totalCaptured = this.calculateTotalAmount(opts.payment, 'Charge', opts.amount.currencyCode);

@@ -160,4 +172,3 @@ if (totalCaptured === 0) {

transaction.interactionId &&
((tx.interactionId && tx.interactionId === transaction.interactionId) ||
(!tx.interactionId && tx.state === 'Initial')));
(tx.interactionId || (!tx.interactionId && tx.state === 'Initial')));
});

@@ -195,3 +206,3 @@ }

.filter((transaction) => transaction.type === type &&
transaction.state === 'Success' &&
(transaction.state === 'Success' || transaction.state === 'Pending') &&
transaction.amount.currencyCode === currencyCode)

@@ -198,0 +209,0 @@ .reduce((total, transaction) => total + transaction.amount.centAmount, 0);

6

package.json
{
"name": "@commercetools/connect-payments-sdk",
"version": "0.4.2",
"version": "0.4.3",
"description": "Payment SDK for commercetools payment connectors",

@@ -18,4 +18,4 @@ "main": "dist/index.js",

"dependencies": {
"@commercetools/platform-sdk": "7.6.0",
"@commercetools/sdk-client-v2": "2.4.0",
"@commercetools/platform-sdk": "7.7.0",
"@commercetools/sdk-client-v2": "2.4.1",
"jsonwebtoken": "9.0.2",

@@ -22,0 +22,0 @@ "jwks-rsa": "3.1.0"

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