vibes-plug 2.14.1 → 3.9.0
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.
- package/.claude/rules/vibes-plug-core.md +5 -0
- package/.cursor/rules/vibes-plug-core.mdc +7 -2
- package/.cursorrules +8 -2
- package/AGENTS.md +23 -2
- package/CHANGELOG.md +114 -0
- package/CLAUDE.md +10 -3
- package/README.md +216 -611
- package/bin/vibes.mjs +1104 -0
- package/package.json +11 -3
- package/plugin.json +4 -3
- package/scripts/check-anti-slop.mjs +53 -0
- package/scripts/install.js +3 -1
- package/scripts/update_skills.js +1 -1
- package/scripts/update_skills.mjs +86 -0
- package/scripts/validate-skills.mjs +111 -0
- package/skills/accessibility-testing-expert/SKILL.md +117 -116
- package/skills/affective-computing-emotion-ai/SKILL.md +83 -0
- package/skills/agentic-coding-workflow-expert/SKILL.md +297 -0
- package/skills/agentic-memory-architect/SKILL.md +52 -0
- package/skills/agentic-micro-economy-architect/SKILL.md +92 -0
- package/skills/ai-llm-integration-expert/SKILL.md +330 -194
- package/skills/ai-media-generation-expert/SKILL.md +173 -172
- package/skills/ai-prompt-engineering-expert/SKILL.md +204 -134
- package/skills/ai-safety-governance-expert/SKILL.md +223 -0
- package/skills/angular-expert/SKILL.md +149 -148
- package/skills/anti-slop/SKILL.md +134 -133
- package/skills/api-design-expert/SKILL.md +4 -3
- package/skills/api-gateway-proxy-expert/SKILL.md +3 -2
- package/skills/app-analyzer-optimizer/SKILL.md +4 -3
- package/skills/apple-ecosystem-expert/SKILL.md +6 -5
- package/skills/astro-framework-expert/SKILL.md +201 -200
- package/skills/async-queue-temporal-expert/SKILL.md +218 -217
- package/skills/authentication-identity-expert/SKILL.md +174 -173
- package/skills/autonomous-red-teamer/SKILL.md +338 -203
- package/skills/autonomous-tdd-debugger/SKILL.md +6 -5
- package/skills/biome-linter-formatter-expert/SKILL.md +90 -89
- package/skills/blockchain-web3-expert/SKILL.md +116 -115
- package/skills/brainstorming/SKILL.md +392 -377
- package/skills/browser-automation-expert/SKILL.md +260 -222
- package/skills/bun-runtime-expert/SKILL.md +5 -4
- package/skills/chatbot-messaging-expert/SKILL.md +115 -114
- package/skills/ci-cd-devops-architect/SKILL.md +3 -2
- package/skills/cloud-hosting-expert/SKILL.md +5 -4
- package/skills/coderabbit/SKILL.md +5 -4
- package/skills/compliance-gdpr-privacy-expert/SKILL.md +3 -2
- package/skills/composable-mach-architect/SKILL.md +338 -0
- package/skills/cron-scheduler-expert/SKILL.md +5 -4
- package/skills/data-pipeline-etl-expert/SKILL.md +3 -2
- package/skills/data-telemetry-expert/SKILL.md +5 -4
- package/skills/data-visualization-expert/SKILL.md +155 -154
- package/skills/database-orm-expert/SKILL.md +166 -165
- package/skills/deep-research-analyst/SKILL.md +182 -136
- package/skills/dependency-upgrade-migrator/SKILL.md +11 -10
- package/skills/design-system-architect/SKILL.md +4 -3
- package/skills/desktop-electron-expert/SKILL.md +129 -128
- package/skills/documentation-site-expert/SKILL.md +60 -59
- package/skills/doku-mcp-server/SKILL.md +5 -4
- package/skills/doku-payment-gateway/SKILL.md +250 -232
- package/skills/domain-driven-design-expert/SKILL.md +3 -2
- package/skills/e2e-testing-expert/SKILL.md +5 -4
- package/skills/ecommerce-expert/SKILL.md +88 -87
- package/skills/email-notification-expert/SKILL.md +5 -4
- package/skills/ephemeral-generative-ui-architect/SKILL.md +88 -0
- package/skills/error-resilience-expert/SKILL.md +14 -13
- package/skills/event-driven-architect/SKILL.md +5 -4
- package/skills/feature-flag-analytics-expert/SKILL.md +3 -2
- package/skills/file-upload-media-expert/SKILL.md +5 -4
- package/skills/firebase-security-expert/SKILL.md +5 -4
- package/skills/form-validation-expert/SKILL.md +7 -6
- package/skills/frontier-ai-models-expert/SKILL.md +116 -0
- package/skills/fullstack-expert/SKILL.md +185 -184
- package/skills/gemini-agent-booster/SKILL.md +248 -172
- package/skills/geospatial-maps-expert/SKILL.md +81 -80
- package/skills/global-a11y-i18n-expert/SKILL.md +5 -4
- package/skills/glsl-shader-expert/SKILL.md +191 -190
- package/skills/go-programming-expert/SKILL.md +5 -4
- package/skills/graph-rag-knowledge-expert/SKILL.md +201 -200
- package/skills/graphql-apollo-expert/SKILL.md +5 -4
- package/skills/headless-cms-expert/SKILL.md +182 -181
- package/skills/hig/SKILL.md +5 -4
- package/skills/js-backend-expert/SKILL.md +219 -218
- package/skills/legacy-code-translator/SKILL.md +6 -5
- package/skills/llm-finops-router/SKILL.md +52 -0
- package/skills/local-slm-edge-ai-expert/SKILL.md +168 -167
- package/skills/logging-error-tracking-expert/SKILL.md +5 -4
- package/skills/mcp-server-architect/SKILL.md +315 -307
- package/skills/micro-frontend-architect/SKILL.md +5 -4
- package/skills/mobile-expo-expert/SKILL.md +5 -4
- package/skills/modern-css-native-expert/SKILL.md +190 -189
- package/skills/monorepo-architect/SKILL.md +5 -4
- package/skills/mpa-orchestrator/SKILL.md +41 -4
- package/skills/multi-agent-orchestration/SKILL.md +388 -254
- package/skills/mvc-expert/SKILL.md +5 -4
- package/skills/n8n-automation-expert/SKILL.md +90 -89
- package/skills/nextjs-app-router-expert/SKILL.md +3 -2
- package/skills/openapi-swagger-codegen-expert/SKILL.md +4 -3
- package/skills/payment-gateway-expert/SKILL.md +131 -128
- package/skills/pdf-document-generation-expert/SKILL.md +92 -91
- package/skills/performance-web-vitals/SKILL.md +5 -4
- package/skills/post-quantum-crypto-migrator/SKILL.md +3 -2
- package/skills/prd-architect/SKILL.md +183 -182
- package/skills/proactive-background-watcher/SKILL.md +5 -4
- package/skills/production-ready-hardener/SKILL.md +10 -9
- package/skills/pwa-offline-first-expert/SKILL.md +227 -226
- package/skills/pydantic-ai-expert/SKILL.md +162 -161
- package/skills/python-programming-expert/SKILL.md +5 -4
- package/skills/rate-limit-abuse-prevention/SKILL.md +5 -4
- package/skills/realtime-collaboration-expert/SKILL.md +3 -2
- package/skills/rich-text-editor-expert/SKILL.md +178 -177
- package/skills/rust-programming-expert/SKILL.md +5 -4
- package/skills/saas-architect/SKILL.md +155 -154
- package/skills/saas-billing/SKILL.md +394 -382
- package/skills/saas-multi-tenant/SKILL.md +7 -6
- package/skills/scalability-clean-code/SKILL.md +5 -4
- package/skills/search-engine-expert/SKILL.md +90 -89
- package/skills/self-healing-cloud-orchestrator/SKILL.md +3 -2
- package/skills/senior-frontend/SKILL.md +14 -9
- package/skills/seo/SKILL.md +4 -4
- package/skills/session-memory-manager/SKILL.md +129 -128
- package/skills/solidjs-expert/SKILL.md +81 -80
- package/skills/spa-orchestrator/SKILL.md +5 -4
- package/skills/sse-websocket-streaming-expert/SKILL.md +3 -2
- package/skills/state-management-expert/SKILL.md +5 -4
- package/skills/supabase-security-expert/SKILL.md +5 -4
- package/skills/svelte-sveltekit-expert/SKILL.md +92 -91
- package/skills/svg-animation-motion-expert/SKILL.md +3 -2
- package/skills/synthetic-data-finetuning-expert/SKILL.md +156 -155
- package/skills/tailwind-expert/SKILL.md +62 -5
- package/skills/tanstack-query-expert/SKILL.md +5 -4
- package/skills/tauri-expert/SKILL.md +5 -4
- package/skills/typescript-expert/SKILL.md +5 -4
- package/skills/ui-ux-pro-max/SKILL.md +7 -6
- package/skills/vector-db-rag-expert/SKILL.md +209 -208
- package/skills/vercel-ai-sdk-expert/SKILL.md +226 -181
- package/skills/voice-ai-realtime-agent/SKILL.md +243 -242
- package/skills/vue-frontend-expert/SKILL.md +5 -4
- package/skills/wasm-edge-computing-expert/SKILL.md +3 -2
- package/skills/web-3d-graphics-expert/SKILL.md +314 -313
- package/skills/web-game-engine-expert/SKILL.md +330 -329
- package/skills/web-scraper/SKILL.md +158 -157
- package/skills/website-design-cloner/SKILL.md +5 -4
- package/skills/webxr-ar-vr-expert/SKILL.md +163 -162
- package/skills/wordpress-headless-expert/SKILL.md +145 -144
- package/skills/zero-tech-debt-auditor/SKILL.md +115 -0
- package/skills/zero-to-prod-orchestrator/SKILL.md +281 -229
- package/skills/zero-trust-secret-vault/SKILL.md +3 -2
- package/BLUEPRINT.md +0 -319
- package/skills/bootstrap-to-modern/SKILL.md +0 -94
- package/skills/multiple-entry-points/SKILL.md +0 -91
- package/skills/secure-fuzz-testing/SKILL.md +0 -207
- package/skills/visual-qa-vision-agent/SKILL.md +0 -71
|
@@ -1,233 +1,251 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: doku-payment-gateway
|
|
3
|
-
description: "Expert guide for integrating DOKU Payment Gateway (
|
|
1
|
+
---
|
|
2
|
+
name: doku-payment-gateway
|
|
3
|
+
description: "Expert guide for integrating DOKU Payment Gateway (SNAP BI Standard). Covers B2B Access Token, HMAC-SHA512 signature calculation, SNAP API integrations (VA, QRIS, E-Wallet, Credit Card), webhook notification verification, and sandbox/production setup / Panduan ahli integrasi DOKU Payment Gateway (Standar SNAP BI)."
|
|
4
4
|
author: "Roedy Rustam"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
- `
|
|
44
|
-
- `
|
|
45
|
-
- `
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
```text
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
```text
|
|
66
|
-
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
'
|
|
138
|
-
'
|
|
139
|
-
'
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
const
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
###
|
|
224
|
-
|
|
225
|
-
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
5
|
+
version: "4.0.0"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# DOKU Payment Gateway Integration / Integrasi Payment Gateway DOKU
|
|
9
|
+
|
|
10
|
+
[English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<a name="english"></a>
|
|
15
|
+
## English
|
|
16
|
+
|
|
17
|
+
### Orchestration & Integration
|
|
18
|
+
Connects and orchestrates with relevant domain skills like `brainstorming`, `zero-to-prod-orchestrator`, and `session-memory-manager` to ensure cohesive execution.
|
|
19
|
+
|
|
20
|
+
### Description
|
|
21
|
+
Expert guide for implementing DOKU Payment Gateway integrations based on official [DOKU Developers Documentation](https://developers.doku.com/). As of the mandate, all integrations MUST use the SNAP API v1.0 standard (Standard Nasional Open API Pembayaran) instead of the legacy Jokul API v2.
|
|
22
|
+
Covers B2B Access Token generation, SHA-256 Body hashing, HMAC-SHA512 request signature construction, Webhook notification verification, Payment implementations (Virtual Account, QRIS, E-Wallet, Credit Card), error handling, and sandbox/production deployment.
|
|
23
|
+
|
|
24
|
+
### Trigger Conditions
|
|
25
|
+
Activate this skill when the user is:
|
|
26
|
+
- Building or refactoring DOKU Payment Gateway integration in Node.js, TypeScript, Python, Go, PHP, or Java.
|
|
27
|
+
- Implementing SNAP BI B2B Access Token and HMAC-SHA512 signature calculations (`X-SIGNATURE`).
|
|
28
|
+
- Setting up DOKU SNAP APIs for Virtual Account, QRIS, E-Wallet, or Credit Card.
|
|
29
|
+
- Debugging DOKU API authorization errors (e.g., `Unauthorized`, invalid signature, incorrect timestamp format).
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
### Core Architecture & Credentials
|
|
34
|
+
|
|
35
|
+
#### Environment Gateways
|
|
36
|
+
| Environment | Base URL | Dashboard Portal | Simulator |
|
|
37
|
+
|---|---|---|---|
|
|
38
|
+
| **Sandbox** | `https://api-sandbox.doku.com` | `https://sandbox.doku.com` | `https://sandbox.doku.com/gtw-config-v2/simulator` |
|
|
39
|
+
| **Production** | `https://api.doku.com` | `https://dashboard.doku.com` | N/A |
|
|
40
|
+
|
|
41
|
+
#### Mandatory Headers (SNAP BI Standard)
|
|
42
|
+
For B2B Access Token Generation (`/api/v1.0/access-token/b2b`):
|
|
43
|
+
- `X-CLIENT-KEY`: Merchant Client ID from DOKU Back Office.
|
|
44
|
+
- `X-TIMESTAMP`: ISO8601 timestamp string (e.g., `2026-08-07T13:00:00+07:00`).
|
|
45
|
+
- `X-SIGNATURE`: RSA-SHA256 signature (Base64) - *Note: The token generation uses Asymmetric RSA, but subsequent transactional APIs use Symmetric HMAC-SHA512.*
|
|
46
|
+
|
|
47
|
+
For Transactional Endpoints (e.g., `/bi-snap-va/v1/transfer-va/create-va`):
|
|
48
|
+
- `Authorization`: Format `Bearer <B2B_ACCESS_TOKEN>`.
|
|
49
|
+
- `X-TIMESTAMP`: ISO8601 timestamp string (e.g., `2026-08-07T13:00:00+07:00`).
|
|
50
|
+
- `X-SIGNATURE`: HMAC-SHA512 signature (Base64 encoded string).
|
|
51
|
+
- `X-PARTNER-ID`: Client ID.
|
|
52
|
+
- `X-EXTERNAL-ID`: Unique string (e.g. UUID) for the request.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
### Signature Calculation Formula (SNAP Transactional API)
|
|
57
|
+
|
|
58
|
+
#### 1. Body Hash (POST / PUT / PATCH)
|
|
59
|
+
```text
|
|
60
|
+
Minified JSON Body -> SHA-256 Hash -> Hex Encode -> Lowercase
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### 2. String to Sign Component
|
|
64
|
+
The components MUST be concatenated with `:` without extra whitespace:
|
|
65
|
+
```text
|
|
66
|
+
HTTPMethod:EndpointURL:AccessToken:LowercaseHexBodyHash:Timestamp
|
|
67
|
+
```
|
|
68
|
+
*Example:* `POST:/bi-snap-va/v1/transfer-va/create-va:eyJhb...:a1b2c3d4...:2026-08-07T13:00:00+07:00`
|
|
69
|
+
|
|
70
|
+
#### 3. HMAC-SHA512 Signing
|
|
71
|
+
```text
|
|
72
|
+
String to Sign + Client Secret -> HMAC-SHA512 Hash -> Base64 Encode -> X-SIGNATURE
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
### TypeScript / Node.js Implementation Example
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
import crypto from 'crypto';
|
|
81
|
+
|
|
82
|
+
interface DokuSnapConfig {
|
|
83
|
+
clientId: string;
|
|
84
|
+
clientSecret: string;
|
|
85
|
+
isProduction: boolean;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export class DokuSnapService {
|
|
89
|
+
private clientId: string;
|
|
90
|
+
private clientSecret: string;
|
|
91
|
+
private baseUrl: string;
|
|
92
|
+
|
|
93
|
+
constructor(config: DokuSnapConfig) {
|
|
94
|
+
this.clientId = config.clientId;
|
|
95
|
+
this.clientSecret = config.clientSecret;
|
|
96
|
+
this.baseUrl = config.isProduction
|
|
97
|
+
? 'https://api.doku.com'
|
|
98
|
+
: 'https://api-sandbox.doku.com';
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
private generateBodyHash(body: object): string {
|
|
102
|
+
const minifiedBody = JSON.stringify(body);
|
|
103
|
+
return crypto.createHash('sha256').update(minifiedBody, 'utf8').digest('hex').toLowerCase();
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
public generateSignature(
|
|
107
|
+
method: string,
|
|
108
|
+
targetPath: string,
|
|
109
|
+
accessToken: string,
|
|
110
|
+
timestamp: string,
|
|
111
|
+
body?: object
|
|
112
|
+
): string {
|
|
113
|
+
let bodyHash = '';
|
|
114
|
+
if (body && ['POST', 'PUT', 'PATCH'].includes(method.toUpperCase())) {
|
|
115
|
+
bodyHash = this.generateBodyHash(body);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const stringToSign = `${method.toUpperCase()}:${targetPath}:${accessToken}:${bodyHash}:${timestamp}`;
|
|
119
|
+
|
|
120
|
+
return crypto
|
|
121
|
+
.createHmac('sha512', this.clientSecret)
|
|
122
|
+
.update(stringToSign, 'utf8')
|
|
123
|
+
.digest('base64');
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
public async createVirtualAccount(accessToken: string, payload: any) {
|
|
127
|
+
const targetPath = '/bi-snap-va/v1/transfer-va/create-va';
|
|
128
|
+
const externalId = crypto.randomUUID();
|
|
129
|
+
// Example format: 2026-09-24T19:30:00+07:00
|
|
130
|
+
const timestamp = new Date().toISOString();
|
|
131
|
+
|
|
132
|
+
const signature = this.generateSignature('POST', targetPath, accessToken, timestamp, payload);
|
|
133
|
+
|
|
134
|
+
const response = await fetch(`${this.baseUrl}${targetPath}`, {
|
|
135
|
+
method: 'POST',
|
|
136
|
+
headers: {
|
|
137
|
+
'Content-Type': 'application/json',
|
|
138
|
+
'Authorization': `Bearer ${accessToken}`,
|
|
139
|
+
'X-TIMESTAMP': timestamp,
|
|
140
|
+
'X-SIGNATURE': signature,
|
|
141
|
+
'X-PARTNER-ID': this.clientId,
|
|
142
|
+
'X-EXTERNAL-ID': externalId,
|
|
143
|
+
'CHANNEL-ID': 'SDK'
|
|
144
|
+
},
|
|
145
|
+
body: JSON.stringify(payload),
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
return await response.json();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
### Webhook / Notification Signature Verification
|
|
156
|
+
|
|
157
|
+
When DOKU sends a webhook/notification in SNAP format, you MUST verify its signature.
|
|
158
|
+
The process is identical to generating the signature: recreate the `stringToSign` using the incoming headers, the minified raw body, and your `Client Secret`, then compare the resulting HMAC-SHA512 Base64 string with the `X-SIGNATURE` header.
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
import crypto from 'crypto';
|
|
162
|
+
import { Request, Response } from 'express';
|
|
163
|
+
|
|
164
|
+
export function verifyDokuSnapWebhook(req: Request, clientSecret: string): boolean {
|
|
165
|
+
const method = req.method.toUpperCase();
|
|
166
|
+
const targetPath = req.originalUrl || req.url; // e.g., /api/webhook
|
|
167
|
+
const timestamp = req.headers['x-timestamp'] as string;
|
|
168
|
+
const receivedSignature = req.headers['x-signature'] as string;
|
|
169
|
+
// B2B token in Authorization header, remove 'Bearer '
|
|
170
|
+
const authHeader = req.headers['authorization'] as string;
|
|
171
|
+
const accessToken = authHeader ? authHeader.replace(/^Bearer\s+/i, '') : '';
|
|
172
|
+
|
|
173
|
+
// Use raw body for exact minification match
|
|
174
|
+
const rawBody = typeof req.body === 'string' ? req.body : JSON.stringify(req.body);
|
|
175
|
+
const bodyHash = crypto.createHash('sha256').update(rawBody, 'utf8').digest('hex').toLowerCase();
|
|
176
|
+
|
|
177
|
+
const stringToSign = `${method}:${targetPath}:${accessToken}:${bodyHash}:${timestamp}`;
|
|
178
|
+
|
|
179
|
+
const expectedSignature = crypto
|
|
180
|
+
.createHmac('sha512', clientSecret)
|
|
181
|
+
.update(stringToSign, 'utf8')
|
|
182
|
+
.digest('base64');
|
|
183
|
+
|
|
184
|
+
return crypto.timingSafeEqual(
|
|
185
|
+
Buffer.from(receivedSignature),
|
|
186
|
+
Buffer.from(expectedSignature)
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
### Webhook Idempotency & Race Condition Prevention
|
|
194
|
+
|
|
195
|
+
When processing DOKU webhooks, you MUST implement Idempotency and prevent Race Conditions. DOKU may retry sending the same webhook if your server takes too long to respond.
|
|
196
|
+
|
|
197
|
+
**Best Practices:**
|
|
198
|
+
1. **Raw Body Parser**: Always use a raw body parser (e.g., `express.raw({ type: 'application/json' })`) for the webhook route. `JSON.stringify(req.body)` can alter spacing/key order, causing signature validation to fail.
|
|
199
|
+
2. **Atomic Updates**: Use database-level locks or atomic updates to ensure a transaction is only processed once. Update the database record `WHERE invoice_number = 'X' AND status = 'PENDING'`. If the update affects 0 rows, the webhook was already processed.
|
|
200
|
+
3. **Return 200 OK Early**: If the signature is valid but the transaction is already processed (duplicate), immediately return `200 OK` to DOKU so they stop retrying.
|
|
201
|
+
4. **B2B Token Caching**: Generating the B2B Access Token requires an RSA signature and network request. Cache this token (e.g., in Redis or Memory) until its expiry to reduce latency on transactional endpoints.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
### Common Pitfalls to Avoid
|
|
206
|
+
|
|
207
|
+
| Anti-Pattern | Issue | Solution |
|
|
208
|
+
|---|---|---|
|
|
209
|
+
| Non-minified JSON body | Signature validation fails (`Invalid Signature`) | Always stringify JSON without extra spaces before hashing. For webhooks, use the raw unparsed request body. |
|
|
210
|
+
| Using HMAC-SHA256 | Signature validation fails | SNAP BI transactional signature uses **HMAC-SHA512** (Note: B2B Access Token uses RSA-SHA256). |
|
|
211
|
+
| Capitalized Hex Hash | Signature mismatch | Ensure the SHA-256 body hash hex string is converted to lowercase before appending to `stringToSign`. |
|
|
212
|
+
| Missing `Bearer` in Authorization | Unauthorized error | The `Authorization` header must include `Bearer <Token>`, but the `stringToSign` component must **only** be the token. |
|
|
213
|
+
| Processing webhook twice | Double balance top-up (Race Condition) | Use Atomic Updates (`UPDATE ... WHERE status = 'PENDING'`) and return 200 OK for duplicates. |
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
<a name="bahasa-indonesia"></a>
|
|
218
|
+
## Bahasa Indonesia
|
|
219
|
+
|
|
220
|
+
### Integrasi Orkestrasi
|
|
221
|
+
Terhubung dan mengorkestrasi skill domain yang relevan seperti `brainstorming`, `zero-to-prod-orchestrator`, dan `session-memory-manager` untuk memastikan eksekusi yang kohesif.
|
|
222
|
+
|
|
223
|
+
### Deskripsi
|
|
224
|
+
Panduan ahli untuk mengintegrasikan DOKU Payment Gateway dengan standar dokumentasi resmi [DOKU Developers Portal](https://developers.doku.com/). Berdasarkan mandat, seluruh integrasi WAJIB menggunakan standar SNAP API v1.0 (Standard Nasional Open API Pembayaran) sebagai pengganti Jokul API v2.
|
|
225
|
+
Mencakup pembuatan B2B Access Token, Hash Body SHA-256, pembuatan Signature HMAC-SHA512, verifikasi Webhook/Notifikasi, dan implementasi API (Virtual Account, QRIS, E-Wallet, Kartu Kredit).
|
|
226
|
+
|
|
227
|
+
### Kondisi Pemicu
|
|
228
|
+
Aktifkan skill ini ketika pengguna sedang:
|
|
229
|
+
- Membangun atau merefaktor integrasi DOKU Payment Gateway di Node.js, TypeScript, Python, Go, PHP, atau Java.
|
|
230
|
+
- Mengimplementasikan kalkulasi signature HMAC-SHA512 (`X-SIGNATURE`) standar SNAP BI.
|
|
231
|
+
- Mengatur API SNAP untuk Virtual Account, QRIS, E-Wallet, atau Kartu Kredit.
|
|
232
|
+
- Melakukan debugging error otorisasi DOKU API (`Invalid Signature`, token kedaluwarsa).
|
|
233
|
+
|
|
234
|
+
### Ringkasan Langkah Integrasi (SNAP BI)
|
|
235
|
+
1. **Dapatkan Kredensial**: Ambil `Client-Id` dan `Secret-Key` dari DOKU Sandbox.
|
|
236
|
+
2. **Generate B2B Access Token**: Hitung signature Asimetrik RSA-SHA256 dan panggil `/api/v1.0/access-token/b2b`.
|
|
237
|
+
3. **Hitung Body Hash**: Untuk request transaksional `POST`, minify body JSON lalu hash menggunakan SHA-256, ubah ke Hex, dan format ke huruf kecil (lowercase).
|
|
238
|
+
4. **Format String to Sign**: Gabungkan `HTTPMethod`, `EndpointURL`, `AccessToken`, `BodyHash`, dan `Timestamp` dipisahkan dengan titik dua `:`.
|
|
239
|
+
5. **Sign HMAC-SHA512**: Hash string komponen menggunakan `Secret-Key` dengan algoritma HMAC-SHA512, ubah ke Base64, jadikan header `X-SIGNATURE`.
|
|
240
|
+
|
|
241
|
+
### Integrasi dengan Skill Lain
|
|
242
|
+
- `payment-gateway-expert` — Untuk arsitektur billing SaaS umum dan state machine langganan.
|
|
243
|
+
- `doku-mcp-server` — Untuk mengintegrasikan API DOKU ke Model Context Protocol AI Agent.
|
|
244
|
+
- `database-orm-expert` — Untuk menyimpan transaksi pembayaran dan log webhook secara type-safe.
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
### 🚨 SNAP Integration Mandate (CRITICAL)
|
|
248
|
+
**MANDATORY**: The AI Agent MUST automatically apply the SNAP API v1.0 standard (Standard Nasional Open API Pembayaran) for all DOKU integrations, instead of the legacy Jokul API v2, unless the user explicitly requests otherwise. All generated signatures, headers, and endpoints MUST follow the SNAP BI standard.
|
|
249
|
+
|
|
250
|
+
### 🧪 DOKU Sandbox Simulator
|
|
251
|
+
**MANDATORY**: When testing in Sandbox mode and needing to access the Payment Simulator, the AI Agent MUST use this exact URL: `https://sandbox.doku.com/gtw-config-v2/simulator`.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: domain-driven-design-expert
|
|
3
3
|
description: "Expert guide for Domain-Driven Design (DDD). Covers tactical patterns (Aggregates, Value Objects), strategic patterns (Bounded Contexts), event storming, and CQRS / Panduan ahli Desain Berbasis Domain (DDD)."
|
|
4
|
-
author: "Roedy Rustam"
|
|
4
|
+
author: "Roedy Rustam"
|
|
5
|
+
version: "3.0.0"
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
# Domain-Driven Design (DDD) Expert
|
|
@@ -79,4 +80,4 @@ Pisahkan model data untuk operasi *Write* (Command) dan *Read* (Query). Model ba
|
|
|
79
80
|
## Integrasi Orkestrasi
|
|
80
81
|
- Mengembangkan `scalability-clean-code` dengan pola isolasi domain yang ketat.
|
|
81
82
|
- Sangat penting bagi `event-driven-architect` untuk menentukan struktur event di message broker.
|
|
82
|
-
- Membantu `micro-frontend-architect` menyelaraskan batas-batas frontend dengan Bounded Contexts backend.
|
|
83
|
+
- Membantu `micro-frontend-architect` menyelaraskan batas-batas frontend dengan Bounded Contexts backend.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: e2e-testing-expert
|
|
3
3
|
description: "Expert guide for End-to-End (E2E) testing with Playwright, unit/integration testing with Vitest, and CI/CD automated testing pipeline setup / Panduan ahli pengujian End-to-End (E2E) dengan Playwright, pengujian unit/integrasi dengan Vitest, dan otomatisasi CI/CD."
|
|
4
|
-
author: "Roedy Rustam"
|
|
4
|
+
author: "Roedy Rustam"
|
|
5
|
+
version: "3.0.0"
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
# E2E Testing Expert (Playwright 1.49+ / Vitest 3 Edition)
|
|
@@ -14,7 +15,7 @@ author: "Roedy Rustam"
|
|
|
14
15
|
## English
|
|
15
16
|
|
|
16
17
|
### Orchestration & Integration
|
|
17
|
-
Connects and orchestrates with relevant domain skills like `brainstorming`, `zero-to-prod-orchestrator`, and `
|
|
18
|
+
Connects and orchestrates with relevant domain skills like `brainstorming`, `zero-to-prod-orchestrator`, and `session-memory-manager` to ensure cohesive execution.
|
|
18
19
|
|
|
19
20
|
### Description
|
|
20
21
|
Expert guide for building comprehensive automated test suites using **Playwright 1.49+** (E2E + component testing), **Vitest 3** (unit/integration), and robust CI/CD pipelines. Covers modern testing patterns for Next.js 15, React 19, and API backends.
|
|
@@ -283,7 +284,7 @@ jobs:
|
|
|
283
284
|
## Bahasa Indonesia
|
|
284
285
|
|
|
285
286
|
### Integrasi Orkestrasi
|
|
286
|
-
Terhubung dan mengorkestrasi skill domain yang relevan seperti `brainstorming`, `zero-to-prod-orchestrator`, dan `
|
|
287
|
+
Terhubung dan mengorkestrasi skill domain yang relevan seperti `brainstorming`, `zero-to-prod-orchestrator`, dan `session-memory-manager` untuk memastikan eksekusi yang kohesif.
|
|
287
288
|
|
|
288
289
|
### Deskripsi
|
|
289
290
|
Panduan ahli untuk membangun test suite otomatis yang komprehensif menggunakan **Playwright 1.49+** (E2E + component testing), **Vitest 3** (unit/integrasi), dan pipeline CI/CD yang kuat. Mencakup pola pengujian modern untuk Next.js 15, React 19, dan backend API.
|
|
@@ -318,4 +319,4 @@ Gunakan `storageState` untuk menyimpan state sesi setelah login sekali dan mengg
|
|
|
318
319
|
Vitest 3 adalah test runner yang cepat berbasis Vite dengan kompatibilitas Jest penuh. Gunakan untuk unit test React component, server action, dan logika bisnis.
|
|
319
320
|
|
|
320
321
|
### Pipeline CI GitHub Actions
|
|
321
|
-
Pisahkan job `unit` dan `e2e` untuk feedback paralel yang lebih cepat. Upload `playwright-report` sebagai artifact saat gagal untuk debugging.
|
|
322
|
+
Pisahkan job `unit` dan `e2e` untuk feedback paralel yang lebih cepat. Upload `playwright-report` sebagai artifact saat gagal untuk debugging.
|