From 6fee5f9a1766f98198e6ed5c4cc7068688540c8e Mon Sep 17 00:00:00 2001 From: Ken Date: Mon, 5 Feb 2024 13:41:00 +0800 Subject: [PATCH 1/3] chore: update readme for paymentContent --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 31b8aa2..7fda2b2 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,9 @@ The underlying cryptosystem is `x25519-xsalsa20-poly1305` which is implemented b | encryptedContent | string | The encrypted submission in base64. | | created | string | Creation timestamp. | | attachmentDownloadUrls | Record | (Optional) Records containing field IDs and URLs where encrypted uploaded attachments can be downloaded. | +| paymentContent | Record | (Optional) Records containing payment details for forms with payments[1] | + +[1] Forms with the deprecated Fixed Payment Type is not supported ### Format of Decrypted Submissions From 78676b68b70e781bb0b38e5fe8b4da47eaf714f3 Mon Sep 17 00:00:00 2001 From: Ken Date: Mon, 5 Feb 2024 13:55:31 +0800 Subject: [PATCH 2/3] chore: add payment content fields --- README.md | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7fda2b2..79ac320 100644 --- a/README.md +++ b/README.md @@ -133,7 +133,7 @@ decrypt and open the signed decrypted content with the package's own The resulting decrypted verifiedContent will be assigned to the `verified` key of the returned object. -> **NOTE**
+> **Note:**
> If any errors occur, either from the failure to decrypt either `encryptedContent` or `verifiedContent`, or the failure to authenticate the decrypted signed message in `verifiedContent`, `null` will be returned. Note that due to end-to-end encryption, FormSG servers are unable to verify the data format. @@ -149,8 +149,8 @@ decrypted content does not contain all of the fields displayed in the schema bel | fieldType | string | The type of field for the question. | | \_id | string | A unique identifier of the form field. WARNING: Changes when new fields are created/removed in the form. | -**Important Note: ** -Additional internal fields may be included in webhooks from time to time, which will then be published as part of our official schema once it is stable for public consumption. If you are applying your own validation, you should account for this e.g. by not rejecting the webhook if there are additional fields included. +> **Note:**
+> Additional internal fields may be included in webhooks from time to time, which will then be published as part of our official schema once it is stable for public consumption. If you are applying your own validation, you should account for this e.g. by not rejecting the webhook if there are additional fields included. The full schema can be viewed in [`validate.ts`](https://github.com/opengovsg/formsg-javascript-sdk/tree/master/src/util/validate.ts). @@ -181,6 +181,24 @@ Attachments are end-to-end encrypted in the same way as normal form submissions, _Warning:_ We do not have the ability to scan any attachments for malicious content (e.g. spyware or viruses), so careful handling is needed. +### Format of Payment Content + +These fields will be available if the submission is a payment subsmission, otherwise, the value will be an empty `{}`. + +| Key | Type | Description | +| -------------- | ---------------- | ------------------------------------------------ | +| type | 'payment_charge' | Payment event associated with this webhook | +| status | string | Status of the payment intent | +| payer | string | The email associated with this email | +| url | string | The url of the proof of payment for this payment | +| paymentIntent | string | The payment intent associated with this payment | +| amount | string | The amount charged to the user | +| productService | string | The product or service name of the payment | +| dateTime | string | The time of which this payment was transacted | +| transactionFee | string | The fees charged for this transaction | + + + ## Verifying Signatures Manually You can use the following information to create a custom solution, although we recommend using this SDK. From 4e1205351e6993afb99fd04d6bcc26ea62a3126c Mon Sep 17 00:00:00 2001 From: wanlingt Date: Wed, 7 Feb 2024 10:58:35 +0800 Subject: [PATCH 3/3] fix: amend typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 79ac320..de0d4dd 100644 --- a/README.md +++ b/README.md @@ -183,7 +183,7 @@ _Warning:_ We do not have the ability to scan any attachments for malicious cont ### Format of Payment Content -These fields will be available if the submission is a payment subsmission, otherwise, the value will be an empty `{}`. +These fields will be available if the submission is a payment submission, otherwise, the value will be an empty `{}`. | Key | Type | Description | | -------------- | ---------------- | ------------------------------------------------ |