Skip to content

Add disbursement support, webhook verification, and CI#1

Open
MrOne-inc wants to merge 1 commit into
Neurotech-HQ:mainfrom
MrOne-inc:feature/improvements
Open

Add disbursement support, webhook verification, and CI#1
MrOne-inc wants to merge 1 commit into
Neurotech-HQ:mainfrom
MrOne-inc:feature/improvements

Conversation

@MrOne-inc

Copy link
Copy Markdown

Summary

  • Disbursement support: New Payout and PayoutBuilder classes with fluent API for mobile money and bank payouts, plus mobileMoneyPayout(), bankPayout(), findPayout(), payouts(), and payoutFee() methods on the Snippe client
  • Webhook signature verification: HMAC-SHA256 verification via isValid($secret) and verify($secret) methods on the Webhook class — prevents accepting forged webhook events
  • Payout webhook events: Added isPayoutCompleted() and isPayoutFailed() helpers
  • GitHub Actions CI: Automated test suite running on PHP 8.1, 8.2, 8.3, and 8.4

Usage examples

Payouts

// Mobile money payout
$payout = $snippe->mobileMoneyPayout(5000, '0754123456', 'John Doe')
    ->narration('Salary payment')
    ->webhook('https://yoursite.com/webhook')
    ->send();

echo $payout->reference(); // "667c9279-..."
echo $payout->fees();      // fee amount

// Bank payout
$payout = $snippe->bankPayout(10000, 'CRDB', '0200000000', 'Jane Smith')
    ->narration('Invoice payment')
    ->send();

// Check fee before sending
$fee = $snippe->payoutFee(5000);

Webhook signature verification

$event = Webhook::capture();
$event->verify('your_webhook_secret'); // throws SnippeException if invalid

if ($event->isPayoutCompleted()) {
    // handle payout completion
}

Test plan

  • All 66 tests pass (166 assertions) — ran locally on PHP 8.2
  • CI should run automatically on this PR
  • Verify payout endpoints with live API key

- Add Payout and PayoutBuilder classes for mobile money and bank payouts
- Add disbursement methods to Snippe client (mobileMoneyPayout, bankPayout,
  findPayout, payouts, payoutFee)
- Add HMAC-SHA256 webhook signature verification (isValid/verify methods)
- Add payout webhook event helpers (isPayoutCompleted, isPayoutFailed)
- Add GitHub Actions CI workflow for PHP 8.1-8.4
- Add tests for all new functionality (20 new tests, 66 total)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant