-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into IOPID-689-check-email
- Loading branch information
Showing
16 changed files
with
417 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<script type="text/javascript"> | ||
const outcomeList = [ | ||
["0", "SUCCESS"], | ||
["1", "GENERIC_ERROR"], | ||
["2", "AUTH_ERROR"], | ||
["3", "INVALID_DATA"], | ||
["4", "TIMEOUT"], | ||
["5", "CIRCUIT_ERROR"], | ||
["6", "MISSING_FIELDS"], | ||
["7", "INVALID_CARD"], | ||
["8", "CANCELED_BY_USER"], | ||
["9", "DUPLICATE_ORDER"], | ||
["10", "EXCESSIVE_AMOUNT"], | ||
["11", "ORDER_NOT_PRESENT"], | ||
["12", "INVALID_METHOD"], | ||
["13", "KO_RETRIABLE"], | ||
["14", "INVALID_SESSION"] | ||
]; | ||
|
||
const simulateOutcome = () => { | ||
const queryString = location.search; | ||
const urlParams = new URLSearchParams(queryString); | ||
const transactionId = urlParams.get("transactionId"); | ||
const container = document.getElementById("outcomeSelect"); | ||
window.location.href = `/ecommerce/io/v1/transactions/${transactionId}/outcomes?outcome=${container.value}`; | ||
} | ||
|
||
function onLoad() { | ||
const options = outcomeList.map(v => `<option value="${v[0]}">${v[0]} - ${v[1]}</option>`).join(); | ||
const select = `<select id="outcomeSelect" style="width: 400px;height: 60px;font-size: 32px">${options}</select>`; | ||
const container = document.getElementById("select_container"); | ||
container.innerHTML = `<div>${select}</div>`; | ||
} | ||
|
||
</script> | ||
<meta charset="UTF-8"> | ||
<title>Wallet - Payment</title> | ||
</head> | ||
|
||
<body onload="onLoad()"> | ||
|
||
<div align="center" style="width: 100%; height:100%;margin: auto; margin-top: 20%;"> | ||
<h1 style="font-size: 62px;">WALLET PAYMENT</h1> | ||
<div style="width: 100%; margin-top: 20px"> | ||
<div style="margin-top: 40px; font-size: 42px; margin-bottom: 20px;"> | ||
Select outcome | ||
</div> | ||
<div id="select_container"> | ||
</div> | ||
<div style="margin-top: 60px; "> | ||
<div onclick="simulateOutcome()" | ||
style="padding: 16px; width: 350px; font-size: 30px; color: white; background-color: #e67f00; text-decoration: none;"> | ||
SIMULATE OUTCOME | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
import "./onboarding"; | ||
|
||
export { walletV3Router } from "./routers"; | ||
export { walletRouter } from "./routers"; |
8 changes: 4 additions & 4 deletions
8
.../wallet/common/payloads/paymentMethods.ts → ...eatures/wallet/payloads/paymentMethods.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { faker } from "@faker-js/faker/locale/it"; | ||
import * as O from "fp-ts/lib/Option"; | ||
import { pipe } from "fp-ts/lib/function"; | ||
import { ServicePublic } from "../../../../generated/definitions/backend/ServicePublic"; | ||
import { PaymentRequestsGetResponse } from "../../../../generated/definitions/pagopa/ecommerce/PaymentRequestsGetResponse"; | ||
import { RptId } from "../../../../generated/definitions/pagopa/ecommerce/RptId"; | ||
import ServicesDB from "../../../persistence/services"; | ||
|
||
export const getPaymentRequestsGetResponse = ( | ||
rptId: RptId | ||
): O.Option<PaymentRequestsGetResponse> => | ||
pipe( | ||
ServicesDB.getSummaries(), | ||
faker.helpers.arrayElement, | ||
({ service_id }) => service_id, | ||
ServicesDB.getService, | ||
O.fromNullable, | ||
O.map((randomService: ServicePublic) => ({ | ||
rptId, | ||
amount: faker.datatype.number({ | ||
min: 1, | ||
max: 9999 | ||
}) as PaymentRequestsGetResponse["amount"], | ||
paFiscalCode: randomService.organization_fiscal_code, | ||
paName: randomService.organization_name, | ||
description: faker.finance.transactionDescription(), | ||
dueDate: faker.date.future() | ||
})) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { faker } from "@faker-js/faker/locale/it"; | ||
import * as O from "fp-ts/lib/Option"; | ||
import { ulid } from "ulid"; | ||
import { CalculateFeeResponse } from "../../../../generated/definitions/pagopa/ecommerce/CalculateFeeResponse"; | ||
import { | ||
ClientIdEnum, | ||
NewTransactionResponse, | ||
SendPaymentResultOutcomeEnum | ||
} from "../../../../generated/definitions/pagopa/ecommerce/NewTransactionResponse"; | ||
import { PaymentInfo } from "../../../../generated/definitions/pagopa/ecommerce/PaymentInfo"; | ||
import { PaymentMethodStatusEnum } from "../../../../generated/definitions/pagopa/ecommerce/PaymentMethodStatus"; | ||
import { RptId } from "../../../../generated/definitions/pagopa/ecommerce/RptId"; | ||
import { TransactionInfo } from "../../../../generated/definitions/pagopa/ecommerce/TransactionInfo"; | ||
import { TransactionStatusEnum } from "../../../../generated/definitions/pagopa/ecommerce/TransactionStatus"; | ||
|
||
export const getNewTransactionResponsePayload = ( | ||
payments: ReadonlyArray<PaymentInfo> | ||
): O.Option<NewTransactionResponse> => | ||
O.some({ | ||
transactionId: ulid(), | ||
payments, | ||
status: TransactionStatusEnum.ACTIVATED, | ||
clientId: ClientIdEnum.IO, | ||
sendPaymentResultOutcome: SendPaymentResultOutcomeEnum.OK | ||
}); | ||
|
||
export const getTransactionInfoPayload = ( | ||
transactionId: string | ||
): O.Option<TransactionInfo> => | ||
O.some({ | ||
transactionId, | ||
payments: [ | ||
{ | ||
rptId: "77777777777302012387654312384" as RptId, | ||
amount: faker.datatype.number({ | ||
min: 1, | ||
max: 9999 | ||
}) as PaymentInfo["amount"] | ||
} | ||
], | ||
status: TransactionStatusEnum.ACTIVATED, | ||
clientId: ClientIdEnum.IO, | ||
sendPaymentResultOutcome: SendPaymentResultOutcomeEnum.OK | ||
}); | ||
|
||
export const getCalculateFeeResponsePayload = ( | ||
_walletId: string, | ||
_amount: number | ||
): O.Option<CalculateFeeResponse> => | ||
O.some({ | ||
paymentMethodName: "VISA", | ||
paymentMethodDescription: "Test", | ||
paymentMethodStatus: PaymentMethodStatusEnum.ENABLED, | ||
bundles: [ | ||
{ | ||
abi: "01010", | ||
taxPayerFee: 123, | ||
primaryCiIncurredFee: 123, | ||
bundleName: "BANCO di NAPOLI", | ||
idBundle: "A" | ||
}, | ||
{ | ||
abi: "01015", | ||
bundleName: "Banco di Sardegna", | ||
taxPayerFee: 456, | ||
primaryCiIncurredFee: 456, | ||
idBundle: "B" | ||
}, | ||
{ | ||
abi: "03015", | ||
bundleName: "FINECO", | ||
taxPayerFee: 789, | ||
primaryCiIncurredFee: 789, | ||
idBundle: "C" | ||
} | ||
] | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,4 @@ | ||
import { Request, Response, Router } from "express"; | ||
import { addHandler, SupportedMethod } from "../../../payloads/response"; | ||
import "./payment"; | ||
import "./wallets"; | ||
|
||
export const walletV3Router = Router(); | ||
|
||
export const PAYMENT_WALLET_PREFIX = "/payment-wallet/v1"; | ||
|
||
export const addWalletV3Prefix = (path: string) => | ||
`${PAYMENT_WALLET_PREFIX}/wallets${path}`; | ||
export const addPaymentMethodsPrefix = (path: string) => | ||
`${PAYMENT_WALLET_PREFIX}/payment-methods${path}`; | ||
|
||
export const addWalletV3Handler = ( | ||
method: SupportedMethod, | ||
path: string, | ||
handleRequest: (request: Request, response: Response) => void | ||
) => addHandler(walletV3Router, method, addWalletV3Prefix(path), handleRequest); | ||
|
||
export const addPaymentMethodsHandler = ( | ||
method: SupportedMethod, | ||
path: string, | ||
handleRequest: (request: Request, response: Response) => void | ||
) => | ||
addHandler( | ||
walletV3Router, | ||
method, | ||
addPaymentMethodsPrefix(path), | ||
handleRequest | ||
); | ||
export { walletRouter } from "./router"; |
Oops, something went wrong.