Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(payments): update to new version of payments-sdk and fix the issues #70

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 33 additions & 35 deletions processor/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions processor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
"dependencies": {
"@adyen/api-library": "16.1.0",
"@commercetools-backend/loggers": "22.20.0",
"@commercetools/connect-payments-sdk": "0.3.0",
"@commercetools/platform-sdk": "7.4.0",
"@commercetools/sdk-client-v2": "2.3.0",
"@commercetools/connect-payments-sdk": "0.4.0",
"@fastify/autoload": "5.8.0",
"@fastify/cors": "9.0.1",
"@fastify/formbody": "7.4.0",
Expand Down Expand Up @@ -57,4 +55,4 @@
"ts-node": "10.9.2",
"typescript": "5.4.2"
}
}
}
2 changes: 1 addition & 1 deletion processor/src/services/abstract-payment.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
CommercetoolsPaymentService,
ErrorInvalidJsonInput,
ErrorInvalidOperation,
Payment,
} from '@commercetools/connect-payments-sdk';
import {
CancelPaymentRequest,
Expand All @@ -18,7 +19,6 @@ import {
PaymentIntentResponseSchemaDTO,
PaymentModificationStatus,
} from '../dtos/operations/payment-intents.dto';
import { Payment } from '@commercetools/platform-sdk';
import { SupportedPaymentComponentsSchemaDTO } from '../dtos/operations/payment-componets.dto';

export abstract class AbstractPaymentService {
Expand Down
3 changes: 2 additions & 1 deletion processor/src/services/adyen-payment.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import {
ErrorInvalidOperation,
healthCheckCommercetoolsPermissions,
statusHandler,
Cart,
Payment,
} from '@commercetools/connect-payments-sdk';
import {
ConfirmPaymentRequestDTO,
Expand Down Expand Up @@ -46,7 +48,6 @@ import { SupportedPaymentComponentsSchemaDTO } from '../dtos/operations/payment-
import { PaymentDetailsResponse } from '@adyen/api-library/lib/src/typings/checkout/paymentDetailsResponse';
import { CancelPaymentConverter } from './converters/cancel-payment.converter';
import { RefundPaymentConverter } from './converters/refund-payment.converter';
import { Cart, Payment } from '@commercetools/platform-sdk';
const packageJSON = require('../../package.json');

export type AdyenPaymentServiceOptions = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PaymentRequest } from '@adyen/api-library/lib/src/typings/checkout/paymentRequest';
import { config } from '../../config/config';
import { ThreeDSRequestData } from '@adyen/api-library/lib/src/typings/checkout/threeDSRequestData';
import { Cart, Payment } from '@commercetools/platform-sdk';
import { Cart, Payment } from '@commercetools/connect-payments-sdk';
import { buildReturnUrl, populateCartAddress, populateLineItems } from './helper.converter';
import { CreatePaymentRequestDTO } from '../../dtos/adyen-payment.dto';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CreateCheckoutSessionRequest } from '@adyen/api-library/lib/src/typings
import { config } from '../../config/config';
import { buildReturnUrl, convertAllowedPaymentMethodsToAdyenFormat, populateCartAddress } from './helper.converter';
import { CreateSessionRequestDTO } from '../../dtos/adyen-payment.dto';
import { Cart, Payment } from '@commercetools/platform-sdk';
import { Cart, Payment } from '@commercetools/connect-payments-sdk';

export class CreateSessionConverter {
constructor() {}
Expand Down
7 changes: 6 additions & 1 deletion processor/src/services/converters/helper.converter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { Address } from '@adyen/api-library/lib/src/typings/checkout/address';
import { LineItem } from '@adyen/api-library/lib/src/typings/checkout/lineItem';
import { Cart, LineItem as CoCoLineItem, CustomLineItem, Address as CartAddress } from '@commercetools/platform-sdk';
import {
Cart,
LineItem as CoCoLineItem,
CustomLineItem,
Address as CartAddress,
} from '@commercetools/connect-payments-sdk';
import {
getAllowedPaymentMethodsFromContext,
getCtSessionIdFromContext,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Money } from '@commercetools/platform-sdk';
import { NotificationRequestItem } from '@adyen/api-library/lib/src/typings/notification/notificationRequestItem';
import { NotificationRequestDTO } from '../../dtos/adyen-payment.dto';
import { TransactionData, UpdatePayment } from '@commercetools/connect-payments-sdk';
import { TransactionData, UpdatePayment, Money } from '@commercetools/connect-payments-sdk';

export class NotificationConverter {
constructor() {}
Expand Down
2 changes: 1 addition & 1 deletion processor/src/services/types/operation.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
PaymentModificationStatus,
} from '../../dtos/operations/payment-intents.dto';
import { StatusResponseSchemaDTO } from '../../dtos/operations/status.dto';
import { Payment } from '@commercetools/platform-sdk';
import { Payment } from '@commercetools/connect-payments-sdk';

export type CapturePaymentRequest = {
amount: AmountSchemaDTO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
populateCartAddress,
} from '../../../src/services/converters/helper.converter';
import { Address as AdyenAddress } from '@adyen/api-library/lib/src/typings/checkout/address';
import { Address } from '@commercetools/platform-sdk';
import { Address } from '@commercetools/connect-payments-sdk';
describe('helper.converter', () => {
beforeEach(() => {
jest.setTimeout(10000);
Expand Down
3 changes: 1 addition & 2 deletions processor/test/utils/mock-cart-data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { LineItem, CustomLineItem, ShippingInfo } from '@commercetools/platform-sdk';
import { LineItem, CustomLineItem, ShippingInfo, Cart } from '@commercetools/connect-payments-sdk';
import { randomUUID } from 'crypto';
import { Cart } from '@commercetools/platform-sdk';

export const mockGetCartResult = () => {
const cartId = randomUUID();
Expand Down
3 changes: 1 addition & 2 deletions processor/test/utils/mock-payment-data.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Payment } from '@commercetools/platform-sdk';
import { Transaction } from '@commercetools/platform-sdk/dist/declarations/src';
import { Payment, Transaction } from '@commercetools/connect-payments-sdk';
import { PaymentCancelResponse } from '@adyen/api-library/lib/src/typings/checkout/paymentCancelResponse';
import { PaymentMethodsResponse } from '@adyen/api-library/lib/src/typings/checkout/paymentMethodsResponse';
import { PaymentCaptureResponse } from '@adyen/api-library/lib/src/typings/checkout/paymentCaptureResponse';
Expand Down
Loading