Skip to content

Conversation

@donjerick
Copy link
Collaborator

🎉 Initial Release: Magpie Node.js SDK v1.0.0

This PR introduces the complete, production-ready Magpie Node.js SDK for seamless integration with Magpie's payment processing APIs.

🚀 What's New

Core SDK Features

  • Complete TypeScript SDK with full type safety and IntelliSense support
  • Customer Management - Create, retrieve, update, delete customers with email lookup
  • Payment Sources - Secure tokenization for cards and bank accounts
  • Charge Processing - Create, capture, verify, void, and refund operations
  • Checkout Sessions - Hosted payment pages with line items and customization
  • Payment Requests - Email-based payment requests with void capabilities
  • Payment Links - Shareable payment links with inventory management
  • Webhook Handling - Complete signature verification and event construction

Developer Experience

  • 🔧 Modern Node.js Support - Node.js 18+ with CommonJS/ESM compatibility
  • 📚 Rich Documentation - Complete JSDoc coverage with usage examples
  • 🎯 TypeScript First - Full type definitions with namespace organization
  • Multiple Import Styles - Support for both import and require()
  • 🛠️ Professional Tooling - ESLint, Prettier, Jest with comprehensive testing

Production Features

  • 🔒 Security - Timing-safe webhook verification, secure API key validation
  • 🔄 Resilience - Intelligent retry logic with exponential backoff and jitter
  • 📊 Observability - Debug logging, request/response tracking with request IDs
  • ⚙️ Configuration - Flexible timeout, environment, and base URL settings
  • 🔑 Idempotency - Safe request retries with idempotency key support

📊 Stats

  • 31 source files with complete TypeScript implementation
  • 227 tests across 9 comprehensive test suites
  • 66%+ code coverage with realistic thresholds for v1.0.0
  • 9 API resources fully implemented and tested
  • Professional CI/CD with automated testing and publishing

🧪 Testing

All tests passing with comprehensive coverage:

Test Suites: 9 passed, 9 total
Tests: 227 passed, 227 total
Coverage: 66.27% statements, 67.57% lines, 66.03% functions

Test Coverage Includes:

  • ✅ Unit Tests - All resources, utilities, and error handling
  • ✅ Integration Tests - End-to-end API workflows
  • ✅ Edge Cases - Error conditions, validation, and boundary testing
  • ✅ Webhook Security - Signature verification and timestamp validation

📦 Installation & Usage

npm install @magpieim/magpie-node
import Magpie from '@magpieim/magpie-node';

const magpie = new Magpie('sk_test_...');

// Create a customer
const customer = await magpie.customers.create({
  name: 'John Doe',
  email: 'john@example.com'
});

// Process a payment
const charge = await magpie.charges.create({
  amount: 50000, // ₱500.00 in centavos
  currency: 'php',
  source: customer.default_source
});

🏗️ Architecture

develop → beta → main (production releases)
  • develop: Active development, rapid iteration
  • beta: Stable releases for testing and validation
  • main: Production releases with automated NPM publishing

✅ Pre-merge Checklist

All tests passing (227/227)
Coverage above thresholds (66%+)
TypeScript compilation successful
ESLint passes with zero errors
Documentation complete and accurate
CI/CD pipeline working correctly
Package.json metadata updated
CHANGELOG.md populated with v1.0.0 features
README.md with comprehensive usage examples

- Remove npm cache from CI workflow
- Clean up gitignore by removing unnecessary lock file patterns
- Keep pnpm-lock.yaml as the primary lock file
- Streamline CI for better performance
chore: optimize CI and gitignore for pnpm workflow
- Change from npm ci to npm install to work with pnpm-lock.yaml
- Keep single lock file approach (pnpm-lock.yaml only)
- Avoid developer confusion from multiple lock files
- CI will generate node_modules from existing lock file
- Apply fix to both test and publish jobs
fix: use npm install instead of npm ci in GitHub Actions
@donjerick donjerick merged commit 3d96675 into main Sep 4, 2025
8 checks passed
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.

2 participants