@wiicode/youcanpay-sdk 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +18 -18
  2. package/package.json +22 -6
package/README.md CHANGED
@@ -22,11 +22,11 @@ Works with **any Node.js framework** (Express, Fastify, Hapi) and has first-clas
22
22
  ## Installation
23
23
 
24
24
  ```bash
25
- npm install youcanpay-sdk
25
+ npm install @wiicode/youcanpay-sdk
26
26
  ```
27
27
 
28
28
  ```bash
29
- yarn add youcanpay-sdk
29
+ yarn add @wiicode/youcanpay-sdk
30
30
  ```
31
31
 
32
32
  ### Peer Dependencies
@@ -70,7 +70,7 @@ YCP_WEBHOOK_SECRET=your_random_secret_here
70
70
  ### Plain Node.js / Express
71
71
 
72
72
  ```typescript
73
- import { YouCanPayClient, CurrencyCode } from 'youcanpay-sdk';
73
+ import { YouCanPayClient, CurrencyCode } from '@wiicode/youcanpay-sdk';
74
74
 
75
75
  // Initialize client
76
76
  const client = new YouCanPayClient({
@@ -103,7 +103,7 @@ async function createPayment() {
103
103
  ```typescript
104
104
  // app.module.ts
105
105
  import { Module } from '@nestjs/common';
106
- import { YouCanPayModule } from 'youcanpay-sdk';
106
+ import { YouCanPayModule } from '@wiicode/youcanpay-sdk';
107
107
 
108
108
  @Module({
109
109
  imports: [
@@ -123,7 +123,7 @@ export class AppModule {}
123
123
  // app.module.ts
124
124
  import { Module } from '@nestjs/common';
125
125
  import { ConfigModule, ConfigService } from '@nestjs/config';
126
- import { YouCanPayModule } from 'youcanpay-sdk';
126
+ import { YouCanPayModule } from '@wiicode/youcanpay-sdk';
127
127
 
128
128
  @Module({
129
129
  imports: [
@@ -146,7 +146,7 @@ export class AppModule {}
146
146
  ```typescript
147
147
  // payments.service.ts
148
148
  import { Injectable } from '@nestjs/common';
149
- import { YouCanPayService, CurrencyCode } from 'youcanpay-sdk';
149
+ import { YouCanPayService, CurrencyCode } from '@wiicode/youcanpay-sdk';
150
150
 
151
151
  @Injectable()
152
152
  export class PaymentsService {
@@ -250,7 +250,7 @@ async function initiatePayment(userId: string, amount: number) {
250
250
  #### Step 7-8: Handle Webhook
251
251
 
252
252
  ```typescript
253
- import { parseWebhookPayload, verifyWebhookSecret } from 'youcanpay-sdk';
253
+ import { parseWebhookPayload, verifyWebhookSecret } from '@wiicode/youcanpay-sdk';
254
254
 
255
255
  app.post('/webhook', async (req, res) => {
256
256
  // Verify webhook secret
@@ -384,7 +384,7 @@ import {
384
384
  verifyWebhookSecret,
385
385
  verifyWebhookHMAC,
386
386
  createWebhookSignature,
387
- } from 'youcanpay-sdk';
387
+ } from '@wiicode/youcanpay-sdk';
388
388
 
389
389
  // Parse YouCanPay webhook payload
390
390
  const webhook = parseWebhookPayload(requestBody);
@@ -415,7 +415,7 @@ import {
415
415
  validateIP,
416
416
  validateEmail,
417
417
  validatePaymentInput,
418
- } from 'youcanpay-sdk';
418
+ } from '@wiicode/youcanpay-sdk';
419
419
 
420
420
  // All return: { valid: boolean, error?: string }
421
421
 
@@ -446,7 +446,7 @@ import {
446
446
  formatAmount,
447
447
  sanitizeString,
448
448
  SUPPORTED_CURRENCIES,
449
- } from 'youcanpay-sdk';
449
+ } from '@wiicode/youcanpay-sdk';
450
450
 
451
451
  toCentimes(50.00); // 5000
452
452
  fromCentimes(5000); // 50.00
@@ -466,7 +466,7 @@ import type {
466
466
  ParsedWebhookPayload,
467
467
  ValidationResult,
468
468
  CurrencyCode,
469
- } from 'youcanpay-sdk';
469
+ } from '@wiicode/youcanpay-sdk';
470
470
  ```
471
471
 
472
472
  ---
@@ -500,7 +500,7 @@ YouCanPay sends webhooks with this structure:
500
500
  ### Parsing with SDK
501
501
 
502
502
  ```typescript
503
- import { parseWebhookPayload, ParsedWebhookPayload } from 'youcanpay-sdk';
503
+ import { parseWebhookPayload, ParsedWebhookPayload } from '@wiicode/youcanpay-sdk';
504
504
 
505
505
  const webhook: ParsedWebhookPayload = parseWebhookPayload(requestBody);
506
506
 
@@ -527,7 +527,7 @@ import {
527
527
  ParseWebhookPipe,
528
528
  ParsedWebhookPayload,
529
529
  verifyWebhookSecret,
530
- } from 'youcanpay-sdk';
530
+ } from '@wiicode/youcanpay-sdk';
531
531
 
532
532
  @Controller('payments')
533
533
  export class PaymentsController {
@@ -674,7 +674,7 @@ PENDING ──────┬──────> COMPLETED (webhook: transaction
674
674
  YouCanPay uses **centimes** (smallest currency unit):
675
675
 
676
676
  ```typescript
677
- import { toCentimes, fromCentimes, formatAmount } from 'youcanpay-sdk';
677
+ import { toCentimes, fromCentimes, formatAmount } from '@wiicode/youcanpay-sdk';
678
678
 
679
679
  // User enters: 50.00 MAD
680
680
  const centimes = toCentimes(50.00); // 5000
@@ -686,7 +686,7 @@ const display = formatAmount(5000, 'MAD'); // "50.00 MAD"
686
686
  ### Input Validation
687
687
 
688
688
  ```typescript
689
- import { validatePaymentInput } from 'youcanpay-sdk';
689
+ import { validatePaymentInput } from '@wiicode/youcanpay-sdk';
690
690
 
691
691
  const validation = validatePaymentInput({
692
692
  amount: userInput.amount,
@@ -718,7 +718,7 @@ if (!validation.valid) {
718
718
  ### YouCanPayError
719
719
 
720
720
  ```typescript
721
- import { YouCanPayError, ErrorCodes } from 'youcanpay-sdk';
721
+ import { YouCanPayError, ErrorCodes } from '@wiicode/youcanpay-sdk';
722
722
 
723
723
  try {
724
724
  await client.createToken({ ... });
@@ -790,7 +790,7 @@ Use any future expiry date and any 3-digit CVV.
790
790
 
791
791
  ```typescript
792
792
  // Jest mock
793
- jest.mock('youcanpay-sdk', () => ({
793
+ jest.mock('@wiicode/youcanpay-sdk', () => ({
794
794
  YouCanPayClient: jest.fn().mockImplementation(() => ({
795
795
  createToken: jest.fn().mockResolvedValue({
796
796
  token: { id: 'test-token-123' },
@@ -841,7 +841,7 @@ interface YouCanPayOptions {
841
841
  ## Support
842
842
 
843
843
  - [YouCanPay Documentation](https://youcanpay.com/docs)
844
- - [GitHub Issues](https://github.com/your-repo/youcanpay-sdk/issues)
844
+ - [npm Package](https://www.npmjs.com/package/@wiicode/youcanpay-sdk)
845
845
 
846
846
  ## License
847
847
 
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "@wiicode/youcanpay-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Production-ready YouCanPay SDK for Node.js and NestJS",
5
5
  "author": "WiiCode",
6
6
  "license": "MIT",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
9
- "files": ["dist", "README.md"],
9
+ "files": [
10
+ "dist",
11
+ "README.md"
12
+ ],
10
13
  "publishConfig": {
11
14
  "access": "public"
12
15
  },
@@ -18,16 +21,29 @@
18
21
  "lint": "eslint 'src/**/*.ts'",
19
22
  "prepublishOnly": "npm run build"
20
23
  },
21
- "keywords": ["youcanpay", "nestjs", "payment", "morocco", "mad", "cashplus"],
24
+ "keywords": [
25
+ "youcanpay",
26
+ "nestjs",
27
+ "payment",
28
+ "morocco",
29
+ "mad",
30
+ "cashplus"
31
+ ],
22
32
  "peerDependencies": {
23
33
  "@nestjs/common": "^9.0.0 || ^10.0.0 || ^11.0.0",
24
34
  "@nestjs/core": "^9.0.0 || ^10.0.0 || ^11.0.0",
25
35
  "reflect-metadata": "^0.1.13 || ^0.2.0"
26
36
  },
27
37
  "peerDependenciesMeta": {
28
- "@nestjs/common": { "optional": true },
29
- "@nestjs/core": { "optional": true },
30
- "reflect-metadata": { "optional": true }
38
+ "@nestjs/common": {
39
+ "optional": true
40
+ },
41
+ "@nestjs/core": {
42
+ "optional": true
43
+ },
44
+ "reflect-metadata": {
45
+ "optional": true
46
+ }
31
47
  },
32
48
  "dependencies": {
33
49
  "axios": "^1.6.0",