Skip to content

Commit

Permalink
feat: minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Santiago Sanz committed Sep 9, 2022
1 parent 6bde40f commit 36b47d9
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 22 deletions.
15 changes: 14 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
Return app v3 is still in BETA. v2 will no longer be supported so please do not install it.
Docs are WIP.

- Table of contents
- [Features](#features)
- [API](#api)
- [Customization](#customization)
- [Known issues](#known-issues)
- [Development](#development)

## Description

The **Return App** gives merchants the option to allow customers to request a return for their items and it gives them the ability to manage the Return Request Process on their store.
Expand Down Expand Up @@ -294,11 +301,17 @@ In order to apply CSS customizations in this and other blocks, follow the instru
|'termsAndConditionsLink'|
|'userCommentDetailsContainer'|

## Knowing issues
## Known issues
- When a store has a process to create return invoices ([invoice type input](https://developers.vtex.com/vtex-rest-api/reference/invoicenotification)) outside the return app, the app will consider those items and they will not be able to be returned via the app. However when an item is already committed in a return request and an invoice is created considering that item with a invoice number different than the return request id, there will be more processed items to return then invoices items - It can be seen using the query `orderToReturnSummary` on GraphQL.

- When installing the app in a workspace - or creating a new one - the app will not behavior as expected. This is due to the masterdata builder not creating a schema for that workspace automatically. To fix that, one can just link the app in the workspace using the toolbelt. Doing so, there will be a new masterdata schema related to that workspace and the app should work fine.

## Development

### Export feature (Report)

This app leverages the Report API to export all return documents into a single file. For this to work, we maintain a matrix transformation MAP inside **/node/report**. If any key or value of the object is changed, next time any account that opens the module will have their map created/updated. The ID is the identifier we use to compare them, there's no need of changing it every time we modify the object.

---
Documentation for v2 [here](https://github.com/vtex-apps/return-app/tree/v2).

Expand Down
2 changes: 1 addition & 1 deletion messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@
"admin/return-app.export-module.modal-close": "CLOSE",
"admin/return-app.export-module.content.first-paragraph": "The Export module is the system responsible for merging all return requests into a single file called <b>report</b>, this can be then sent to an email or downloaded directly from this module",
"admin/return-app.export-module.content.second-paragraph": "Keep in mind that download links are not permanent, they expire after <b>6 hours</b> following their availability",
"admin/return-app.export-module.content.warning-paragraph": "It is important to remember that depending on the quantity of return requests, the process can take a long time to finish. If you chose to generate a download link, you can leave the module open and it will update when its available for download",
"admin/return-app.export-module.content.warning-paragraph": "As the export process runs in the backround, If you chose to only generate a download link, you can close this page and check back later.",
"admin/return-app.export-module.content.format-disclaimer": "Supported formats:",
"admin/return-app.export-module.content.skip-disclaimer": "Documents containing errors will be skipped",
"admin/return-app.export-module.report.status-title": "Last report",
Expand Down
40 changes: 22 additions & 18 deletions node/report/json_return-request-map.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @todo
* Test translationPrefix for the status column by creating new messages
*/
export const localMap: ReportMap = {
id: '7a42a323-1faa-11ed-835d-16acdede38c5',
name: 'Return Requests',
Expand Down Expand Up @@ -63,128 +67,128 @@ export const localMap: ReportMap = {
defaultLanguage: null,
},
{
header: 'customer_profile_data_id',
header: 'customer_user_id',
query: 'customerProfileData.userId',
usePath: false,
translationPrefix: null,
defaultLanguage: null,
},
{
header: 'customer_profile_data_name',
header: 'customer_name',
query: 'customerProfileData.name',
usePath: false,
translationPrefix: null,
defaultLanguage: null,
},
{
header: 'customer_profile_data_email',
header: 'customer_email',
query: 'customerProfileData.email',
usePath: false,
translationPrefix: null,
defaultLanguage: null,
},
{
header: 'customer_profile_data_phone',
header: 'customer_phone_number',
query: 'customerProfileData.phoneNumber',
usePath: false,
translationPrefix: null,
defaultLanguage: null,
},
{
header: 'pickup_return_data_id',
header: 'pickup_address_id',
query: 'pickupReturnData.addressId',
usePath: false,
translationPrefix: null,
defaultLanguage: null,
},
{
header: 'pickup_return_data_address',
header: 'pickup_address',
query: 'pickupReturnData.address',
usePath: false,
translationPrefix: null,
defaultLanguage: null,
},
{
header: 'pickup_return_data_city',
header: 'pickup_city',
query: 'pickupReturnData.city',
usePath: false,
translationPrefix: null,
defaultLanguage: null,
},
{
header: 'pickup_return_data_state',
header: 'pickup_state',
query: 'pickupReturnData.state',
usePath: false,
translationPrefix: null,
defaultLanguage: null,
},
{
header: 'pickup_return_data_country',
header: 'pickup_country',
query: 'pickupReturnData.country',
usePath: false,
translationPrefix: null,
defaultLanguage: null,
},
{
header: 'pickup_return_data_zip_code',
header: 'pickup_zip_code',
query: 'pickupReturnData.zipCode',
usePath: false,
translationPrefix: null,
defaultLanguage: null,
},
{
header: 'pickup_return_data_type',
header: 'pickup_address_type',
query: 'pickupReturnData.addressType',
usePath: false,
translationPrefix: null,
defaultLanguage: null,
},
{
header: 'pickup_return_data_return_label',
header: 'pickup_return_label',
query: "pickupReturnData.( returnLabel ? returnLabel : 'NA' )",
usePath: false,
translationPrefix: null,
defaultLanguage: null,
},
{
header: 'refund_payment_data_payment_method',
header: 'refund_payment_method',
query: 'refundPaymentData.refundPaymentMethod',
usePath: false,
translationPrefix: null,
defaultLanguage: null,
},
{
header: 'refund_payment_data_payment_iban',
header: 'refund_payment_iban',
query: "refundPaymentData.( iban ? iban : 'NA' )",
usePath: false,
translationPrefix: null,
defaultLanguage: null,
},
{
header: 'refund_payment_data_payment_account_holder_name',
header: 'refund_payment_account_holder_name',
query:
"refundPaymentData.( accountHolderName ? accountHolderName : 'NA' )",
usePath: false,
translationPrefix: null,
defaultLanguage: null,
},
{
header: 'refund_payment_data_payment_automatic_refund',
header: 'refund_payment_automatic_refund',
query:
"refundPaymentData.( automaticallyRefundPaymentMethod ? automaticallyRefundPaymentMethod : 'NA' )",
usePath: true,
translationPrefix: null,
defaultLanguage: null,
},
{
header: 'culture_info_data_currency_code',
header: 'currency_code',
query: 'cultureInfoData.currencyCode',
usePath: false,
translationPrefix: null,
defaultLanguage: null,
},
{
header: 'culture_info_data_currency_locale',
header: 'locale',
query: 'cultureInfoData.locale',
usePath: false,
translationPrefix: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const ReportStatus = () => {
staleLink,
} = exportStatus ?? {}

const disableDownload = inProgress || !downloadLink || staleLink

return (
<>
<p className="f4 mt2 mb3">
Expand All @@ -26,8 +28,8 @@ const ReportStatus = () => {
<p className="mv3">
<ButtonPlain
variation="plain"
href={downloadLink ?? null}
disabled={inProgress || !downloadLink || staleLink}
href={disableDownload ? () => false : downloadLink}
disabled={disableDownload}
target="_blank"
>
<FormattedMessage id="admin/return-app.export-module.report.download-cta" />
Expand Down

0 comments on commit 36b47d9

Please sign in to comment.