@commercetools/connect-payments-sdk
Advanced tools
Comparing version 0.4.2 to 0.4.3
# @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 @@ |
@@ -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); |
{ | ||
"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" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
107588
2766
+ Added@commercetools/platform-sdk@7.7.0(transitive)
+ Added@commercetools/sdk-client-v2@2.4.1(transitive)
- Removed@commercetools/platform-sdk@7.6.0(transitive)
- Removed@commercetools/sdk-client-v2@2.4.0(transitive)