ima-claude 2.20.0 → 2.26.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/README.md +74 -9
- package/dist/cli.js +2 -1
- package/package.json +1 -1
- package/plugins/ima-claude/.claude-plugin/plugin.json +2 -2
- package/plugins/ima-claude/agents/explorer.md +29 -15
- package/plugins/ima-claude/agents/implementer.md +58 -13
- package/plugins/ima-claude/agents/memory.md +19 -19
- package/plugins/ima-claude/agents/reviewer.md +84 -34
- package/plugins/ima-claude/agents/tester.md +59 -16
- package/plugins/ima-claude/agents/wp-developer.md +66 -21
- package/plugins/ima-claude/hooks/bootstrap.sh +42 -44
- package/plugins/ima-claude/hooks/prompt_coach_digest.md +14 -17
- package/plugins/ima-claude/hooks/prompt_coach_system.md +10 -12
- package/plugins/ima-claude/personalities/README.md +17 -6
- package/plugins/ima-claude/personalities/enable-efficient.md +61 -0
- package/plugins/ima-claude/personalities/enable-terse.md +71 -0
- package/plugins/ima-claude/skills/agentic-workflows/SKILL.md +35 -71
- package/plugins/ima-claude/skills/architect/SKILL.md +54 -168
- package/plugins/ima-claude/skills/compound-bridge/SKILL.md +41 -94
- package/plugins/ima-claude/skills/design-to-code/SKILL.md +43 -78
- package/plugins/ima-claude/skills/discourse/SKILL.md +79 -194
- package/plugins/ima-claude/skills/discourse-admin/SKILL.md +41 -103
- package/plugins/ima-claude/skills/docs-organize/SKILL.md +63 -203
- package/plugins/ima-claude/skills/ember-discourse/SKILL.md +90 -200
- package/plugins/ima-claude/skills/espocrm/SKILL.md +14 -23
- package/plugins/ima-claude/skills/espocrm-api/SKILL.md +79 -192
- package/plugins/ima-claude/skills/functional-programmer/SKILL.md +33 -237
- package/plugins/ima-claude/skills/gh-cli/SKILL.md +26 -65
- package/plugins/ima-claude/skills/ima-bootstrap/SKILL.md +71 -104
- package/plugins/ima-claude/skills/ima-bootstrap/references/ima-brand.md +32 -22
- package/plugins/ima-claude/skills/ima-brand/SKILL.md +18 -23
- package/plugins/ima-claude/skills/ima-copywriting/SKILL.md +68 -179
- package/plugins/ima-claude/skills/ima-doc2pdf/SKILL.md +32 -102
- package/plugins/ima-claude/skills/ima-editorial-scorecard/SKILL.md +38 -63
- package/plugins/ima-claude/skills/ima-editorial-workflow/SKILL.md +69 -114
- package/plugins/ima-claude/skills/ima-email-creator/SKILL.md +16 -22
- package/plugins/ima-claude/skills/ima-forms-expert/SKILL.md +21 -37
- package/plugins/ima-claude/skills/ima-git/SKILL.md +81 -0
- package/plugins/ima-claude/skills/jira-checkpoint/SKILL.md +39 -120
- package/plugins/ima-claude/skills/jquery/SKILL.md +107 -233
- package/plugins/ima-claude/skills/js-fp/SKILL.md +75 -296
- package/plugins/ima-claude/skills/js-fp-api/SKILL.md +52 -162
- package/plugins/ima-claude/skills/js-fp-react/SKILL.md +47 -270
- package/plugins/ima-claude/skills/js-fp-vue/SKILL.md +55 -209
- package/plugins/ima-claude/skills/js-fp-wordpress/SKILL.md +59 -204
- package/plugins/ima-claude/skills/livecanvas/SKILL.md +19 -32
- package/plugins/ima-claude/skills/mcp-atlassian/SKILL.md +92 -162
- package/plugins/ima-claude/skills/mcp-context7/SKILL.md +32 -64
- package/plugins/ima-claude/skills/mcp-gitea/SKILL.md +98 -188
- package/plugins/ima-claude/skills/mcp-github/SKILL.md +60 -124
- package/plugins/ima-claude/skills/mcp-memory/SKILL.md +1 -177
- package/plugins/ima-claude/skills/mcp-qdrant/SKILL.md +58 -115
- package/plugins/ima-claude/skills/mcp-sequential/SKILL.md +32 -87
- package/plugins/ima-claude/skills/mcp-serena/SKILL.md +54 -80
- package/plugins/ima-claude/skills/mcp-tavily/SKILL.md +40 -63
- package/plugins/ima-claude/skills/mcp-vestige/SKILL.md +75 -116
- package/plugins/ima-claude/skills/php-authnet/SKILL.md +32 -65
- package/plugins/ima-claude/skills/php-fp/SKILL.md +50 -129
- package/plugins/ima-claude/skills/php-fp-wordpress/SKILL.md +25 -73
- package/plugins/ima-claude/skills/phpunit-wp/SKILL.md +103 -463
- package/plugins/ima-claude/skills/playwright/SKILL.md +69 -220
- package/plugins/ima-claude/skills/prompt-starter/SKILL.md +33 -83
- package/plugins/ima-claude/skills/prompt-starter/references/code-review.md +38 -0
- package/plugins/ima-claude/skills/py-fp/SKILL.md +78 -384
- package/plugins/ima-claude/skills/quasar-fp/SKILL.md +54 -255
- package/plugins/ima-claude/skills/quickstart/SKILL.md +7 -11
- package/plugins/ima-claude/skills/rails/SKILL.md +63 -184
- package/plugins/ima-claude/skills/resume-session/SKILL.md +14 -35
- package/plugins/ima-claude/skills/rg/SKILL.md +61 -146
- package/plugins/ima-claude/skills/ruby-fp/SKILL.md +66 -163
- package/plugins/ima-claude/skills/save-session/SKILL.md +10 -39
- package/plugins/ima-claude/skills/scorecard/SKILL.md +42 -40
- package/plugins/ima-claude/skills/skill-analyzer/SKILL.md +42 -71
- package/plugins/ima-claude/skills/skill-creator/SKILL.md +79 -250
- package/plugins/ima-claude/skills/task-master/SKILL.md +11 -31
- package/plugins/ima-claude/skills/task-planner/SKILL.md +44 -153
- package/plugins/ima-claude/skills/task-runner/SKILL.md +61 -143
- package/plugins/ima-claude/skills/unit-testing/SKILL.md +59 -134
- package/plugins/ima-claude/skills/wp-ddev/SKILL.md +38 -120
- package/plugins/ima-claude/skills/wp-local/SKILL.md +26 -108
|
@@ -5,19 +5,19 @@ description: "Cognitive memory engine with semantic search, spaced repetition, a
|
|
|
5
5
|
|
|
6
6
|
# Vestige MCP - Cognitive Memory Engine
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Rust-based cognitive memory system with FSRS-6 spaced repetition, semantic search, prediction error gating, and codebase awareness. Replaces Memory MCP.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## 3-Tier Memory Architecture
|
|
11
11
|
|
|
12
|
-
| System | Role | Lifecycle |
|
|
13
|
-
|
|
14
|
-
| **Vestige** | Neural memory — decisions, preferences, patterns, bugs
|
|
15
|
-
| **Qdrant** | Permanent library —
|
|
16
|
-
| **Serena Memory** | Project workbench — session state, task progress | Project-scoped
|
|
12
|
+
| System | Role | Lifecycle |
|
|
13
|
+
|--------|------|-----------|
|
|
14
|
+
| **Vestige** | Neural memory — decisions, preferences, patterns, bugs | Fades if unused (FSRS-6 decay) |
|
|
15
|
+
| **Qdrant** | Permanent library — standards, PRDs, architecture docs | Persistent forever |
|
|
16
|
+
| **Serena Memory** | Project workbench — session state, task progress | Project-scoped |
|
|
17
17
|
|
|
18
18
|
## Session Start Protocol (REQUIRED)
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Run BEFORE asking questions:
|
|
21
21
|
|
|
22
22
|
```
|
|
23
23
|
mcp__vestige__search query: "{project-name}" limit: 5
|
|
@@ -25,14 +25,11 @@ mcp__vestige__search query: "user-eric preferences" limit: 5
|
|
|
25
25
|
mcp__vestige__intention action: "check"
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
If
|
|
29
|
-
```
|
|
30
|
-
mcp__serena__list_memories
|
|
31
|
-
```
|
|
28
|
+
If Serena-activated project, also run `mcp__serena__list_memories`.
|
|
32
29
|
|
|
33
30
|
## Core Tools
|
|
34
31
|
|
|
35
|
-
###
|
|
32
|
+
### search
|
|
36
33
|
|
|
37
34
|
```
|
|
38
35
|
mcp__vestige__search
|
|
@@ -40,9 +37,9 @@ mcp__vestige__search
|
|
|
40
37
|
limit: 5
|
|
41
38
|
```
|
|
42
39
|
|
|
43
|
-
Hybrid
|
|
40
|
+
Hybrid keyword + semantic + RRF fusion. Your most-used tool.
|
|
44
41
|
|
|
45
|
-
###
|
|
42
|
+
### smart_ingest
|
|
46
43
|
|
|
47
44
|
```
|
|
48
45
|
mcp__vestige__smart_ingest
|
|
@@ -50,17 +47,17 @@ mcp__vestige__smart_ingest
|
|
|
50
47
|
node_type: "decision"
|
|
51
48
|
```
|
|
52
49
|
|
|
53
|
-
|
|
50
|
+
Auto-handles CREATE/UPDATE/SUPERSEDE:
|
|
54
51
|
|
|
55
|
-
| Similarity | Action |
|
|
56
|
-
|
|
57
|
-
| >92% | REINFORCE
|
|
58
|
-
| 75-92% | UPDATE
|
|
59
|
-
| <75% | CREATE
|
|
52
|
+
| Similarity | Action |
|
|
53
|
+
|------------|--------|
|
|
54
|
+
| >92% | REINFORCE — strengthen existing |
|
|
55
|
+
| 75-92% | UPDATE — merge into existing |
|
|
56
|
+
| <75% | CREATE — new memory |
|
|
60
57
|
|
|
61
|
-
|
|
58
|
+
Prefer `smart_ingest` over `ingest` — prevents duplicates.
|
|
62
59
|
|
|
63
|
-
###
|
|
60
|
+
### ingest
|
|
64
61
|
|
|
65
62
|
```
|
|
66
63
|
mcp__vestige__ingest
|
|
@@ -68,9 +65,9 @@ mcp__vestige__ingest
|
|
|
68
65
|
node_type: "preference"
|
|
69
66
|
```
|
|
70
67
|
|
|
71
|
-
Bypasses dedup
|
|
68
|
+
Bypasses dedup. Use only when forcing a new entry.
|
|
72
69
|
|
|
73
|
-
###
|
|
70
|
+
### memory
|
|
74
71
|
|
|
75
72
|
```
|
|
76
73
|
mcp__vestige__memory
|
|
@@ -80,7 +77,7 @@ mcp__vestige__memory
|
|
|
80
77
|
|
|
81
78
|
Actions: `get`, `remove`, `check_state`
|
|
82
79
|
|
|
83
|
-
|
|
80
|
+
### codebase
|
|
84
81
|
|
|
85
82
|
```
|
|
86
83
|
mcp__vestige__codebase
|
|
@@ -88,20 +85,18 @@ mcp__vestige__codebase
|
|
|
88
85
|
pattern_type: "architecture"
|
|
89
86
|
```
|
|
90
87
|
|
|
91
|
-
|
|
88
|
+
Pattern types: `architecture`, `pattern`, `convention`, `dependency`
|
|
92
89
|
|
|
93
|
-
|
|
90
|
+
### Feedback
|
|
94
91
|
|
|
95
92
|
```
|
|
96
93
|
mcp__vestige__promote_memory id: "{memory-id}"
|
|
97
94
|
mcp__vestige__demote_memory id: "{memory-id}"
|
|
98
95
|
```
|
|
99
96
|
|
|
100
|
-
|
|
101
|
-
- **Promote**: Memory proved useful, user referenced it, decision confirmed
|
|
102
|
-
- **Demote**: Memory outdated, user contradicted it, no longer relevant
|
|
97
|
+
Promote when memory proved useful. Demote when outdated or contradicted.
|
|
103
98
|
|
|
104
|
-
|
|
99
|
+
### intention
|
|
105
100
|
|
|
106
101
|
```
|
|
107
102
|
mcp__vestige__intention
|
|
@@ -112,66 +107,48 @@ mcp__vestige__intention
|
|
|
112
107
|
|
|
113
108
|
Actions: `set`, `check`, `complete`, `cancel`
|
|
114
109
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
## Session & Maintenance Tools
|
|
110
|
+
## Maintenance Tools
|
|
118
111
|
|
|
119
112
|
| Tool | Purpose |
|
|
120
113
|
|------|---------|
|
|
121
|
-
| `session_checkpoint` | Batch-save
|
|
114
|
+
| `session_checkpoint` | Batch-save entire session |
|
|
122
115
|
| `find_duplicates` | Detect and merge redundant memories |
|
|
123
116
|
| `consolidate` | Run FSRS-6 decay and maintenance |
|
|
124
|
-
| `
|
|
125
|
-
| `
|
|
126
|
-
| `health_check` | System health with warnings |
|
|
117
|
+
| `memory_timeline` | Browse chronologically |
|
|
118
|
+
| `health_check` | System health warnings |
|
|
127
119
|
|
|
128
|
-
## Proactive Behavior
|
|
120
|
+
## Proactive Behavior (MUST, not suggestions)
|
|
129
121
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
### 1. Session Start: Search for Context
|
|
133
|
-
When beginning work on any project, **automatically search** for relevant context:
|
|
134
|
-
```
|
|
135
|
-
mcp__vestige__search query: "{project-name}"
|
|
136
|
-
mcp__vestige__search query: "user-eric"
|
|
137
|
-
mcp__vestige__intention action: "check"
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
### 2. During Work: Store Decisions As They Happen
|
|
141
|
-
When ANY of these occur, **immediately store without being asked**:
|
|
122
|
+
### Store immediately — no prompting needed
|
|
142
123
|
|
|
143
124
|
| Event | Action |
|
|
144
125
|
|-------|--------|
|
|
145
|
-
| User states
|
|
146
|
-
| Architectural decision
|
|
147
|
-
| Bug root cause identified | `smart_ingest`
|
|
148
|
-
| Pattern chosen over alternatives | `smart_ingest`
|
|
149
|
-
| User corrects your approach | `smart_ingest`
|
|
126
|
+
| User states preference | `smart_ingest` node_type: "preference" |
|
|
127
|
+
| Architectural decision | `smart_ingest` node_type: "decision" |
|
|
128
|
+
| Bug root cause identified | `smart_ingest` node_type: "bug" |
|
|
129
|
+
| Pattern chosen over alternatives | `smart_ingest` node_type: "pattern" |
|
|
130
|
+
| User corrects your approach | `smart_ingest` node_type: "preference" |
|
|
150
131
|
| Codebase pattern discovered | `codebase` with appropriate pattern_type |
|
|
151
|
-
| `/workflows:compound` creates solution | `smart_ingest` with node_type: "pattern" (root cause + insight) |
|
|
152
|
-
| `/workflows:plan` research completes | `smart_ingest` with node_type: "decision" (approach chosen) |
|
|
153
|
-
| `/workflows:review` finds P1/P2 | `smart_ingest` with node_type: "pattern" (finding summary) |
|
|
154
132
|
|
|
155
|
-
|
|
156
|
-
- "I prefer..." / "I
|
|
133
|
+
Recognition phrases — store when you hear:
|
|
134
|
+
- "I prefer..." / "I always..." / "I never..."
|
|
157
135
|
- "Let's go with X because..." / "We chose X over Y"
|
|
158
|
-
- "The reason this failed was..."
|
|
159
|
-
- "From now on..." / "
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
Before ending significant sessions:
|
|
164
|
-
- What decisions were made that should persist?
|
|
165
|
-
- What did you learn about the user's preferences?
|
|
166
|
-
- Set any intentions for future work?
|
|
167
|
-
|
|
168
|
-
### 4. Before Asking Questions You Might Already Know
|
|
169
|
-
Before asking "What framework do you use?" or "How do you prefer X?", **search first**:
|
|
136
|
+
- "Root cause:" / "The reason this failed was..."
|
|
137
|
+
- "From now on..." / "That's not how we do it"
|
|
138
|
+
|
|
139
|
+
### Before asking questions, search first
|
|
140
|
+
|
|
170
141
|
```
|
|
171
142
|
mcp__vestige__search query: "preference {topic}"
|
|
172
143
|
```
|
|
173
144
|
|
|
174
|
-
|
|
145
|
+
### Session end — capture before closing
|
|
146
|
+
|
|
147
|
+
- What decisions persist?
|
|
148
|
+
- What preferences were revealed?
|
|
149
|
+
- Set intentions for next session?
|
|
150
|
+
|
|
151
|
+
## Node Types
|
|
175
152
|
|
|
176
153
|
| Type | Use For |
|
|
177
154
|
|------|---------|
|
|
@@ -185,75 +162,57 @@ mcp__vestige__search query: "preference {topic}"
|
|
|
185
162
|
|
|
186
163
|
## Memory States
|
|
187
164
|
|
|
188
|
-
Vestige manages memory lifecycle automatically via FSRS-6:
|
|
189
|
-
|
|
190
165
|
| State | Meaning |
|
|
191
166
|
|-------|---------|
|
|
192
|
-
|
|
|
193
|
-
|
|
|
194
|
-
|
|
|
195
|
-
|
|
|
196
|
-
|
|
197
|
-
Memories that are searched for get reinforced. Unused memories naturally decay. This prevents knowledge bloat without manual cleanup.
|
|
167
|
+
| Active | Readily accessible |
|
|
168
|
+
| Dormant | Weakly retrievable — promote if still relevant |
|
|
169
|
+
| Silent | Deeply encoded, temporarily inaccessible |
|
|
170
|
+
| Unavailable | Decayed or removed |
|
|
198
171
|
|
|
199
172
|
## Decision Logic
|
|
200
173
|
|
|
201
|
-
**Will it fade if we stop referencing it? That determines where it goes.**
|
|
202
|
-
|
|
203
174
|
```
|
|
204
|
-
IF knowledge that
|
|
205
|
-
(preferences, decisions, patterns, bugs
|
|
206
|
-
→ Vestige smart_ingest
|
|
207
|
-
ELSE IF reference material that
|
|
208
|
-
(
|
|
209
|
-
→ Qdrant qdrant-store
|
|
175
|
+
IF knowledge that strengthens with use, fades if unused
|
|
176
|
+
(preferences, decisions, patterns, bugs):
|
|
177
|
+
→ Vestige smart_ingest
|
|
178
|
+
ELSE IF reference material that must never be forgotten
|
|
179
|
+
(standards, PRDs, architecture docs):
|
|
180
|
+
→ Qdrant qdrant-store
|
|
210
181
|
ELSE IF session state or project progress:
|
|
211
|
-
→ Serena write_memory
|
|
212
|
-
ELSE IF future reminder
|
|
182
|
+
→ Serena write_memory
|
|
183
|
+
ELSE IF future reminder:
|
|
213
184
|
→ Vestige intention
|
|
214
185
|
ELSE IF codebase architecture pattern:
|
|
215
186
|
→ Vestige codebase
|
|
216
187
|
ELSE IF searching for prior context:
|
|
217
|
-
→ Vestige search
|
|
188
|
+
→ Vestige search
|
|
218
189
|
```
|
|
219
190
|
|
|
220
191
|
## What NOT to Store
|
|
221
192
|
|
|
222
|
-
- Temporary debugging steps (use Serena session state
|
|
193
|
+
- Temporary debugging steps (use Serena session state)
|
|
223
194
|
- One-off fixes unlikely to recur
|
|
224
|
-
-
|
|
225
|
-
-
|
|
226
|
-
- Session progress (use Serena
|
|
195
|
+
- Info already in CLAUDE.md or README
|
|
196
|
+
- Credentials, API keys
|
|
197
|
+
- Session progress (use Serena)
|
|
227
198
|
|
|
228
199
|
## Migration from Memory MCP
|
|
229
200
|
|
|
230
|
-
Vestige replaces Memory MCP. The mapping:
|
|
231
|
-
|
|
232
201
|
| Memory MCP | Vestige Equivalent |
|
|
233
202
|
|------------|-------------------|
|
|
234
|
-
| `search_nodes` | `search`
|
|
203
|
+
| `search_nodes` | `search` |
|
|
235
204
|
| `open_nodes` | `search` with specific name |
|
|
236
|
-
| `create_entities` | `smart_ingest`
|
|
237
|
-
| `add_observations` | `smart_ingest`
|
|
238
|
-
| `create_relations` | Not needed
|
|
205
|
+
| `create_entities` | `smart_ingest` |
|
|
206
|
+
| `add_observations` | `smart_ingest` |
|
|
207
|
+
| `create_relations` | Not needed (spreading activation via semantic similarity) |
|
|
239
208
|
| `read_graph` | `memory_timeline` or `search` |
|
|
240
|
-
| `delete_*` | `memory`
|
|
209
|
+
| `delete_*` | `memory` action: "remove" or `demote_memory` |
|
|
241
210
|
|
|
242
211
|
## Setup
|
|
243
212
|
|
|
244
|
-
Install Vestige MCP:
|
|
245
|
-
|
|
246
213
|
```bash
|
|
247
|
-
# Via cargo (Rust required)
|
|
248
214
|
cargo install vestige-mcp
|
|
249
|
-
|
|
250
|
-
# Or download binary from releases
|
|
251
|
-
# https://github.com/samvallad33/vestige/releases
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
Configure in Claude Code:
|
|
255
|
-
```bash
|
|
256
215
|
claude mcp add --scope user vestige -- vestige-mcp
|
|
257
216
|
```
|
|
258
217
|
|
|
259
|
-
|
|
218
|
+
Config: `~/.config/vestige/` (global) or `.vestige/` (per-project).
|
|
@@ -5,14 +5,12 @@ description: "Authorize.Net PHP SDK patterns for payment processing, CIM profile
|
|
|
5
5
|
|
|
6
6
|
# Authorize.Net PHP SDK
|
|
7
7
|
|
|
8
|
-
Patterns
|
|
8
|
+
Patterns for `authorizenet/authorizenet` PHP SDK (^2.0). PHP-only.
|
|
9
9
|
|
|
10
|
-
**Companion skills**: `php-fp
|
|
10
|
+
**Companion skills**: `php-fp`, `php-fp-wordpress`
|
|
11
11
|
|
|
12
12
|
## Architecture: Three-Layer FP Pattern
|
|
13
13
|
|
|
14
|
-
Authorize.Net integration follows a strict three-layer separation:
|
|
15
|
-
|
|
16
14
|
```
|
|
17
15
|
[Pure Builders] → [SDK Adapter (Impure)] → [Pure Parsers]
|
|
18
16
|
plain arrays SDK objects + I/O result arrays
|
|
@@ -20,7 +18,7 @@ Authorize.Net integration follows a strict three-layer separation:
|
|
|
20
18
|
|
|
21
19
|
### Layer 1: Pure Request Builders
|
|
22
20
|
|
|
23
|
-
Normalize input
|
|
21
|
+
Normalize input to plain arrays. No SDK imports, no `date()`, no side effects.
|
|
24
22
|
|
|
25
23
|
```php
|
|
26
24
|
<?php declare(strict_types=1);
|
|
@@ -37,7 +35,7 @@ function build_charge_request(array $payment_data): array {
|
|
|
37
35
|
|
|
38
36
|
### Layer 2: SDK Adapter (Impure)
|
|
39
37
|
|
|
40
|
-
All `use net\authorize\api\...` imports confined here. Builds SDK objects, executes requests, normalizes responses to plain arrays. Never throws — catches exceptions
|
|
38
|
+
All `use net\authorize\api\...` imports confined here. Builds SDK objects, executes requests, normalizes responses to plain arrays. Never throws — catches exceptions, returns error arrays.
|
|
41
39
|
|
|
42
40
|
```php
|
|
43
41
|
<?php declare(strict_types=1);
|
|
@@ -57,8 +55,6 @@ function sdk_charge_customer(array $payment_data, array $credentials): array {
|
|
|
57
55
|
$merchant_auth->setName($credentials['api_login_id']);
|
|
58
56
|
$merchant_auth->setTransactionKey($credentials['transaction_key']);
|
|
59
57
|
|
|
60
|
-
// ... build SDK objects from plain array ...
|
|
61
|
-
|
|
62
58
|
$controller = new AnetController\CreateTransactionController($request);
|
|
63
59
|
$response = $controller->executeWithApiResponse($credentials['api_url']);
|
|
64
60
|
|
|
@@ -67,7 +63,6 @@ function sdk_charge_customer(array $payment_data, array $credentials): array {
|
|
|
67
63
|
return [
|
|
68
64
|
'result_code' => $response->getMessages()->getResultCode(),
|
|
69
65
|
'transaction_id' => $response->getTransactionResponse()?->getTransId(),
|
|
70
|
-
// ... normalize all fields to plain values ...
|
|
71
66
|
];
|
|
72
67
|
} catch (\Exception $e) {
|
|
73
68
|
return array_merge($null_response, [
|
|
@@ -80,7 +75,7 @@ function sdk_charge_customer(array $payment_data, array $credentials): array {
|
|
|
80
75
|
|
|
81
76
|
### Layer 3: Pure Response Parsers
|
|
82
77
|
|
|
83
|
-
Interpret normalized arrays into
|
|
78
|
+
Interpret normalized arrays into `['success' => bool, ...]` results. No SDK dependencies.
|
|
84
79
|
|
|
85
80
|
```php
|
|
86
81
|
<?php declare(strict_types=1);
|
|
@@ -96,23 +91,22 @@ function parse_charge_response(array $response): array {
|
|
|
96
91
|
}
|
|
97
92
|
```
|
|
98
93
|
|
|
99
|
-
###
|
|
94
|
+
### Orchestrator
|
|
100
95
|
|
|
101
|
-
Thin glue
|
|
96
|
+
Thin glue — no business logic:
|
|
102
97
|
|
|
103
98
|
```php
|
|
104
99
|
function charge_customer_via_sdk(array $payment_data, array $credentials): array {
|
|
105
|
-
|
|
106
|
-
return parse_charge_response($normalized);
|
|
100
|
+
return parse_charge_response(sdk_charge_customer($payment_data, $credentials));
|
|
107
101
|
}
|
|
108
102
|
```
|
|
109
103
|
|
|
110
104
|
## SDK Namespace Reference
|
|
111
105
|
|
|
112
106
|
```php
|
|
113
|
-
use net\authorize\api\contract\v1 as AnetAPI;
|
|
114
|
-
use net\authorize\api\controller as AnetController;
|
|
115
|
-
use net\authorize\api\constants\ANetEnvironment;
|
|
107
|
+
use net\authorize\api\contract\v1 as AnetAPI; // Data types (request/response objects)
|
|
108
|
+
use net\authorize\api\controller as AnetController; // Controllers (execute requests)
|
|
109
|
+
use net\authorize\api\constants\ANetEnvironment; // SANDBOX / PRODUCTION URLs
|
|
116
110
|
```
|
|
117
111
|
|
|
118
112
|
## Authentication
|
|
@@ -123,22 +117,19 @@ $merchant_auth->setName($credentials['api_login_id']);
|
|
|
123
117
|
$merchant_auth->setTransactionKey($credentials['transaction_key']);
|
|
124
118
|
```
|
|
125
119
|
|
|
126
|
-
**Credential storage**:
|
|
120
|
+
**Credential storage**: `wp-config.php` constants first, options table as fallback.
|
|
127
121
|
|
|
128
122
|
```php
|
|
129
|
-
// Constants-first pattern
|
|
130
123
|
$api_login = defined('IMA_PAYMENTS_API_LOGIN_ID')
|
|
131
124
|
? IMA_PAYMENTS_API_LOGIN_ID
|
|
132
125
|
: get_option('ima_payments_api_login_id', '');
|
|
133
126
|
```
|
|
134
127
|
|
|
135
|
-
**Environment
|
|
128
|
+
**Environment**:
|
|
136
129
|
|
|
137
130
|
```php
|
|
138
|
-
// Sandbox
|
|
139
|
-
$controller->executeWithApiResponse(ANetEnvironment::
|
|
140
|
-
// Production
|
|
141
|
-
$controller->executeWithApiResponse(ANetEnvironment::PRODUCTION);
|
|
131
|
+
$controller->executeWithApiResponse(ANetEnvironment::SANDBOX); // Sandbox
|
|
132
|
+
$controller->executeWithApiResponse(ANetEnvironment::PRODUCTION); // Production
|
|
142
133
|
```
|
|
143
134
|
|
|
144
135
|
## Transaction Types
|
|
@@ -151,24 +142,20 @@ $controller->executeWithApiResponse(ANetEnvironment::PRODUCTION);
|
|
|
151
142
|
| Refund | `refundTransaction` | Refund settled transaction |
|
|
152
143
|
| Void | `voidTransaction` | Cancel unsettled transaction |
|
|
153
144
|
|
|
154
|
-
## Accept.js Integration
|
|
145
|
+
## Accept.js Integration
|
|
155
146
|
|
|
156
|
-
Accept.js tokenizes card data client-side
|
|
157
|
-
|
|
158
|
-
**Server-side token consumption**:
|
|
147
|
+
Accept.js tokenizes card data client-side — server never sees raw card numbers. Nonces valid 15 minutes.
|
|
159
148
|
|
|
160
149
|
```php
|
|
161
150
|
$opaque_data = new AnetAPI\OpaqueDataType();
|
|
162
|
-
$opaque_data->setDataDescriptor('COMMON.ACCEPT.INAPP.PAYMENT');
|
|
151
|
+
$opaque_data->setDataDescriptor('COMMON.ACCEPT.INAPP.PAYMENT'); // always this value
|
|
163
152
|
$opaque_data->setDataValue($payment_nonce);
|
|
164
153
|
|
|
165
154
|
$payment_type = new AnetAPI\PaymentType();
|
|
166
155
|
$payment_type->setOpaqueData($opaque_data);
|
|
167
156
|
```
|
|
168
157
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
## Quick Reference: Common Operations
|
|
158
|
+
## Common Operations
|
|
172
159
|
|
|
173
160
|
### Charge with Accept.js Token
|
|
174
161
|
|
|
@@ -176,7 +163,7 @@ $payment_type->setOpaqueData($opaque_data);
|
|
|
176
163
|
$transaction_request = new AnetAPI\TransactionRequestType();
|
|
177
164
|
$transaction_request->setTransactionType('authCaptureTransaction');
|
|
178
165
|
$transaction_request->setAmount($amount);
|
|
179
|
-
$transaction_request->setPayment($payment_type);
|
|
166
|
+
$transaction_request->setPayment($payment_type);
|
|
180
167
|
```
|
|
181
168
|
|
|
182
169
|
### Charge Stored CIM Profile
|
|
@@ -195,12 +182,12 @@ $transaction_request->setAmount($amount);
|
|
|
195
182
|
$transaction_request->setProfile($profile_to_charge);
|
|
196
183
|
```
|
|
197
184
|
|
|
198
|
-
### Refund
|
|
185
|
+
### Refund Settled Transaction
|
|
199
186
|
|
|
200
187
|
```php
|
|
201
188
|
$credit_card = new AnetAPI\CreditCardType();
|
|
202
189
|
$credit_card->setCardNumber('XXXX1234'); // last 4 digits
|
|
203
|
-
$credit_card->setExpirationDate('XXXX');
|
|
190
|
+
$credit_card->setExpirationDate('XXXX'); // literal 'XXXX'
|
|
204
191
|
|
|
205
192
|
$payment = new AnetAPI\PaymentType();
|
|
206
193
|
$payment->setCreditCard($credit_card);
|
|
@@ -212,7 +199,7 @@ $tx->setRefTransId($original_transaction_id);
|
|
|
212
199
|
$tx->setPayment($payment);
|
|
213
200
|
```
|
|
214
201
|
|
|
215
|
-
### Void
|
|
202
|
+
### Void Unsettled Transaction
|
|
216
203
|
|
|
217
204
|
```php
|
|
218
205
|
$tx = new AnetAPI\TransactionRequestType();
|
|
@@ -222,14 +209,11 @@ $tx->setRefTransId($transaction_id);
|
|
|
222
209
|
|
|
223
210
|
## Error Handling
|
|
224
211
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
AuthNet responses have two levels of messages:
|
|
228
|
-
|
|
229
|
-
1. **Top-level**: `$response->getMessages()` — API-level success/failure
|
|
212
|
+
Responses have two message levels:
|
|
213
|
+
1. **Top-level**: `$response->getMessages()` — API success/failure
|
|
230
214
|
2. **Transaction-level**: `$tresponse->getErrors()` / `$tresponse->getMessages()` — transaction result
|
|
231
215
|
|
|
232
|
-
Always check both.
|
|
216
|
+
Always check both. Transaction can fail even when API call succeeds.
|
|
233
217
|
|
|
234
218
|
### Common Error Codes
|
|
235
219
|
|
|
@@ -244,32 +228,15 @@ Always check both. A transaction can fail (`tresponse->getErrors()`) even when t
|
|
|
244
228
|
|
|
245
229
|
### E00039 Duplicate Profile Recovery
|
|
246
230
|
|
|
247
|
-
AuthNet includes the existing profile ID in the error text:
|
|
248
|
-
|
|
249
231
|
```php
|
|
250
232
|
function extract_profile_id_from_error(string $error_text): string|false {
|
|
251
233
|
return preg_match('/ID\s+(\d+)/', $error_text, $m) ? $m[1] : false;
|
|
252
234
|
}
|
|
253
235
|
```
|
|
254
236
|
|
|
255
|
-
##
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
-
|
|
261
|
-
- Working with CIM customer profiles (create, update, delete, payment profiles)
|
|
262
|
-
- Working with ARB recurring billing (subscriptions, schedules, trials)
|
|
263
|
-
- Need webhook event types and HMAC-SHA512 signature validation
|
|
264
|
-
- Working with transaction reporting API
|
|
265
|
-
- Need response code tables or field constraints
|
|
266
|
-
- Implementing refunds, voids, or auth-only flows
|
|
267
|
-
|
|
268
|
-
### Sandbox & Testing Guide
|
|
269
|
-
**File**: `references/sandbox-testing.md`
|
|
270
|
-
**Load when**:
|
|
271
|
-
- Setting up sandbox environment or test credentials
|
|
272
|
-
- Need test card numbers and expected responses
|
|
273
|
-
- Debugging sandbox-specific issues (CIM→ARB propagation delay)
|
|
274
|
-
- Writing PHPUnit tests for payment functions
|
|
275
|
-
- Need sandbox vs production behavioral differences
|
|
237
|
+
## Reference Files
|
|
238
|
+
|
|
239
|
+
| File | Load when |
|
|
240
|
+
|------|-----------|
|
|
241
|
+
| `references/api-reference.md` | Complete SDK class/method listings; CIM profiles; ARB subscriptions; webhooks + HMAC-SHA512; reporting API; response codes; refunds/voids/auth-only |
|
|
242
|
+
| `references/sandbox-testing.md` | Sandbox setup; test card numbers; sandbox vs production differences; CIM→ARB propagation delay; PHPUnit patterns |
|