Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Commit

Permalink
Changes:
Browse files Browse the repository at this point in the history
- Added snaps for test
- Failure reason being sent from backend(Language specific)
  • Loading branch information
subbiahsn committed Apr 23, 2019
1 parent 682cd2a commit c47904d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Expand Up @@ -154,6 +154,8 @@ exports[`renders all amounts with the currency symbol 1`] = `
"fundraiser.one_click_failed": "We're sorry but we could not process your donation. Please try again with a different card.",
"fundraiser.one_click_warning": "Your donation will be processed immediately.",
"fundraiser.oneclick.credit_card_payment_method": "{card_type} ending in {last_four_digits}",
"fundraiser.oneclick.duplicate_donation": "You've just made a donation a few minutes ago. Are you sure, you want to donate again? We're doing this to make sure you don't accidentally donate twice.
Thanks so much for everything you do!",
"fundraiser.oneclick.new_payment_method": "Add payment method",
"fundraiser.oneclick.paypal_payment_method": "Paypal ({email})",
"fundraiser.oneclick.select_payment": "Select a saved payment method",
Expand Down Expand Up @@ -591,6 +593,8 @@ exports[`renders correctly 1`] = `
"fundraiser.one_click_failed": "We're sorry but we could not process your donation. Please try again with a different card.",
"fundraiser.one_click_warning": "Your donation will be processed immediately.",
"fundraiser.oneclick.credit_card_payment_method": "{card_type} ending in {last_four_digits}",
"fundraiser.oneclick.duplicate_donation": "You've just made a donation a few minutes ago. Are you sure, you want to donate again? We're doing this to make sure you don't accidentally donate twice.
Thanks so much for everything you do!",
"fundraiser.oneclick.new_payment_method": "Add payment method",
"fundraiser.oneclick.paypal_payment_method": "Paypal ({email})",
"fundraiser.oneclick.select_payment": "Select a saved payment method",
Expand Down
5 changes: 4 additions & 1 deletion app/javascript/components/ExpressDonation/ExpressDonation.js
Expand Up @@ -42,6 +42,7 @@ type State = {
submitting: boolean,
openPopup: boolean,
opt_for_redonation: boolean,
failureReason: string,
};

export class ExpressDonation extends Component<Props, State> {
Expand All @@ -55,6 +56,7 @@ export class ExpressDonation extends Component<Props, State> {
submitting: false,
openPopup: false,
opt_for_redonation: false,
failureReason: '',
};
}

Expand Down Expand Up @@ -94,6 +96,7 @@ export class ExpressDonation extends Component<Props, State> {
openPopup: reason.responseJSON
? reason.responseJSON.immediate_redonation
: false,
failureReason: reason.responseJSON.message,
});
this.props.setSubmitting(false);
ee.emit('fundraiser:transaction_error', reason, this.props.formData);
Expand Down Expand Up @@ -223,7 +226,7 @@ export class ExpressDonation extends Component<Props, State> {
>
<div className="PaymentExpressDonationConflict">
<div className="PaymentExpressDonationConflict--reason">
<FormattedHTMLMessage id="fundraiser.oneclick.duplicate_donation" />
{this.state.failureReason}
</div>
<Button
className="PaymentExpressDonationConflict--accept"
Expand Down
Expand Up @@ -140,6 +140,8 @@ exports[`Snapshots: With default messages object 1`] = `
"fundraiser.one_click_failed": "We're sorry but we could not process your donation. Please try again with a different card.",
"fundraiser.one_click_warning": "Your donation will be processed immediately.",
"fundraiser.oneclick.credit_card_payment_method": "{card_type} ending in {last_four_digits}",
"fundraiser.oneclick.duplicate_donation": "You've just made a donation a few minutes ago. Are you sure, you want to donate again? We're doing this to make sure you don't accidentally donate twice.
Thanks so much for everything you do!",
"fundraiser.oneclick.new_payment_method": "Add payment method",
"fundraiser.oneclick.paypal_payment_method": "Paypal ({email})",
"fundraiser.oneclick.select_payment": "Select a saved payment method",
Expand Down

0 comments on commit c47904d

Please sign in to comment.