Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a41ad107a1 | ||
|
|
f19ed5c5f2 | ||
|
|
9f33ea7975 |
No files matched your search
@@ -30,6 +30,23 @@ You need two values from PayPal: a **Client ID** and a **Secret**.
|
||||
Start in **Sandbox**, make a test donation using a PayPal sandbox buyer account, then repeat the steps
|
||||
with the Live credentials and switch the mode to Live in Settings.
|
||||
|
||||
### Going live
|
||||
1. In the PayPal developer dashboard (Apps & Credentials), switch to **Live** and create a Live app (type Merchant).
|
||||
2. In StreamGoals > Settings, paste the Live **Client ID** and **Secret**.
|
||||
3. Switch the mode to **Live**, then **Save and test connection**.
|
||||
4. Webhook: the plugin registers it for you when the test succeeds (changing mode or credentials clears the old one, so
|
||||
the Live webhook is created fresh). It points to `https://YOUR-SITE/wp-json/streamgoals/v1/webhook` and listens for
|
||||
`PAYMENT.CAPTURE.COMPLETED`. If the message says it could not register it (needs a public https site, or a webhook
|
||||
for that address already exists), add it by hand in your Live app in the PayPal dashboard with that URL and that event.
|
||||
5. Make a small real donation and check it appears under Donations and on your goal, then refund yourself in PayPal if you like.
|
||||
6. Set the visitor IP header if needed (Settings > Advanced; Cloudflare is detected automatically).
|
||||
7. Add the overlays in OBS as Browser Sources (StreamGoals > Overlays).
|
||||
8. Turn on two-factor authentication for both your PayPal and WordPress accounts.
|
||||
|
||||
### Chargebacks and refunds
|
||||
Chargebacks and refunds are handled manually in PayPal. The plugin does not track them, so totals, timers, counters
|
||||
and tiers are not reduced. If you need to compensate, adjust the goal or its rules yourself by editing them.
|
||||
|
||||
### Behind Cloudflare?
|
||||
Nothing to do: the plugin recognises Cloudflare automatically (by its published addresses) so each visitor is rate
|
||||
limited separately. For another proxy, choose it in StreamGoals > Settings > Advanced; the panel there shows what your
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.sg-donate{max-width:min(100%,440px);font:inherit}
|
||||
.sg-donate{width:100%;max-width:min(100%,440px);margin-left:auto;margin-right:auto;box-sizing:border-box;text-align:left;font:inherit}
|
||||
.sg-donate .sg-row{margin:0 0 .9rem}
|
||||
.sg-donate label{display:block;font-weight:600;margin-bottom:.25rem}
|
||||
.sg-donate label.sg-inline{display:flex;gap:.5rem;align-items:center;font-weight:400}
|
||||
@@ -45,8 +45,8 @@
|
||||
|
||||
/* Progress bar (theme-neutral: inherits text colour; fill uses currentColor so it follows the theme). */
|
||||
.sg-donate .sg-progress{margin:0 0 .9rem;max-width:100%;box-sizing:border-box}
|
||||
.sg-donate .sg-progress-bar{position:relative;height:14px;border:1px solid rgba(128,128,128,.6);border-radius:999px;background:rgba(128,128,128,.18);overflow:hidden}
|
||||
.sg-donate .sg-progress-fill{display:block;height:100%;width:0;background:currentColor;opacity:.75;border-radius:999px;transition:width .6s ease}
|
||||
.sg-donate .sg-progress-bar{position:relative;height:14px;border:1px solid rgba(128,128,128,.45);border-radius:999px;background:rgba(128,128,128,.22);overflow:hidden;box-shadow:inset 0 1px 2px rgba(0,0,0,.18)}
|
||||
.sg-donate .sg-progress-fill{display:block;height:100%;width:0;background:linear-gradient(90deg,var(--sg-accent,#7c5cff),var(--sg-accent2,#22d3ee));min-width:0;border-radius:999px;transition:width .6s ease}
|
||||
.sg-donate .sg-progress-text{display:flex;flex-wrap:wrap;justify-content:space-between;gap:.25rem .75rem;margin-top:.35rem;font-weight:600;line-height:1.4;overflow-wrap:anywhere}
|
||||
.sg-donate .sg-progress-tier,.sg-donate .sg-progress-done{margin:.25rem 0 0;font-size:.9em;line-height:1.4;overflow-wrap:anywhere}
|
||||
.sg-donate .sg-progress-done{font-weight:700}
|
||||
|
||||
@@ -98,13 +98,19 @@ final class DonationsPage {
|
||||
Admin::close();
|
||||
}
|
||||
|
||||
/** Moderation submenu exists only when moderation is on or items are pending (see Admin::menu); otherwise land on Donations. */
|
||||
public static function afterModerationPage( bool $moderationOn, int $pending ): string {
|
||||
return ( $moderationOn || $pending > 0 ) ? 'streamgoals-moderation' : 'streamgoals-donations';
|
||||
}
|
||||
|
||||
public static function handleModerate(): void {
|
||||
Admin::guard( 'sg_moderate' );
|
||||
$post = Admin::post_raw();
|
||||
$id = isset( $post['donation_id'] ) ? absint( $post['donation_id'] ) : 0;
|
||||
$to = isset( $post['decision'] ) && is_string( $post['decision'] ) ? $post['decision'] : '';
|
||||
$ok = $id && Store::setModeration( $id, $to );
|
||||
Admin::redirect( Admin::url( 'streamgoals-moderation' ), $ok ? 'success' : 'error', $ok ? ( 'approved' === $to ? 'Donation approved.' : 'Donation rejected.' ) : 'That donation could not be updated (it may already be reviewed).' );
|
||||
$page = self::afterModerationPage( (bool) Settings::get( 'moderate_messages' ), Store::pendingModerationCount() );
|
||||
Admin::redirect( Admin::url( $page ), $ok ? 'success' : 'error', $ok ? ( 'approved' === $to ? 'Donation approved.' : 'Donation rejected.' ) : 'That donation could not be updated (it may already be reviewed).' );
|
||||
}
|
||||
|
||||
public static function handleExport(): void {
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace StreamGoals\Tests\Unit;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use StreamGoals\Admin\Csv;
|
||||
use StreamGoals\Admin\DonationsPage;
|
||||
use StreamGoals\Admin\Format;
|
||||
use StreamGoals\Admin\Input;
|
||||
use StreamGoals\Admin\RuleConfig;
|
||||
@@ -133,4 +134,11 @@ final class AdminLogicTest extends TestCase {
|
||||
$this->assertTrue( Format::isTest( array( 'paypal_order_id' => 'TEST-abc' ) ) );
|
||||
$this->assertFalse( Format::isTest( array( 'paypal_order_id' => '5O1234' ) ) );
|
||||
}
|
||||
|
||||
public function test_after_moderation_redirect_only_to_registered_page(): void {
|
||||
$this->assertSame( 'streamgoals-donations', DonationsPage::afterModerationPage( false, 0 ) );
|
||||
$this->assertSame( 'streamgoals-moderation', DonationsPage::afterModerationPage( false, 2 ) );
|
||||
$this->assertSame( 'streamgoals-moderation', DonationsPage::afterModerationPage( true, 0 ) );
|
||||
$this->assertSame( 'streamgoals-moderation', DonationsPage::afterModerationPage( true, 5 ) );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user