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.2.1 to 0.2.2

6

CHANGELOG.md
# @commercetools/connect-payments-sdk
## 0.2.2
### Patch Changes
- b87b064: added support for retrieving the merchant return url from the session
## 0.2.1

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

1

dist/commercetools/services/ct-cart.service.d.ts

@@ -17,2 +17,3 @@ import { CartService, CartServiceOptions, GetCart, GetPaymentAmount } from '../types/cart.type';

private wasPaymentReverted;
private isPaymentApproved;
}

12

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

@@ -85,6 +85,6 @@ "use strict";

}
return payment.transactions
.filter((transaction) => (transaction.state === 'Success' || transaction.state === 'Pending') &&
(transaction.type === 'Authorization' || transaction.type === 'Charge'))
.reduce((total, transaction) => total + transaction.amount.centAmount, 0);
if (this.isPaymentApproved(payment)) {
return payment.amountPlanned.centAmount;
}
return 0;
}

@@ -95,3 +95,7 @@ wasPaymentReverted(payment) {

}
isPaymentApproved(payment) {
return payment.transactions.some((transaction) => (transaction.state === 'Success' || transaction.state === 'Pending') &&
(transaction.type === 'Authorization' || transaction.type === 'Charge'));
}
}
exports.DefaultCartService = DefaultCartService;

@@ -18,2 +18,3 @@ import { AuthorizationService, CommercetoolsToken } from '../types/authorization.type';

getPaymentInterfaceFromSession(session: Session): string | undefined;
getMerchantReturnUrlFromSession(session: Session): string | undefined;
}

@@ -50,3 +50,6 @@ "use strict";

}
getMerchantReturnUrlFromSession(session) {
return session.metadata?.merchantReturnUrl;
}
}
exports.DefaultSessionService = DefaultSessionService;

@@ -30,2 +30,3 @@ export type Session = {

getPaymentInterfaceFromSession(session: Session): string | undefined;
getMerchantReturnUrlFromSession(session: Session): string | undefined;
}

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

paymentInterface: this.sessionService.getPaymentInterfaceFromSession(session),
merchantReturnUrl: this.sessionService.getMerchantReturnUrlFromSession(session),
});

@@ -22,0 +23,0 @@ }

@@ -20,2 +20,3 @@ export interface AuthenticationManager {

paymentInterface?: string;
merchantReturnUrl?: string;
};

@@ -22,0 +23,0 @@ export type Oauth2Principal = {

{
"name": "@commercetools/connect-payments-sdk",
"version": "0.2.1",
"version": "0.2.2",
"description": "Payment SDK for commercetools payment connectors",

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

"dependencies": {
"@commercetools/platform-sdk": "7.3.0",
"@commercetools/platform-sdk": "7.4.0",
"@commercetools/sdk-client-v2": "2.3.0",

@@ -21,0 +21,0 @@ "jsonwebtoken": "9.0.2",

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