From 74c378128d87099755c6e95eeb32c5a781dec393 Mon Sep 17 00:00:00 2001 From: kushthedude Date: Sun, 18 Aug 2019 06:14:46 +0530 Subject: [PATCH 1/3] fixing notify services in all components files --- app/adapters/application.js | 5 ++++- app/components/account/application-section.js | 5 ++++- app/components/account/danger-zone.js | 8 ++++++-- .../account/email-preferences-section.js | 8 ++++++-- .../events/view/export/api-response.js | 4 +++- .../events/view/export/download-common.js | 20 ++++++++++++++----- .../events/view/export/download-zip.js | 8 ++++++-- .../events/view/overview/manage-roles.js | 16 +++++++++++---- .../system/mail-settings/test-email-form.js | 8 ++++++-- .../forms/admin/settings/ticket-fees-form.js | 12 ++++++++--- app/components/forms/login-form.js | 8 ++++++-- app/components/forms/reset-password-form.js | 12 ++++++++--- .../forms/user-payment-info-form.js | 8 ++++++-- app/components/forms/user-profile-form.js | 8 ++++++-- .../forms/wizard/basic-details-step.js | 8 ++++++-- app/components/forms/wizard/sponsors-step.js | 8 ++++++-- app/components/modals/change-image-modal.js | 8 ++++++-- app/components/notification-dropdown.js | 8 ++++++-- app/components/paypal-button.js | 8 ++++++-- app/components/public/ticket-list.js | 4 +++- app/components/unverified-user-message.js | 12 ++++++++--- app/components/widgets/forms/file-upload.js | 16 +++++++++++---- app/components/widgets/forms/image-upload.js | 8 ++++++-- package.json | 2 +- yarn.lock | 12 +++++------ 25 files changed, 165 insertions(+), 59 deletions(-) diff --git a/app/adapters/application.js b/app/adapters/application.js index 585fef648f6..24a86c3b319 100644 --- a/app/adapters/application.js +++ b/app/adapters/application.js @@ -16,6 +16,7 @@ export const fixFilterQuery = query => { if (query.hasOwnProperty('filter')) { query.filter = JSON.stringify(query.filter); } + return query; }; @@ -34,13 +35,15 @@ export default JSONAPIAdapter.extend(HasManyQueryAdapterMixin, AdapterFetch, Cac if (access_token) { headers[ENV['ember-simple-auth-token'].authorizationHeaderName] = ENV['ember-simple-auth-token'].authorizationPrefix + access_token; } + return headers; }), isInvalid(statusCode) { if (statusCode !== 404 && statusCode !== 422 && statusCode !== 403 && statusCode !== 409) { this.notify.error('An unexpected error occurred.', { - closeAfter: 5000 + closeAfter : 5000, + id : 'Serve_Error' }); } }, diff --git a/app/components/account/application-section.js b/app/components/account/application-section.js index 03501919128..44ce4b873b2 100644 --- a/app/components/account/application-section.js +++ b/app/components/account/application-section.js @@ -30,13 +30,16 @@ export default Component.extend({ ); this.set('data', this.get('authManager.currentUser')); } + this.set('isLoading', false); }); }); }); } } catch (error) { - this.notify.error(this.l10n.t(error.message)); + this.notify.error(this.l10n.t(error.message), { + id: 'Error_message' + }); this.set('isLoading', false); } } diff --git a/app/components/account/danger-zone.js b/app/components/account/danger-zone.js index 1dbd0e64ff9..3d7fc91b5c7 100644 --- a/app/components/account/danger-zone.js +++ b/app/components/account/danger-zone.js @@ -33,10 +33,14 @@ export default Component.extend({ .then(() => { this.authManager.logout(); this.routing.transitionTo('index'); - this.notify.success(this.l10n.t('Your account has been deleted successfully.')); + this.notify.success(this.l10n.t('Your account has been deleted successfully.'), { + id: 'Account_Delete' + }); }) .catch(() => { - this.notify.error(this.l10n.t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.'), { + id: 'account_del_error' + }); }) .finally(() => { this.setProperties({ diff --git a/app/components/account/email-preferences-section.js b/app/components/account/email-preferences-section.js index 2af8e230e4a..1551f84b161 100644 --- a/app/components/account/email-preferences-section.js +++ b/app/components/account/email-preferences-section.js @@ -5,11 +5,15 @@ export default Component.extend({ savePreference(emailPreference) { emailPreference.save() .then(() => { - this.notify.success(this.l10n.t('Email notifications updated successfully')); + this.notify.success(this.l10n.t('Email notifications updated successfully'), { + id: 'email_notif' + }); }) .catch(() => { emailPreference.rollbackAttributes(); - this.notify.error(this.l10n.t('An unexpected error occurred.')); + this.notify.error(this.l10n.t('An unexpected error occurred.'), { + id: 'email_error' + }); }); } } diff --git a/app/components/events/view/export/api-response.js b/app/components/events/view/export/api-response.js index 1c19abb8b53..2313ce0e762 100644 --- a/app/components/events/view/export/api-response.js +++ b/app/components/events/view/export/api-response.js @@ -39,7 +39,9 @@ export default Component.extend({ this.set('json', htmlSafe(syntaxHighlight(json))); }) .catch(() => { - this.notify.error(this.l10n.t('Could not fetch from the server')); + this.notify.error(this.l10n.t('Could not fetch from the server'), { + id: 'server_fetch_error' + }); this.set('json', 'Could not fetch from the server'); }) .finally(() => { diff --git a/app/components/events/view/export/download-common.js b/app/components/events/view/export/download-common.js index bbc0413e9ae..8da3969ce58 100644 --- a/app/components/events/view/export/download-common.js +++ b/app/components/events/view/export/download-common.js @@ -29,19 +29,27 @@ export default Component.extend({ if (exportJobStatus.state === 'SUCCESS') { this.set('isDownloadDisabled', false); this.set('eventDownloadUrl', exportJobStatus.result.download_url); - this.notify.success(this.l10n.t('Download Ready')); + this.notify.success(this.l10n.t('Download Ready'), { + id: 'down_ready' + }); } else if (exportJobStatus.state === 'WAITING') { this.requestLoop(exportJobInfo); this.set('eventExportStatus', exportJobStatus.state); - this.notify.alert(this.l10n.t('Task is going on.')); + this.notify.alert(this.l10n.t('Task is going on.'), { + id: 'Task_progress' + }); } else { this.set('eventExportStatus', exportJobStatus.state); - this.notify.error(this.l10n.t('Task failed.')); + this.notify.error(this.l10n.t('Task failed.'), { + id: 'Task_fail' + }); } }) .catch(() => { this.set('eventExportStatus', 'FAILURE'); - this.notify.error(this.l10n.t('Task failed.')); + this.notify.error(this.l10n.t('Task failed.'), { + if: 'failure' + }); }) .finally(() => { this.set('isLoading', false); @@ -58,7 +66,9 @@ export default Component.extend({ }) .catch(() => { this.set('isLoading', false); - this.notify.error(this.l10n.t('Unexpected error occurred.')); + this.notify.error(this.l10n.t('Unexpected error occurred.'), { + id: 'Unexpected_down_error' + }); }); } } diff --git a/app/components/events/view/export/download-zip.js b/app/components/events/view/export/download-zip.js index 6ff9809db64..e4964967551 100644 --- a/app/components/events/view/export/download-zip.js +++ b/app/components/events/view/export/download-zip.js @@ -12,10 +12,14 @@ export default class extends Component { anchor.href = URL.createObjectURL(new Blob([res], { type: 'octet/stream' })); anchor.download = 'EventExport.zip'; anchor.click(); - this.notify.success(this.l10n.t('Exported Event Downloaded successfully.')); + this.notify.success(this.l10n.t('Exported Event Downloaded successfully.'), { + id: 'export_succ' + }); } catch (e) { console.error(e); - this.notify.error(this.l10n.t(e)); + this.notify.error(this.l10n.t(e), { + id: 'err_down' + }); } this.set('isLoading', false); } diff --git a/app/components/events/view/overview/manage-roles.js b/app/components/events/view/overview/manage-roles.js index bdbb0b9d0ff..a0ea670d7ec 100644 --- a/app/components/events/view/overview/manage-roles.js +++ b/app/components/events/view/overview/manage-roles.js @@ -28,10 +28,14 @@ export default Component.extend({ this.get('data.roleInvites').addObject(this.currentInvite); } this.set('isAddUserRoleModalOpen', false); - this.notify.success(this.isNewInvite ? this.l10n.t('Role Invite sent successfully') : this.l10n.t('Role Invite updated successfully')); + this.notify.success(this.isNewInvite ? this.l10n.t('Role Invite sent successfully') : this.l10n.t('Role Invite updated successfully'), { + id: 'man_role' + }); }) .catch(() => { - this.notify.error(this.l10n.t('Oops something went wrong. Please try again')); + this.notify.error(this.l10n.t('Oops something went wrong. Please try again'), { + id: 'man_role_err' + }); }) .finally(() => { this.set('isLoading', false); @@ -41,11 +45,15 @@ export default Component.extend({ this.set('isLoading', true); invite.destroyRecord() .then(() => { - this.notify.success(this.l10n.t('Role Invite deleted successfully')); + this.notify.success(this.l10n.t('Role Invite deleted successfully'), { + id: 'del_role_succ' + }); this.get('data.roleInvites').removeObject(invite); }) .catch(() => { - this.notify.error(this.l10n.t('Oops something went wrong. Please try again')); + this.notify.error(this.l10n.t('Oops something went wrong. Please try again'), { + id: 'err_man_role' + }); }) .finally(() => { this.set('isLoading', false); diff --git a/app/components/forms/admin/settings/system/mail-settings/test-email-form.js b/app/components/forms/admin/settings/system/mail-settings/test-email-form.js index c274874552f..66ee625b492 100644 --- a/app/components/forms/admin/settings/system/mail-settings/test-email-form.js +++ b/app/components/forms/admin/settings/system/mail-settings/test-email-form.js @@ -35,11 +35,15 @@ export default Component.extend(FormMixin, { }; this.loader.post('/test-mail', JSON.stringify(payload), config) .then(response => { - this.notify.success(response.message); + this.notify.success(response.message, { + id: 'succ_response_test' + }); }) .catch(e => { console.warn(e); - this.notify.error(this.l10n.t('An unexpected error has occurred')); + this.notify.error(this.l10n.t('An unexpected error has occurred'), { + id: 'test_mail_err' + }); }); }); } diff --git a/app/components/forms/admin/settings/ticket-fees-form.js b/app/components/forms/admin/settings/ticket-fees-form.js index 60168ab701f..bcd982eedfb 100644 --- a/app/components/forms/admin/settings/ticket-fees-form.js +++ b/app/components/forms/admin/settings/ticket-fees-form.js @@ -21,7 +21,9 @@ export default Component.extend({ return (!setting.get('currency') || !setting.get('country')); }); if (incorrect_settings.length > 0) { - this.notify.error(this.l10n.t('Existing items need to be completed before new items can be added.')); + this.notify.error(this.l10n.t('Existing items need to be completed before new items can be added.'), { + id: 'Existing_item' + }); this.set('isLoading', false); } else { this.model.toArray().addObject(this.store.createRecord('ticket-fee', { @@ -34,10 +36,14 @@ export default Component.extend({ this.set('isLoading', true); rec.destroyRecord() .then(() => { - this.notify.success(this.l10n.t('Fee setting deleted successfully')); + this.notify.success(this.l10n.t('Fee setting deleted successfully'), { + id: 'fee_delete_succ' + }); }) .catch(() => { - this.notify.error(this.l10n.t('Oops something went wrong. Please try again')); + this.notify.error(this.l10n.t('Oops something went wrong. Please try again'), { + id: 'fee_err' + }); }) .finally(() => { this.set('isLoading', false); diff --git a/app/components/forms/login-form.js b/app/components/forms/login-form.js index 3f51e87f315..c4082f0e00c 100644 --- a/app/components/forms/login-form.js +++ b/app/components/forms/login-form.js @@ -85,9 +85,13 @@ export default class extends Component.extend(FormMixin) { window.location.replace(response.url); } catch (e) { if (e.message) { - this.notify.error(this.l10n.tVar(e.message)); + this.notify.error(this.l10n.tVar(e.message), { + id: 'error_server_msg' + }); } else { - this.notify.error(this.l10n.t('An unexpected error has occurred')); + this.notify.error(this.l10n.t('An unexpected error has occurred'), { + id: 'unexpect_error' + }); } } } diff --git a/app/components/forms/reset-password-form.js b/app/components/forms/reset-password-form.js index fdb89edf7bc..5ad175dc9f2 100644 --- a/app/components/forms/reset-password-form.js +++ b/app/components/forms/reset-password-form.js @@ -55,11 +55,15 @@ export default Component.extend(FormMixin, { this.loader .patch('auth/reset-password', payload) .then(() => { - this.notify.success(this.l10n.t('Your password has been reset successfully. Please log in to continue')); + this.notify.success(this.l10n.t('Your password has been reset successfully. Please log in to continue'), { + id: 'reser_succ' + }); this.router.transitionTo('login'); }) .catch(() => { - this.set('errorMessage', this.l10n.t('An unexpected error occurred.')); + this.set('errorMessage', this.l10n.t('An unexpected error occurred.'), { + id: 'reset_unexpect' + }); }) .finally(() => { this.set('isLoading', false); @@ -75,7 +79,9 @@ export default Component.extend(FormMixin, { this.loader .post('auth/reset-password', payload) .then(() => { - this.notify.success(this.l10n.t('Please go to the link sent to your email to reset your password')); + this.notify.success(this.l10n.t('Please go to the link sent to your email to reset your password'), { + id: 'reset_link_sent' + }); this.router.transitionTo('login'); }) .catch(reason => { diff --git a/app/components/forms/user-payment-info-form.js b/app/components/forms/user-payment-info-form.js index 31e6a3e7dd8..34783dd0751 100644 --- a/app/components/forms/user-payment-info-form.js +++ b/app/components/forms/user-payment-info-form.js @@ -101,10 +101,14 @@ export default Component.extend(FormMixin, { try { this.authManager.currentUser.setProperties(this.userBillingInfo); await this.authManager.currentUser.save(); - this.notify.success(this.l10n.t('Your billing details has been updated')); + this.notify.success(this.l10n.t('Your billing details has been updated'), { + id: 'bill_det_updated' + }); } catch (error) { this.authManager.currentUser.rollbackAttributes(); - this.notify.error(this.l10n.t('An unexpected error occurred')); + this.notify.error(this.l10n.t('An unexpected error occurred'), { + id: 'bill_det_unexpect' + }); } this.set('isLoading', false); }); diff --git a/app/components/forms/user-profile-form.js b/app/components/forms/user-profile-form.js index 46dd57e3b00..aa7f3cfd6d6 100644 --- a/app/components/forms/user-profile-form.js +++ b/app/components/forms/user-profile-form.js @@ -63,11 +63,15 @@ export default Component.extend(FormMixin, { this.set('isLoading', true); this.user.save() .then(() => { - this.notify.success(this.l10n.t('Your profile has been updated')); + this.notify.success(this.l10n.t('Your profile has been updated'), { + id: 'profi_update' + }); }) .catch(() => { this.get('authManager.currentUser').rollbackAttributes(); - this.notify.error(this.l10n.t('An unexpected error occurred')); + this.notify.error(this.l10n.t('An unexpected error occurred'), { + id: 'profi_error' + }); }) .finally(() => { this.set('isLoading', false); diff --git a/app/components/forms/wizard/basic-details-step.js b/app/components/forms/wizard/basic-details-step.js index a5ac8cad4da..152fc738074 100644 --- a/app/components/forms/wizard/basic-details-step.js +++ b/app/components/forms/wizard/basic-details-step.js @@ -384,14 +384,18 @@ export default Component.extend(FormMixin, EventWizardMixin, { })); }) .catch(error => { - this.notify.error(this.l10n.t(`${error.message}. Please try again`)); + this.notify.error(this.l10n.t(`${error.message}. Please try again`), { + id: 'basic_detail_err' + }); }); }, async disconnectStripe() { let stripeAuthorization = await this.get('data.event.stripeAuthorization'); stripeAuthorization.destroyRecord() .then(() => { - this.notify.success(this.l10n.t('Stripe disconnected successfully')); + this.notify.success(this.l10n.t('Stripe disconnected successfully'), { + id: 'stripe_disconn' + }); }); }, diff --git a/app/components/forms/wizard/sponsors-step.js b/app/components/forms/wizard/sponsors-step.js index 07e02f09650..c6610d3330f 100644 --- a/app/components/forms/wizard/sponsors-step.js +++ b/app/components/forms/wizard/sponsors-step.js @@ -41,7 +41,9 @@ export default Component.extend(FormMixin, { return (!sponsor.get('name')); }); if (incorrect_sponsors.length > 0) { - this.notify.error(this.l10n.t('Please fill the required fields for existing sponsor items')); + this.notify.error(this.l10n.t('Please fill the required fields for existing sponsor items'), { + id: 'req_field_sponsor' + }); this.set('isLoading', false); } else { this.get('data.sponsors').addObject(this.store.createRecord('sponsor')); @@ -57,7 +59,9 @@ export default Component.extend(FormMixin, { return (!sponsor.get('name')); }); if (incorrect_sponsors.length > 0) { - this.notify.error(this.l10n.t('Please fill the required fields.')); + this.notify.error(this.l10n.t('Please fill the required fields.'), { + id: 'req_field_spon' + }); this.set('isLoading', false); } else { this.set('data.event.state', 'draft'); diff --git a/app/components/modals/change-image-modal.js b/app/components/modals/change-image-modal.js index 4bb306ec924..2a996218ef7 100644 --- a/app/components/modals/change-image-modal.js +++ b/app/components/modals/change-image-modal.js @@ -8,10 +8,14 @@ export default ModalBase.extend({ placeholder.save() .then(() => { this.set('isOpen', false); - this.notify.success(this.l10n.t('Placeholder has been saved successfully.')); + this.notify.success(this.l10n.t('Placeholder has been saved successfully.'), { + id: 'placeholder_sav' + }); }) .catch(() => { - this.notify.error(this.l10n.t('An unexpected error has occurred. Placeholder not saved.')); + this.notify.error(this.l10n.t('An unexpected error has occurred. Placeholder not saved.'), { + id: 'placeholder_err' + }); }); }); } diff --git a/app/components/notification-dropdown.js b/app/components/notification-dropdown.js index b19d0704199..68fee5c4d96 100644 --- a/app/components/notification-dropdown.js +++ b/app/components/notification-dropdown.js @@ -19,10 +19,14 @@ export default Component.extend({ notification.set('isRead', true); notification.save() .then(() => { - this.notify.success(this.l10n.t('Marked as Read successfully')); + this.notify.success(this.l10n.t('Marked as Read successfully'), { + id: 'not_read_succ' + }); }) .catch(() => { - this.notify.error(this.l10n.t('An unexpected error occurred.')); + this.notify.error(this.l10n.t('An unexpected error occurred.'), { + id: 'not_read_error' + }); }); }, markAllRead() { diff --git a/app/components/paypal-button.js b/app/components/paypal-button.js index 0dc90b48dd5..9568dd061f2 100644 --- a/app/components/paypal-button.js +++ b/app/components/paypal-button.js @@ -55,10 +55,14 @@ export default Component.extend({ return this.loader.post(`orders/${order.identifier}/charge`, chargePayload, config) .then(charge => { if (charge.data.attributes.status) { - this.notify.success(charge.data.attributes.message); + this.notify.success(charge.data.attributes.message, { + id: 'paypal_succ' + }); this.router.transitionTo('orders.view', order.identifier); } else { - this.notify.error(charge.data.attributes.message); + this.notify.error(charge.data.attributes.message, { + id: 'err_paypal' + }); } }); } diff --git a/app/components/public/ticket-list.js b/app/components/public/ticket-list.js index 4d93f7eeaa3..84e76e654b1 100644 --- a/app/components/public/ticket-list.js +++ b/app/components/public/ticket-list.js @@ -156,7 +156,9 @@ export default Component.extend(FormMixin, { } if (this.invalidPromotionalCode) { this.set('promotionalCodeApplied', false); - this.notify.error('This Promotional Code is not valid'); + this.notify.error('This Promotional Code is not valid', { + id: 'prom_inval' + }); } else { this.set('promotionalCodeApplied', true); this.set('promotionalCode', 'Promotional code applied successfully'); diff --git a/app/components/unverified-user-message.js b/app/components/unverified-user-message.js index e0ac4b751fe..51d391e092a 100644 --- a/app/components/unverified-user-message.js +++ b/app/components/unverified-user-message.js @@ -22,14 +22,20 @@ export default Component.extend({ this.loader .post('/auth/resend-verification-email', payload) .then(() => { - this.notify.success(this.l10n.t('Verification mail sent successfully')); + this.notify.success(this.l10n.t('Verification mail sent successfully'), { + id: 'ver_mail_succ' + }); this.set('isMailSent', true); }) .catch(error => { if (error.error) { - this.notify.error(this.l10n.t(error.error)); + this.notify.error(this.l10n.t(error.error), { + id: 'ver_mail_serv_error' + }); } else { - this.notify.error(this.l10n.t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.'), { + id: 'ver_mail_serv' + }); } }); } diff --git a/app/components/widgets/forms/file-upload.js b/app/components/widgets/forms/file-upload.js index 11e5ab6b440..ddebd49a679 100644 --- a/app/components/widgets/forms/file-upload.js +++ b/app/components/widgets/forms/file-upload.js @@ -23,10 +23,14 @@ export default Component.extend({ .uploadFile('/upload/files', this.$(`#${this.inputIdGenerated}`)) .then(file => { this.set('fileUrl', JSON.parse(file).url); - this.notify.success(this.l10n.t('File uploaded successfully')); + this.notify.success(this.l10n.t('File uploaded successfully'), { + id: 'file_upload_succ' + }); }) .catch(() => { - this.notify.error(this.l10n.t('Oops something went wrong. Please try again')); + this.notify.error(this.l10n.t('Oops something went wrong. Please try again'), { + id: 'file_upload_err' + }); }) .finally(() => { this.set('uploadingFile', false); @@ -42,10 +46,14 @@ export default Component.extend({ }; reader.readAsDataURL(files[0]); }).catch(error => { - this.notify.error(error); + this.notify.error(error, { + id: 'file_upload_err_1' + }); }); } else { - this.notify.error(this.l10n.t('No FileReader support. Please use a more latest browser')); + this.notify.error(this.l10n.t('No FileReader support. Please use a more latest browser'), { + id: 'file_upload_err_brow' + }); } }, diff --git a/app/components/widgets/forms/image-upload.js b/app/components/widgets/forms/image-upload.js index aec7ea04ca3..777c4db793f 100644 --- a/app/components/widgets/forms/image-upload.js +++ b/app/components/widgets/forms/image-upload.js @@ -55,10 +55,14 @@ export default Component.extend({ reader.readAsDataURL(files[0]); }).catch(error => { - this.notify.error(error); + this.notify.error(error, { + id: 'unexpected_image_upload_1' + }); }); } else { - this.notify.error(this.l10n.t('No FileReader support. Please use a more latest browser')); + this.notify.error(this.l10n.t('No FileReader support. Please use a more latest browser'), { + id: 'unexpected_image_upload_2' + }); } }, diff --git a/package.json b/package.json index 20769abcee5..0c22c768a2f 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "ember-metrics": "poteto/ember-metrics#87f24d2", "ember-models-table": "^2.10.1", "ember-moment": "^7.8.1", - "ember-notify": "^5.3.0", + "ember-notify": "^6.0.0", "ember-print-this": "^1.0.0", "ember-qunit": "^4.4.1", "ember-resolver": "^5.0.0", diff --git a/yarn.lock b/yarn.lock index ccc06a1b19b..1adc354817a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6362,13 +6362,13 @@ ember-moment@^7.8.1: ember-getowner-polyfill "^2.2.0" ember-macro-helpers "^2.1.0" -ember-notify@^5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/ember-notify/-/ember-notify-5.3.0.tgz#8f798b7e8bbb9cca2511a15c34838c1afdc53cf3" +ember-notify@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/ember-notify/-/ember-notify-6.0.0.tgz#f92978e3452934f7c9b70d76ad2ec62bf072495a" + integrity sha512-2ewX5xwkGyZtkRRlgT/Tam5PaxGy78IoXltwt4s8roEam1esXNHfafzycvJwcuX7Hgrwr7LlTpmKP+81vWT3QQ== dependencies: - ember-cli-babel "^6.6.0" - ember-cli-htmlbars "^2.0.1" - object-assign "^4.1.0" + ember-cli-babel "^7.7.3" + ember-cli-htmlbars "^3.0.1" ember-print-this@^1.0.0: version "1.0.0" From b5bffd0b94da20962708c43ad4a317897aa463f2 Mon Sep 17 00:00:00 2001 From: kushthedude Date: Sun, 18 Aug 2019 06:18:50 +0530 Subject: [PATCH 2/3] Resolving Conflicts --- app/components/paypal-button.js | 173 ++++++++++++++++++++++---------- 1 file changed, 119 insertions(+), 54 deletions(-) diff --git a/app/components/paypal-button.js b/app/components/paypal-button.js index 9568dd061f2..dc2b8495300 100644 --- a/app/components/paypal-button.js +++ b/app/components/paypal-button.js @@ -8,66 +8,131 @@ export default Component.extend({ async didInsertElement() { this._super(...arguments); - let order = this.data; - let createPayload = { - 'data': { - 'attributes': { - 'return-url' : `${window.location.origin}/orders/${order.identifier}/view`, - 'cancel-url' : `${window.location.origin}/orders/${order.identifier}/pending` + if (this.paymentFor === 'order') { + let order = this.data; + let createPayload = { + 'data': { + 'attributes': { + 'return-url' : `${window.location.origin}/orders/${order.identifier}/view`, + 'cancel-url' : `${window.location.origin}/orders/${order.identifier}/pending` + }, + 'type': 'paypal-payment' + } + }; + + paypal.Button.render({ + commit: true, + + style: { + label : 'pay', + size : 'medium', // tiny, small, medium + color : 'gold', // orange, blue, silver + shape : 'pill' // pill, rect }, - 'type': 'paypal-payment' - } - }; - paypal.Button.render({ - commit: true, + payment: () => { + return this.loader.post(`orders/${order.identifier}/create-paypal-payment`, createPayload) + .then(res => { + return res.payment_id; + }); + }, + + onAuthorize: data => { + // this callback will be for authorizing the payments + let chargePayload = { + 'data': { + 'attributes': { + 'stripe' : null, + 'paypal_payer_id' : data.payerID, + 'paypal_payment_id' : data.paymentID + }, + 'type': 'charge' + } + }; + let config = { + skipDataTransform: true + }; + chargePayload = JSON.stringify(chargePayload); + return this.loader.post(`orders/${order.identifier}/charge`, chargePayload, config) + .then(charge => { + if (charge.data.attributes.status) { + this.notify.success(charge.data.attributes.message, { + id: 'paypal_button_success' + }); + this.router.transitionTo('orders.view', order.identifier); + } else { + this.notify.error(charge.data.attributes.message, { + id: 'paypal_button_error' + }); + } + }); + } + + }, this.elementId); - style: { - label : 'pay', - size : 'medium', // tiny, small, medium - color : 'gold', // orange, blue, silver - shape : 'pill' // pill, rect - }, + } else if (this.paymentFor === 'invoice') { + let eventInvoice = this.data; + let createPayload = { + 'data': { + 'attributes': { + 'return-url' : `${window.location.origin}/event-invoice/${eventInvoice.identifier}/paid`, + 'cancel-url' : `${window.location.origin}/event-invoice/${eventInvoice.identifier}/pending` + }, + 'type': 'paypal-payment' + } + }; + paypal.Button.render({ + env : 'sandbox', + commit : true, - payment: () => { - return this.loader.post(`orders/${order.identifier}/create-paypal-payment`, createPayload) - .then(res => { - return res.payment_id; - }); - }, + style: { + label : 'pay', + size : 'medium', // tiny, small, medium + color : 'gold', // orange, blue, silver + shape : 'pill' // pill, rect + }, - onAuthorize: data => { - // this callback will be for authorizing the payments - let chargePayload = { - 'data': { - 'attributes': { - 'stripe' : null, - 'paypal_payer_id' : data.payerID, - 'paypal_payment_id' : data.paymentID - }, - 'type': 'charge' - } - }; - let config = { - skipDataTransform: true - }; - chargePayload = JSON.stringify(chargePayload); - return this.loader.post(`orders/${order.identifier}/charge`, chargePayload, config) - .then(charge => { - if (charge.data.attributes.status) { - this.notify.success(charge.data.attributes.message, { - id: 'paypal_succ' - }); - this.router.transitionTo('orders.view', order.identifier); - } else { - this.notify.error(charge.data.attributes.message, { - id: 'err_paypal' - }); + payment: () => { + return this.loader.post(`event-invoices/${eventInvoice.identifier}/create-paypal-payment`, createPayload) + .then(res => { + return res.payment_id; + }); + }, + + onAuthorize: data => { + // this callback will be for authorizing the payments + let chargePayload = { + 'data': { + 'attributes': { + 'stripe' : null, + 'paypal_payer_id' : data.payerID, + 'paypal_payment_id' : data.paymentID + }, + 'type': 'charge' } - }); - } + }; + let config = { + skipDataTransform: true + }; + chargePayload = JSON.stringify(chargePayload); + return this.loader.post(`event-invoices/${eventInvoice.identifier}/charge`, chargePayload, config) + .then(charge => { + if (charge.status) { + this.notify.success(charge.status, { + id: 'paypal_button_success_1' + }); + this.router.transitionTo('event-invoice.paid', eventInvoice.identifier); + } else { + this.notify.error(charge.error, { + id: 'paypal_button_error_1' + }); + } + }); + } + + }, this.elementId); - }, this.elementId); + } } -}); +}); \ No newline at end of file From dbf9b5c38aaf346b75e50247885a1181d0d98e7a Mon Sep 17 00:00:00 2001 From: Kush Trivedi Date: Tue, 20 Aug 2019 14:54:52 +0530 Subject: [PATCH 3/3] Using snake case --- app/adapters/application.js | 2 +- app/components/account/application-section.js | 2 +- app/components/account/danger-zone.js | 2 +- app/components/events/view/export/download-common.js | 8 ++++---- app/components/forms/admin/settings/ticket-fees-form.js | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/adapters/application.js b/app/adapters/application.js index 24a86c3b319..da6304f1a86 100644 --- a/app/adapters/application.js +++ b/app/adapters/application.js @@ -43,7 +43,7 @@ export default JSONAPIAdapter.extend(HasManyQueryAdapterMixin, AdapterFetch, Cac if (statusCode !== 404 && statusCode !== 422 && statusCode !== 403 && statusCode !== 409) { this.notify.error('An unexpected error occurred.', { closeAfter : 5000, - id : 'Serve_Error' + id : 'serve_error' }); } }, diff --git a/app/components/account/application-section.js b/app/components/account/application-section.js index 44ce4b873b2..c6ad772b80a 100644 --- a/app/components/account/application-section.js +++ b/app/components/account/application-section.js @@ -38,7 +38,7 @@ export default Component.extend({ } } catch (error) { this.notify.error(this.l10n.t(error.message), { - id: 'Error_message' + id: 'error_message' }); this.set('isLoading', false); } diff --git a/app/components/account/danger-zone.js b/app/components/account/danger-zone.js index 3d7fc91b5c7..d6632b19403 100644 --- a/app/components/account/danger-zone.js +++ b/app/components/account/danger-zone.js @@ -34,7 +34,7 @@ export default Component.extend({ this.authManager.logout(); this.routing.transitionTo('index'); this.notify.success(this.l10n.t('Your account has been deleted successfully.'), { - id: 'Account_Delete' + id: 'account_Delete' }); }) .catch(() => { diff --git a/app/components/events/view/export/download-common.js b/app/components/events/view/export/download-common.js index 8da3969ce58..3f41f1d8da3 100644 --- a/app/components/events/view/export/download-common.js +++ b/app/components/events/view/export/download-common.js @@ -36,19 +36,19 @@ export default Component.extend({ this.requestLoop(exportJobInfo); this.set('eventExportStatus', exportJobStatus.state); this.notify.alert(this.l10n.t('Task is going on.'), { - id: 'Task_progress' + id: 'task_progress' }); } else { this.set('eventExportStatus', exportJobStatus.state); this.notify.error(this.l10n.t('Task failed.'), { - id: 'Task_fail' + id: 'task_fail' }); } }) .catch(() => { this.set('eventExportStatus', 'FAILURE'); this.notify.error(this.l10n.t('Task failed.'), { - if: 'failure' + id: 'task_failure' }); }) .finally(() => { @@ -67,7 +67,7 @@ export default Component.extend({ .catch(() => { this.set('isLoading', false); this.notify.error(this.l10n.t('Unexpected error occurred.'), { - id: 'Unexpected_down_error' + id: 'unexpected_down_error' }); }); } diff --git a/app/components/forms/admin/settings/ticket-fees-form.js b/app/components/forms/admin/settings/ticket-fees-form.js index bcd982eedfb..e05edc914a7 100644 --- a/app/components/forms/admin/settings/ticket-fees-form.js +++ b/app/components/forms/admin/settings/ticket-fees-form.js @@ -22,7 +22,7 @@ export default Component.extend({ }); if (incorrect_settings.length > 0) { this.notify.error(this.l10n.t('Existing items need to be completed before new items can be added.'), { - id: 'Existing_item' + id: 'existing_item' }); this.set('isLoading', false); } else {