-
Notifications
You must be signed in to change notification settings - Fork 55
DEVDOCS-6664 - Adds docs for payment method translations #1211
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
Open
chris-nowicki
wants to merge
5
commits into
main
Choose a base branch
from
DEVDOCS-6664
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b5e0b91
Add translation docs for payments
chris-nowicki 51c6d2e
update translation index to include payments
chris-nowicki f3792ad
Merge branch 'main' into DEVDOCS-6664
chris-nowicki 98639b9
Added query by resource id
chris-nowicki 15bac89
Merge branch 'main' into DEVDOCS-6664
chris-nowicki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,305 @@ | ||
| # Translations for Payments (Beta) | ||
|
|
||
| The following entities are translatable for payments: | ||
|
|
||
| - Display Name as `display_name` | ||
| - Payment Instruction as `payment_instruction` | ||
|
|
||
| Translations appear in the following storefront views: | ||
|
|
||
| - Checkout page (payment methods listing) | ||
| - Order confirmation page | ||
| - Order email | ||
| - My Account page (payment methods and orders) | ||
|
|
||
| ## Resource fields | ||
|
|
||
| For payment method related translation entries, the `resourceId` follows this structure: | ||
|
|
||
| `bc/store/paymentMethod/{payment_method_id}.{currency}` | ||
|
|
||
| | **Segment** | **Description** | | ||
| | ------------------------ | -------------------------------------------------------------------- | | ||
| | `bc/store/paymentMethod` | Namespace prefix for payment translation resources. | | ||
| | `{payment_method_id}` | Payment method identifier (e.g., `authorizenet.credit_card`). | | ||
| | `{currency}` | The ISO currency code configured for the payment method (e.g `USD`). | | ||
|
|
||
| A single `resourceId` corresponds to all payment profiles that share the same payment method ID and currency. As a result: | ||
|
|
||
| - Translations apply at the payment method \+ currency level. | ||
| - If a provider has multiple profiles (e.g., multiple gateway configurations) using the same payment method ID and same currency, they share the same translation resource. | ||
| - Updating the translation updates the display for every profile in that set. | ||
|
|
||
| ### Example | ||
|
|
||
| In this example, the payment method is `authorizenet.credit_card` and the currency is `USD`. The translation will be applied to all payment profiles that use the same payment method ID and currency. | ||
|
|
||
| `"resourceId": "bc/store/paymentMethod/authorizenet.credit_card.USD"` | ||
|
|
||
| ## Querying Payment Method Translations | ||
|
|
||
| This query retrieves all payment method translations for a specific channel and locale, including the original and translated values for display names and payment instructions. | ||
chris-nowicki marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| <Tabs items={['Request', 'Response']}> | ||
| <Tab> | ||
| ```graphql | ||
| query ListPaymentMethodTranslations { | ||
| store { | ||
| translations( | ||
| filters: { | ||
| resourceType: PAYMENT_METHODS | ||
| channelId: "bc/store/channel/1" | ||
| localeId: "bc/store/locale/en-AU" | ||
| } | ||
| ) { | ||
| edges { | ||
| node { | ||
| resourceId | ||
| fields { | ||
| fieldName | ||
| original | ||
| translation | ||
| } | ||
| } | ||
| cursor | ||
| } | ||
| pageInfo { | ||
| hasNextPage | ||
| hasPreviousPage | ||
| startCursor | ||
| endCursor | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
| </Tab> | ||
| <Tab> | ||
| ```json | ||
| { | ||
| "data": { | ||
| "store": { | ||
| "translations": { | ||
| "edges": [ | ||
| { | ||
| "node": { | ||
| "resourceId": "bc/store/paymentMethod/authorizenet.credit_card.USD", | ||
| "fields": [ | ||
| { | ||
| "fieldName": "display_name", | ||
| "original": "Authorize.Net", | ||
| "translation": null | ||
| }, | ||
| { | ||
| "fieldName": "payment_instruction", | ||
| "original": "", | ||
| "translation": null | ||
| } | ||
| ] | ||
| }, | ||
| "cursor": "YXV0aG9yaXplbmV0LmNyZWRpdF9jYXJkLlVTRA" | ||
| } | ||
| ], | ||
| "pageInfo": { | ||
| "hasNextPage": false, | ||
| "hasPreviousPage": false, | ||
| "startCursor": "YXV0aG9yaXplbmV0LmNyZWRpdF9jYXJkLlVTRA", | ||
| "endCursor": "YXV0aG9yaXplbmV0LmNyZWRpdF9jYXJkLlVTRA" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
| </Tab> | ||
| </Tabs> | ||
|
|
||
| ## Querying Payment Method Translations by resourceId | ||
chris-nowicki marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| <Callout type='info'> | ||
| When querying a translation by `resourceId`, you must provide the full `resourceId` in the format `bc/store/paymentMethod/{payment_method_id}.{currency}`. | ||
| </Callout> | ||
|
|
||
| This query returns a translation by `resourceId`. | ||
|
|
||
| <Tabs items={['Request', 'Response']}> | ||
| <Tab> | ||
| ```graphql | ||
| query { | ||
| store { | ||
| translations( | ||
| filters: { | ||
| resourceType: PAYMENT_METHODS | ||
| channelId: "bc/store/channel/1" | ||
| localeId: "bc/store/locale/en" | ||
| resourceIds: [ | ||
| "bc/store/paymentMethod/authorizenet.credit_card.USD" | ||
| ] | ||
| } | ||
| ) { | ||
| edges { | ||
| node { | ||
| resourceId | ||
| fields { | ||
| fieldName | ||
| original | ||
| translation | ||
| } | ||
| } | ||
| cursor | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
| </Tab> | ||
| <Tab> | ||
| ```json | ||
| { | ||
| "data": { | ||
| "store": { | ||
| "translations": { | ||
| "edges": [ | ||
| { | ||
| "node": { | ||
| "resourceId": "bc/store/paymentMethod/authorizenet.credit_card.USD", | ||
| "fields": [ | ||
| { | ||
| "fieldName": "display_name", | ||
| "original": "Authorize.Net", | ||
| "translation": null | ||
| }, | ||
| { | ||
| "fieldName": "payment_instruction", | ||
| "original": "", | ||
| "translation": null | ||
| } | ||
| ] | ||
| }, | ||
| "cursor": "YXV0aG9yaXplbmV0LmNyZWRpdF9jYXJkLlVTRA" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
| </Tab> | ||
| </Tabs> | ||
|
|
||
| ## Update a Payment Method Translation | ||
|
|
||
| This mutation updates the translated values for payment method display names and payment instructions for a specific payment method, channel, and locale. | ||
|
|
||
| <Tabs items={['Request', 'Response']}> | ||
| <Tab> | ||
| ```graphql | ||
| mutation UpdatePaymentMethodTranslations { | ||
| translation { | ||
| updateTranslations( | ||
| input: { | ||
| resourceType: PAYMENT_METHODS | ||
| channelId: "bc/store/channel/1" | ||
| localeId: "bc/store/locale/en-AU" | ||
| entities: [ | ||
| { | ||
| resourceId: "bc/store/paymentMethod/authorizenet.credit_card.USD" | ||
| fields: [ | ||
| { fieldName: "display_name", value: "Translated display" } | ||
| { fieldName: "payment_instruction", value: "Translated instrumention" } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ) { | ||
| errors { | ||
| __typename | ||
| ... on ValidationError { | ||
| message | ||
| } | ||
| ... on EntityNotFoundError { | ||
| id | ||
| message | ||
| } | ||
| ... on InvalidTranslationEntityFieldsError { | ||
| id | ||
| message | ||
| fields | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
| </Tab> | ||
| <Tab> | ||
| ```json | ||
| { | ||
| "data": { | ||
| "translation": { | ||
| "updateTranslations": { | ||
| "errors": [] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
| </Tab> | ||
| </Tabs> | ||
|
|
||
| ## Delete a Payment Method Translation | ||
|
|
||
| This mutation removes translated values for specified payment method fields, reverting them to the original values for a specific payment method, channel, and locale. | ||
|
|
||
| <Tabs items={['Request', 'Response']}> | ||
| <Tab> | ||
| ```graphql | ||
| mutation { | ||
| translation { | ||
| deleteTranslations( | ||
| input: { | ||
| resourceType: PAYMENT_METHODS | ||
| channelId: "bc/store/channel/1" | ||
| localeId: "bc/store/locale/en-AU" | ||
| resources: [ | ||
| { | ||
| resourceId: "bc/store/paymentMethod/authorizenet.credit_card.USD" | ||
| fields: ["display_name", "payment_instruction"] | ||
| } | ||
| ] | ||
| } | ||
| ) { | ||
| errors { | ||
| __typename | ||
| ... on ValidationError { | ||
| message | ||
| } | ||
| ... on EntityNotFoundError { | ||
| id | ||
| message | ||
| } | ||
| ... on InvalidTranslationEntityFieldsError { | ||
| id | ||
| message | ||
| fields | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
| </Tab> | ||
| <Tab> | ||
| ```json | ||
| { | ||
| "data": { | ||
| "translation": { | ||
| "deleteTranslations": { | ||
| "errors": [] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
| </Tab> | ||
| </Tabs> | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.