Donate form: custom-amount label, visible minimum, fee-cover info icon; hard 1.00 floor; purge abandoned checkouts; drop refund filters; soften personal-account wording
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a259c0b0a1
commit
e22675f54b
13 files changed
+177
-15
No files matched your search
@@ -24,7 +24,7 @@ final class DonationsPage {
|
||||
|
||||
echo '<form method="get" class="sg-filter"><input type="hidden" name="page" value="streamgoals-donations">';
|
||||
echo '<select name="status" aria-label="Status"><option value="">All statuses</option>';
|
||||
foreach ( array( 'completed', 'pending', 'refunded', 'reversed' ) as $s ) {
|
||||
foreach ( array( 'completed', 'pending' ) as $s ) {
|
||||
echo '<option value="' . esc_attr( $s ) . '"' . selected( $status, $s, false ) . '>' . esc_html( ucfirst( $s ) ) . '</option>';
|
||||
}
|
||||
echo '</select> <label><input type="checkbox" name="tests" value="hide"' . checked( $tests, 'hide', false ) . '> Hide test donations</label> ';
|
||||
|
||||
@@ -59,7 +59,7 @@ final class PayPalConnector {
|
||||
public static function instructions(): void {
|
||||
?>
|
||||
<ol class="sg-steps">
|
||||
<li>You need a <strong>PayPal Business</strong> account (free). A personal account cannot receive donations this way. <a href="https://www.paypal.com/business" target="_blank" rel="noopener noreferrer">Create one</a> or upgrade your existing account in PayPal settings.</li>
|
||||
<li>To take <em>real</em> payments PayPal requires a <strong>PayPal Business</strong> account (free; your own name is fine). Practising in Sandbox needs no business account. <a href="https://www.paypal.com/business" target="_blank" rel="noopener noreferrer">Create one</a> or upgrade your existing account in PayPal settings.</li>
|
||||
<li>Open <a href="https://developer.paypal.com/dashboard/applications" target="_blank" rel="noopener noreferrer">developer.paypal.com/dashboard/applications</a> and log in with that Business account.</li>
|
||||
<li>At the top, pick <strong>Sandbox</strong> (to practise) or <strong>Live</strong> (real money) and click <strong>Create App</strong>.</li>
|
||||
<li>Give it any name (for example "My stream"), keep the type <strong>Merchant</strong>, and click <strong>Create App</strong>.</li>
|
||||
|
||||
@@ -33,7 +33,7 @@ final class SettingsPage {
|
||||
echo '<option value="' . esc_attr( $c ) . '"' . selected( $cur, $c, false ) . '>' . esc_html( $c . ' - ' . $name ) . '</option>';
|
||||
}
|
||||
echo '</select><p class="description">One currency for the whole site. It applies to goals you create from now on; existing goals keep their currency. Check the fixed fee below after changing it.</p></td></tr>';
|
||||
echo '<tr><th scope="row"><label for="sg_min">Minimum donation (' . esc_html( $cur ) . ')</label></th><td><input type="text" id="sg_min" name="min_donation" class="small-text" inputmode="decimal" value="' . esc_attr( Format::decimal( (int) $s['min_donation_minor'], $cur ) ) . '"></td></tr>';
|
||||
echo '<tr><th scope="row"><label for="sg_min">Minimum donation (' . esc_html( $cur ) . ')</label></th><td><input type="text" id="sg_min" name="min_donation" class="small-text" inputmode="decimal" value="' . esc_attr( Format::decimal( \StreamGoals\Core\Settings::effectiveMin( (int) $s['min_donation_minor'] ), $cur ) ) . '"> <span class="description">At least ' . esc_html( Format::money( \StreamGoals\Core\Settings::HARD_MIN_MINOR, $cur ) ) . '. Visitors cannot donate less than this.</span></td></tr>';
|
||||
echo '<tr><th scope="row"><label for="sg_len">Longest message</label></th><td><input type="number" id="sg_len" name="message_max_length" min="0" max="500" class="small-text" value="' . (int) $s['message_max_length'] . '"> characters <span class="description">(0 to 500; 0 = no messages)</span></td></tr>';
|
||||
echo '<tr><th scope="row">Names</th><td><fieldset>';
|
||||
foreach ( self::POLICIES as $k => $l ) {
|
||||
@@ -64,8 +64,8 @@ final class SettingsPage {
|
||||
$upd = array();
|
||||
|
||||
$min = Input::amountToMinor( $post['min_donation'] ?? '', $cur );
|
||||
if ( null === $min || $min < 1 ) {
|
||||
$errors[] = 'Minimum donation must be an amount greater than zero.';
|
||||
if ( null === $min || $min < \StreamGoals\Core\Settings::HARD_MIN_MINOR ) {
|
||||
$errors[] = 'Minimum donation must be at least ' . Format::money( \StreamGoals\Core\Settings::HARD_MIN_MINOR, $cur ) . '. PayPal\'s fixed fee makes smaller donations lose money.';
|
||||
} else {
|
||||
$upd['min_donation_minor'] = $min;
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ final class Store {
|
||||
$w = array( '1=1' );
|
||||
$args = array();
|
||||
$st = $f['status'] ?? '';
|
||||
if ( in_array( $st, array( 'pending', 'completed', 'refunded', 'reversed' ), true ) ) {
|
||||
if ( in_array( $st, array( 'pending', 'completed' ), true ) ) {
|
||||
$w[] = 'status = %s';
|
||||
$args[] = $st;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user