Skip to content
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

fix(global): DOMA-10345 format eror translations #5305

Merged
merged 8 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/condo/domains/acquiring/constants/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ const GQL_ERRORS = {
code: BAD_USER_INPUT,
type: WRONG_VALUE,
message: 'Payment amount is less than the minimum amount from acquiring integration',
messageForUser: 'api.acquiring.payment.error.paymentAmountLessThanMinimum',
messageForUser: 'api.acquiring.payment.PAYMENT_AMOUNT_LESS_THAN_MINIMUM',
},
PAYMENT_AMOUNT_GREATER_THAN_MAXIMUM: {
code: BAD_USER_INPUT,
type: WRONG_VALUE,
message: 'Payment amount is greater than the maximum amount from acquiring integration',
messageForUser: 'api.acquiring.payment.error.paymentAmountGreaterThanMaximum',
messageForUser: 'api.acquiring.payment.PAYMENT_AMOUNT_GREATER_THAN_MAXIMUM',
},
MORE_THAN_ONE_ACQUIRING_CONTEXTS: {
code: BAD_USER_INPUT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const ERRORS = {
code: BAD_USER_INPUT,
type: ALREADY_EXISTS_ERROR,
message: 'Provided receipt already paid',
messageForUser: 'api.billing.error.alreadyPaid',
messageForUser: 'api.billing.billingReceipt.RECEIPT_ALREADY_PAID_ERROR',
YEgorLu marked this conversation as resolved.
Show resolved Hide resolved
},
}

Expand Down
2 changes: 1 addition & 1 deletion apps/condo/domains/acquiring/schema/MultiPayment.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const ERRORS = {
code: BAD_USER_INPUT,
type: MULTIPAYMENT_RECEIPTS_WITH_INVOICES_FORBIDDEN,
message: 'Receipts and invoices are forbidden to be together',
messageForUser: 'api.acquiring.multiPayment.error.receiptsWithInvoices',
messageForUser: 'api.acquiring.multiPayment.RECEIPTS_WITH_INVOICES_FORBIDDEN',
},
}

Expand Down
2 changes: 1 addition & 1 deletion apps/condo/domains/acquiring/schema/MultiPayment.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ describe('MultiPayment', () => {
code: 'BAD_USER_INPUT',
type: 'MULTIPAYMENT_RECEIPTS_WITH_INVOICES_FORBIDDEN',
message: 'Receipts and invoices are forbidden to be together',
messageForUser: 'api.acquiring.multiPayment.error.receiptsWithInvoices',
messageForUser: 'api.acquiring.multiPayment.RECEIPTS_WITH_INVOICES_FORBIDDEN',
})
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ const ERRORS = {
code: BAD_USER_INPUT,
type: MULTIPAYMENT_RECEIPTS_WITH_INVOICES_FORBIDDEN,
message: 'Receipts and invoices are forbidden to be together',
messageForUser: 'api.acquiring.multiPayment.error.receiptsWithInvoices',
messageForUser: 'api.acquiring.multiPayment.RECEIPTS_WITH_INVOICES_FORBIDDEN',
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ describe('RegisterMultiPaymentService', () => {
code: 'BAD_USER_INPUT',
type: 'MULTIPAYMENT_RECEIPTS_WITH_INVOICES_FORBIDDEN',
message: 'Receipts and invoices are forbidden to be together',
messageForUser: 'api.acquiring.multiPayment.error.receiptsWithInvoices',
messageForUser: 'api.acquiring.multiPayment.RECEIPTS_WITH_INVOICES_FORBIDDEN',
}, 'result')
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const ERRORS = {
code: FORBIDDEN,
type: OPERATION_FORBIDDEN,
message: 'Your organization do not have access to this feature',
messageForUser: 'api.analytics.overviewDashboard.FEATURE_IS_DISABLED',
messageForUser: 'api.analytics.getOverviewDashboard.FEATURE_IS_DISABLED',
},
}

Expand Down
6 changes: 3 additions & 3 deletions apps/condo/domains/banking/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ const INCORRECT_PROPERTY_ID = 'INCORRECT_PROPERTY_ID'
const EMPTY_BANK_ACCOUNT_REQUEST_EMAIL_TARGET_VALUE = 'EMPTY_BANK_ACCOUNT_REQUEST_EMAIL_TARGET_VALUE'
const WRONG_INTEGRATION = {
message: 'BankAccount connected to another integration',
messageForUser: 'api.banking.BankSyncTask.WRONG_INTEGRATION',
messageForUser: 'api.banking.bankSyncTask.WRONG_INTEGRATION',
}
const INVALID_DATE = {
message: 'Invalid options.dateTo or options.DateFrom',
messageForUser: 'api.banking.BankSyncTask.INVALID_DATE',
messageForUser: 'api.banking.bankSyncTask.INVALID_DATE',
}
const TRANSACTIONS_NOT_ADDED = {
message: 'Transactions not added to BankAccount',
messageForUser: 'api.banking.BankSyncTask.TRANSACTIONS_NOT_ADDED',
messageForUser: 'api.banking.bankSyncTask.TRANSACTIONS_NOT_ADDED',
}

const CLASSIFICATION_CODE_IS_INVALID = 'CLASSIFICATION_CODE_IS_INVALID'
Expand Down
6 changes: 3 additions & 3 deletions apps/condo/domains/banking/schema/BankSyncTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ const errors = {
code: BAD_USER_INPUT,
type: 'ACCOUNT_IS_REQUIRED',
message: 'The "account" field is required to request transactions from SBBOL',
messageForUser: 'api.banking.BankSyncTask.ACCOUNT_IS_REQUIRED',
messageForUser: 'api.banking.bankSyncTask.ACCOUNT_IS_REQUIRED',
},
INCORRECT_DATE_INTERVAL: {
code: BAD_USER_INPUT,
type: 'INCORRECT_DATE_INTERVAL',
message: 'dateTo cannot be later than dateFrom',
messageForUser: 'api.banking.BankSyncTask.INCORRECT_DATE_INTERVAL',
messageForUser: 'api.banking.bankSyncTask.INCORRECT_DATE_INTERVAL',
},
DISABLED_BANK_INTEGRATION_ORGANIZATION_CONTEXT: {
code: BAD_USER_INPUT,
type: 'DISABLED_BANK_INTEGRATION_ORGANIZATION_CONTEXT',
message: 'Disabled BankIntegrationContext for current organization does not allow to execute data synchronization operations',
messageForUser: 'api.banking.BankSyncTask.DISABLED_BANK_INTEGRATION_ORGANIZATION_CONTEXT',
messageForUser: 'api.banking.bankSyncTask.DISABLED_BANK_INTEGRATION_ORGANIZATION_CONTEXT',
},
}

Expand Down
2 changes: 1 addition & 1 deletion apps/condo/domains/billing/schema/ValidateQRCodeService.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const ERRORS = {
code: BAD_USER_INPUT,
type: ALREADY_EXISTS_ERROR,
message: 'Provided receipt already paid',
messageForUser: 'api.billing.error.alreadyPaid',
messageForUser: 'api.billing.billingReceipt.RECEIPT_ALREADY_PAID_ERROR',
},
INVALID_QR_CODE_STRING: {
mutation: 'validateQRCode',
Expand Down
4 changes: 2 additions & 2 deletions apps/condo/domains/contact/schema/Contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ const ERRORS = {
code: BAD_USER_INPUT,
type: UNABLE_TO_CREATE_CONTACT_DUPLICATE,
message: 'Cannot create contact, because another contact with the same provided set of "property", "unitName", "phone"',
messageForUser: 'api.contact.CONTACT_DUPLICATE_ERROR',
messageForUser: 'api.contact.contact.CONTACT_DUPLICATE_ERROR',
},
UNABLE_TO_UPDATE_CONTACT_DUPLICATE: {
mutation: 'signinResidentUser',
code: BAD_USER_INPUT,
type: UNABLE_TO_UPDATE_CONTACT_DUPLICATE,
message: 'Cannot update contact, because another contact with the same provided set of "property", "unitName", "phone"',
messageForUser: 'api.contact.CONTACT_DUPLICATE_ERROR',
messageForUser: 'api.contact.contact.CONTACT_DUPLICATE_ERROR',
},
}

Expand Down
20 changes: 10 additions & 10 deletions apps/condo/domains/marketplace/schema/Invoice.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,63 +166,63 @@ const ERRORS = {
code: BAD_USER_INPUT,
type: ERROR_INVOICE_ALREADY_PAID,
message: 'Changing of paid invoice is forbidden',
messageForUser: 'api.marketplace.invoice.error.alreadyPaid',
messageForUser: 'api.marketplace.invoice.ALREADY_PAID',
},
ALREADY_CANCELED: {
code: BAD_USER_INPUT,
type: ERROR_INVOICE_ALREADY_CANCELED,
message: 'Changing of canceled invoice is forbidden',
messageForUser: 'api.marketplace.invoice.error.alreadyCanceled',
messageForUser: 'api.marketplace.invoice.ALREADY_CANCELED',
},
EMPTY_ROWS: {
code: BAD_USER_INPUT,
type: ERROR_INVOICE_EMPTY_ROWS,
message: 'The invoice contains no rows',
messageForUser: 'api.marketplace.invoice.error.emptyRows',
messageForUser: 'api.marketplace.invoice.EMPTY_ROWS',
},
WRONG_COUNT: (rowNumber) => ({
code: BAD_USER_INPUT,
type: ERROR_INVOICE_ROW_WRONG_COUNT,
message: `Count at line ${rowNumber} can't be less than 1`,
messageForUser: 'api.marketplace.invoice.error.rows.count',
messageForUser: 'api.marketplace.invoice.WRONG_COUNT',
messageInterpolation: { rowNumber },
}),
WRONG_PRICE: (rowNumber) => ({
code: BAD_USER_INPUT,
type: ERROR_INVOICE_ROW_WRONG_PRICE,
message: `Price at line ${rowNumber} can't be less than 0`,
messageForUser: 'api.marketplace.invoice.error.rows.toPay',
messageForUser: 'api.marketplace.invoice.WRONG_PRICE',
messageInterpolation: { rowNumber },
}),
NO_FINISHED_ACQUIRING_CONTEXT: {
code: BAD_USER_INPUT,
type: ERROR_NO_FINISHED_ACQUIRING_CONTEXT,
message: 'The organization has no AcquiringIntegrationContext in finished status for invoices',
messageForUser: 'api.marketplace.invoice.error.NoFinishedAcquiringContext',
messageForUser: 'api.marketplace.invoice.NO_FINISHED_ACQUIRING_CONTEXT',
},
FORBID_EDIT_PUBLISHED: {
code: BAD_USER_INPUT,
type: ERROR_FORBID_EDIT_PUBLISHED,
message: `Only the status ${INVOICE_STATUS_CANCELED} and ${INVOICE_STATUS_PAID} can be updated by the published invoice`,
messageForUser: 'api.marketplace.invoice.error.editPublishedForbidden',
messageForUser: 'api.marketplace.invoice.FORBID_EDIT_PUBLISHED',
},
CLIENT_DATA_DOES_NOT_MATCH_TICKET: {
code: BAD_USER_INPUT,
type: ERROR_CLIENT_DATA_DOES_NOT_MATCH_TICKET,
message: `Fields ${CLIENT_DATA_FIELDS.join(', ')} must match same fields in connected ticket`,
messageForUser: 'api.marketplace.invoice.error.clientDataDoesNotMatchTicket',
messageForUser: 'api.marketplace.invoice.CLIENT_DATA_DOES_NOT_MATCH_TICKET',
},
FORBID_UPDATE_TICKET: {
code: BAD_USER_INPUT,
type: ERROR_FORBID_UPDATE_TICKET,
message: 'You cannot update ticket in invoice that is already linked to the ticket',
messageForUser: 'api.marketplace.invoice.error.forbidUpdateTicket',
messageForUser: 'api.marketplace.invoice.FORBID_UPDATE_TICKET',
},
PUBLISHING_WITHOUT_DEFINED_PRICES_FORBIDDEN: {
code: BAD_USER_INPUT,
type: ERROR_PUBLISHING_WITHOUT_DEFINED_PRICES_FORBIDDEN,
message: 'Can\'t publish invoice without defined prices',
messageForUser: 'api.marketplace.invoice.error.PublishingWithoutDefinedPricesForbidden',
messageForUser: 'api.marketplace.invoice.PUBLISHING_WITHOUT_DEFINED_PRICES_FORBIDDEN',
},
}

Expand Down
20 changes: 10 additions & 10 deletions apps/condo/domains/marketplace/schema/Invoice.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1481,7 +1481,7 @@ describe('Invoice', () => {
code: 'BAD_USER_INPUT',
type: 'INVOICE_ALREADY_PAID',
message: 'Changing of paid invoice is forbidden',
messageForUser: 'api.marketplace.invoice.error.alreadyPaid',
messageForUser: 'api.marketplace.invoice.ALREADY_PAID',
})
})

Expand All @@ -1506,7 +1506,7 @@ describe('Invoice', () => {
code: 'BAD_USER_INPUT',
type: 'INVOICE_ALREADY_CANCELED',
message: 'Changing of canceled invoice is forbidden',
messageForUser: 'api.marketplace.invoice.error.alreadyCanceled',
messageForUser: 'api.marketplace.invoice.ALREADY_CANCELED',
})
})

Expand All @@ -1519,7 +1519,7 @@ describe('Invoice', () => {
code: 'BAD_USER_INPUT',
type: 'EMPTY_ROWS',
message: 'The invoice contains no rows',
messageForUser: 'api.marketplace.invoice.error.emptyRows',
messageForUser: 'api.marketplace.invoice.EMPTY_ROWS',
})
})

Expand Down Expand Up @@ -1556,7 +1556,7 @@ describe('Invoice', () => {
code: 'BAD_USER_INPUT',
type: 'WRONG_COUNT',
message: 'Count at line 2 can\'t be less than 1',
messageForUser: 'api.marketplace.invoice.error.rows.count',
messageForUser: 'api.marketplace.invoice.WRONG_COUNT',
messageInterpolation: { rowNumber: 2 },
})
})
Expand All @@ -1568,7 +1568,7 @@ describe('Invoice', () => {
code: 'BAD_USER_INPUT',
type: 'WRONG_PRICE',
message: 'Price at line 1 can\'t be less than 0',
messageForUser: 'api.marketplace.invoice.error.rows.toPay',
messageForUser: 'api.marketplace.invoice.WRONG_PRICE',
messageInterpolation: { rowNumber: 1 },
})
})
Expand All @@ -1584,7 +1584,7 @@ describe('Invoice', () => {
code: 'BAD_USER_INPUT',
type: 'NO_FINISHED_ACQUIRING_CONTEXT',
message: 'The organization has no AcquiringIntegrationContext in finished status for invoices',
messageForUser: 'api.marketplace.invoice.error.NoFinishedAcquiringContext',
messageForUser: 'api.marketplace.invoice.NO_FINISHED_ACQUIRING_CONTEXT',
})
})

Expand All @@ -1606,7 +1606,7 @@ describe('Invoice', () => {
code: 'BAD_USER_INPUT',
type: 'FORBID_EDIT_PUBLISHED',
message: `Only the status ${INVOICE_STATUS_CANCELED} and ${INVOICE_STATUS_PAID} can be updated by the published invoice`,
messageForUser: 'api.marketplace.invoice.error.editPublishedForbidden',
messageForUser: 'api.marketplace.invoice.FORBID_EDIT_PUBLISHED',
})
})

Expand Down Expand Up @@ -1684,7 +1684,7 @@ describe('Invoice', () => {
code: 'BAD_USER_INPUT',
type: 'FORBID_UPDATE_TICKET',
message: 'You cannot update ticket in invoice that is already linked to the ticket',
messageForUser: 'api.marketplace.invoice.error.forbidUpdateTicket',
messageForUser: 'api.marketplace.invoice.FORBID_UPDATE_TICKET',
})
})

Expand All @@ -1705,7 +1705,7 @@ describe('Invoice', () => {
code: 'BAD_USER_INPUT',
type: 'CLIENT_DATA_DOES_NOT_MATCH_TICKET',
message: `Fields ${CLIENT_DATA_FIELDS.join(', ')} must match same fields in connected ticket`,
messageForUser: 'api.marketplace.invoice.error.clientDataDoesNotMatchTicket',
messageForUser: 'api.marketplace.invoice.CLIENT_DATA_DOES_NOT_MATCH_TICKET',
})
})

Expand Down Expand Up @@ -1794,7 +1794,7 @@ describe('Invoice', () => {
code: 'BAD_USER_INPUT',
type: 'PUBLISHING_WITHOUT_DEFINED_PRICES_FORBIDDEN',
message: 'Can\'t publish invoice without defined prices',
messageForUser: 'api.marketplace.invoice.error.PublishingWithoutDefinedPricesForbidden',
messageForUser: 'api.marketplace.invoice.PUBLISHING_WITHOUT_DEFINED_PRICES_FORBIDDEN',
})
})

Expand Down
4 changes: 2 additions & 2 deletions apps/condo/domains/marketplace/schema/MarketCategory.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ const ERRORS = {
code: BAD_USER_INPUT,
type: 'MAXIMUM_DEPTH_REACHED',
message: 'The depth of category inheritance should be no more than 2',
messageForUser: 'api.marketplace.MarketCategory.MAXIMUM_DEPTH_REACHED',
messageForUser: 'api.marketplace.marketCategory.MAXIMUM_DEPTH_REACHED',
},
CANNOT_CONNECT_TO_ITSELF: {
code: BAD_USER_INPUT,
type: 'CANNOT_CONNECT_TO_ITSELF',
message: 'Cannot connect to itself',
messageForUser: 'api.marketplace.MarketCategory.CANNOT_CONNECT_TO_ITSELF',
messageForUser: 'api.marketplace.marketCategory.CANNOT_CONNECT_TO_ITSELF',
},
}

Expand Down
6 changes: 3 additions & 3 deletions apps/condo/domains/marketplace/schema/MarketItemPrice.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ const ERRORS = {
INVALID_SALES_TAX_PERCENT: (rowNumber) => ({
code: BAD_USER_INPUT,
type: 'INVALID_SALES_TAX_PERCENT',
messageForUser: 'api.marketplace.MarketItemPrice.error.INVALID_SALES_TAX_PERCENT',
messageForUser: 'api.marketplace.marketItemPrice.INVALID_SALES_TAX_PERCENT',
messageInterpolation: { rowNumber },
message: `Invalid sales tax percent on line ${rowNumber}. Must be greater or equal to 0 and less or equal to 100.`,
}),
INVALID_PRICE: (rowNumber) => ({
code: BAD_USER_INPUT,
type: 'INVALID_PRICE',
messageForUser: 'api.marketplace.MarketItemPrice.error.INVALID_PRICE',
messageForUser: 'api.marketplace.marketItemPrice.INVALID_PRICE',
messageInterpolation: { rowNumber },
message: `Invalid price on line ${rowNumber}. Must be greater or equal to 0.`,
}),
EMPTY_PRICE: {
code: BAD_USER_INPUT,
type: 'EMPTY_PRICE',
messageForUser: 'api.marketplace.MarketItemPrice.error.EMPTY_PRICE',
messageForUser: 'api.marketplace.marketItemPrice.EMPTY_PRICE',
message: 'Price cannot be empty.',
},
}
Expand Down
2 changes: 1 addition & 1 deletion apps/condo/domains/marketplace/schema/MarketPriceScope.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const ERRORS = {
ORGANIZATION_IN_PROPERTY_AND_MARKET_ITEM_PRICE_NOT_MATCHED: {
code: BAD_USER_INPUT,
type: 'ORGANIZATION_IN_PROPERTY_AND_MARKET_ITEM_PRICE_NOT_MATCHED',
messageForUser: 'api.marketplace.MarketItemPrice.error.ORGANIZATION_IN_PROPERTY_AND_MARKET_ITEM_PRICE_NOT_MATCHED',
messageForUser: 'api.marketplace.marketItemPrice.ORGANIZATION_IN_PROPERTY_AND_MARKET_ITEM_PRICE_NOT_MATCHED',
message: 'Cannot create scope with property from one organization and market item from another organization.',
},
}
Expand Down
Loading
Loading