Skip to content

Commit

Permalink
chore: upgrade new wallet API definitions (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
mastro993 authored Jan 23, 2024
1 parent f15bafc commit a54a095
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"api_pn": "https://raw.githubusercontent.com/pagopa/io-backend/v13.25.1-RELEASE/api_pn.yaml",
"api_idpay": "https://raw.githubusercontent.com/pagopa/cstar-infrastructure/v6.5.0/src/domains/idpay-app/api/idpay_appio_full/openapi.appio.full.yml",
"api_fast_login": "https://raw.githubusercontent.com/pagopa/io-backend/v13.25.1-RELEASE/openapi/generated/api_fast_login.yaml",
"api_pagopa_walletv3": "https://raw.githubusercontent.com/pagopa/pagopa-infra/4cd111e94432ff62580adc391de78a5462a7128e/src/domains/wallet-app/api/payment-wallet/v1/_openapi.json.tpl",
"api_pagopa_ecommerce": "https://raw.githubusercontent.com/pagopa/pagopa-infra/65878f9913fcc0eaff499ba8a1a20427a412c010/src/domains/ecommerce-app/api/ecommerce-io/v1/_openapi.json.tpl",
"api_pagopa_walletv3": "https://raw.githubusercontent.com/pagopa/pagopa-infra/740e7dcc5ea2ea19639316fea6797bbd504dd0ae/src/domains/wallet-app/api/payment-wallet/v1/_openapi.json.tpl",
"api_pagopa_ecommerce": "https://raw.githubusercontent.com/pagopa/pagopa-infra/5190135ac34791cf66c1986735d4134bcaf4096f/src/domains/ecommerce-app/api/ecommerce-io/v1/_openapi.json.tpl",
"author": "Matteo Boschi",
"license": "MIT",
"private": false,
Expand Down
5 changes: 2 additions & 3 deletions src/features/wallet/payloads/paymentMethods.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { PaymentMethodStatusEnum } from "../../../../generated/definitions/pagopa/walletv3/PaymentMethodStatus";
import { PaymentMethodsResponse } from "../../../../generated/definitions/pagopa/walletv3/PaymentMethodsResponse";
import { Range } from "../../../../generated/definitions/pagopa/walletv3/Range";
import { TypeEnum } from "../../../../generated/definitions/pagopa/walletv3/WalletInfoDetails";

export const allPaymentMethods: PaymentMethodsResponse = {
paymentMethods: [
Expand All @@ -11,7 +10,7 @@ export const allPaymentMethods: PaymentMethodsResponse = {
description: "Carta di credito",
asset: "creditCard",
status: PaymentMethodStatusEnum.ENABLED,
paymentTypeCode: TypeEnum.CARDS,
paymentTypeCode: "CARDS",
ranges: [
{
min: 0,
Expand All @@ -25,7 +24,7 @@ export const allPaymentMethods: PaymentMethodsResponse = {
description: "PayPal",
asset: "payPal",
status: PaymentMethodStatusEnum.ENABLED,
paymentTypeCode: TypeEnum.PAYPAL,
paymentTypeCode: "PAYPAL",
ranges: [
{
min: 0,
Expand Down
2 changes: 1 addition & 1 deletion src/features/wallet/payloads/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const getTransactionInfoPayload = (
});

export const getCalculateFeeResponsePayload = (
_walletId: string,
_walletId: string | undefined,
_amount: number
): O.Option<CalculateFeeResponse> =>
O.some({
Expand Down
5 changes: 2 additions & 3 deletions src/features/wallet/utils/onboarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@ import { faker } from "@faker-js/faker";
import { WalletCreateResponse } from "../../../../generated/definitions/pagopa/walletv3/WalletCreateResponse";
import { serverUrl } from "../../../utils/server";
import { PaymentMethodsResponse } from "../../../../generated/definitions/pagopa/walletv3/PaymentMethodsResponse";
import { TypeEnum } from "../../../../generated/definitions/pagopa/walletv3/WalletInfoDetails";
import { allPaymentMethods } from "../payloads/paymentMethods";

export const generateOnboardablePaymentMethods = (): PaymentMethodsResponse =>
allPaymentMethods;

export const getWalletTypeFromPaymentMethodId = (
paymentMethodId: string
): TypeEnum =>
): string =>
allPaymentMethods.paymentMethods?.find(({ id }) => id === paymentMethodId)
?.paymentTypeCode as TypeEnum;
?.paymentTypeCode || "CARDS";

export const WALLET_ONBOARDING_PATH = "/wallets/outcomes";
export const generateOnboardingWalletData = (
Expand Down
2 changes: 1 addition & 1 deletion src/routers/features/idpay/__tests__/payment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe("IDPay Payment API", () => {

describe("DELETE deletePayment", () => {
it("should return 200", async () => {
const trxCode = faker.random.alphaNumeric(8, { bannedChars: "1234567" });
const trxCode = "ABCDEFGH";

const response = await request.delete(
addIdPayPrefix(`/payment/qr-code/${trxCode}`)
Expand Down

0 comments on commit a54a095

Please sign in to comment.