[WMDE-Fundraising] Create validation endpoints for amount and personal info
Closed, ResolvedPublic

Description

For the client-side validation of the entered values we need some JSON endpoints that validate parts of a donation:

  • Payment amount, depending on payment type and period type
  • Personal info, depending on payment type (some don't allow anonymous)

The relevant validators already exist, they just need to be exposed with a JSON API.

gabriel-wmde updated the task description. (Show Details)
gabriel-wmde raised the priority of this task from to Normal.
gabriel-wmde claimed this task.
JeroenDeDauw added a comment.EditedFeb 17 2016, 10:57 PM

As far as I can tell, the amount validation only needs the payment type.

private function getMinAmount( DonationData $donationData ) { 
		return (
			$donationData->getPaymentMethod() === DonationData::PAYMENT_CREDIT_CARD ||
			$donationData->getPaymentMethod() === DonationData::PAYMENT_PAYPAL
		) ? 1 : 0.01;

The policy validator uses the interval stuff, though if I understand stuff correctly, this is only relevant for determining if the donation should be moderated. Or should the validation endpoint have "ok", "not ok" and "will need moderation" as responses, as opposed to just the first two?

I've modified the AmountValidator to have this behavior, as the AddDonation UC did not have it yet. https://github.com/wmde/FundraisingFrontend/pull/175

The validation fails (hard) only if the amount is too low. High amounts are appreciated, but reassured beforehand and thus result in moderation.

gabriel-wmde renamed this task from Create validation endpoints for amount and personal info to [WMDE-Fundraising] Create validation endpoints for amount and personal info.Mar 8 2016, 3:55 PM

Does something still need to be done here, or has this been completed?

This has been completed.

gabriel-wmde closed this task as Resolved.Mar 14 2016, 1:45 PM
Tobi_WMDE_SW moved this task from Incoming to Done on the TCB-Team board.Mar 17 2016, 2:01 PM