-
Notifications
You must be signed in to change notification settings - Fork 5
feat(ImprovePwAI3UX): admin per-user credit detail page with refund s… #647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
908b496
feat(ImprovePwAI3UX): admin per-user credit detail page with refund s…
EmilFattakhov 23d5a2c
refactor: drop redundant refunded boolean, use refunded_at IS NOT NULL
EmilFattakhov e10fc96
chore: merge origin/main into ImprovePwAI3UX
EmilFattakhov 2f2e810
fix(sidebar): correct upload usage display when purchased credits are…
EmilFattakhov 1c4925e
feat(purchase): redesign custom amount input with unit toggle and val…
EmilFattakhov 084ad90
refactor(purchase): extract unit-toggle helpers and fix lint warnings
EmilFattakhov ed9d39f
fix(tests): update PaymentManager spec to assert fromAddress in markI…
EmilFattakhov af85915
fix(tests): add missing refundedAt field to credits spec fixture
EmilFattakhov 7727ecd
fix(credits): use NotFoundError instead of plain Error in refundBatch
EmilFattakhov 35aaee0
fix(credits): make markAsRefunded truly idempotent by guarding on ref…
EmilFattakhov 3d25ea9
remove unused computePaymentShannons (duplicates usePrices inline for…
EmilFattakhov d96d2bb
fix(credits): use strict null check for BigInt cap guards
EmilFattakhov ead9cd6
refactor(credits): extract shared isMibOverCap helper to eliminate du…
EmilFattakhov 4554cb4
Apply lint fix
EmilFattakhov 377c55d
fix(frontend): use familiar MB/GB/TB labels and SDK shannonsToAi3 in …
EmilFattakhov 3f24725
feat(frontend): add binary-units info tooltip to custom amount selector
EmilFattakhov 37bf0af
Apply suggestions from code review
EmilFattakhov 268e8b0
Merge branch 'main' into ImprovePwAI3UX
EmilFattakhov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
apps/backend/migrations/20260401000000-intent-from-address.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| 'use strict' | ||
|
|
||
| var dbm | ||
| var type | ||
| var seed | ||
| var fs = require('fs') | ||
| var path = require('path') | ||
| var Promise | ||
|
|
||
| exports.setup = function (options, seedLink) { | ||
| dbm = options.dbmigrate | ||
| type = dbm.dataType | ||
| seed = seedLink | ||
| Promise = options.Promise | ||
| } | ||
|
|
||
| exports.up = function (db) { | ||
| var filePath = path.join( | ||
| __dirname, | ||
| 'sqls', | ||
| '20260401000000-intent-from-address-up.sql', | ||
| ) | ||
| return new Promise(function (resolve, reject) { | ||
| fs.readFile(filePath, { encoding: 'utf-8' }, function (err, data) { | ||
| if (err) return reject(err) | ||
| console.log('received data: ' + data) | ||
| resolve(data) | ||
| }) | ||
| }).then(function (data) { | ||
| return db.runSql(data) | ||
| }) | ||
| } | ||
|
|
||
| exports.down = function (db) { | ||
| var filePath = path.join( | ||
| __dirname, | ||
| 'sqls', | ||
| '20260401000000-intent-from-address-down.sql', | ||
| ) | ||
| return new Promise(function (resolve, reject) { | ||
| fs.readFile(filePath, { encoding: 'utf-8' }, function (err, data) { | ||
| if (err) return reject(err) | ||
| console.log('received data: ' + data) | ||
| resolve(data) | ||
| }) | ||
| }).then(function (data) { | ||
| return db.runSql(data) | ||
| }) | ||
| } | ||
|
|
||
| exports._meta = { | ||
| version: 1, | ||
| } |
53 changes: 53 additions & 0 deletions
53
apps/backend/migrations/20260401000001-purchased-credits-refund.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| 'use strict' | ||
|
|
||
| var dbm | ||
| var type | ||
| var seed | ||
| var fs = require('fs') | ||
| var path = require('path') | ||
| var Promise | ||
|
|
||
| exports.setup = function (options, seedLink) { | ||
| dbm = options.dbmigrate | ||
| type = dbm.dataType | ||
| seed = seedLink | ||
| Promise = options.Promise | ||
| } | ||
|
|
||
| exports.up = function (db) { | ||
| var filePath = path.join( | ||
| __dirname, | ||
| 'sqls', | ||
| '20260401000001-purchased-credits-refund-up.sql', | ||
| ) | ||
| return new Promise(function (resolve, reject) { | ||
| fs.readFile(filePath, { encoding: 'utf-8' }, function (err, data) { | ||
| if (err) return reject(err) | ||
| console.log('received data: ' + data) | ||
| resolve(data) | ||
| }) | ||
| }).then(function (data) { | ||
| return db.runSql(data) | ||
| }) | ||
| } | ||
|
|
||
| exports.down = function (db) { | ||
| var filePath = path.join( | ||
| __dirname, | ||
| 'sqls', | ||
| '20260401000001-purchased-credits-refund-down.sql', | ||
| ) | ||
| return new Promise(function (resolve, reject) { | ||
| fs.readFile(filePath, { encoding: 'utf-8' }, function (err, data) { | ||
| if (err) return reject(err) | ||
| console.log('received data: ' + data) | ||
| resolve(data) | ||
| }) | ||
| }).then(function (data) { | ||
| return db.runSql(data) | ||
| }) | ||
| } | ||
|
|
||
| exports._meta = { | ||
| version: 1, | ||
| } |
1 change: 1 addition & 0 deletions
1
apps/backend/migrations/sqls/20260401000000-intent-from-address-down.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ALTER TABLE intents DROP COLUMN IF EXISTS from_address; |
12 changes: 12 additions & 0 deletions
12
apps/backend/migrations/sqls/20260401000000-intent-from-address-up.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| -- Add from_address to intents table. | ||
| -- | ||
| -- Captures the EVM wallet address that sent the on-chain payment so admins | ||
| -- can identify the payer and initiate refunds without needing to look up the | ||
| -- transaction externally. Populated by the payment manager when it processes | ||
| -- the TransactionReceipt for each confirmed intent. | ||
| -- | ||
| -- Nullable because: | ||
| -- 1. Existing intents confirmed before this migration have no stored address. | ||
| -- 2. Intents that expire or fail before confirmation never receive a receipt. | ||
|
|
||
| ALTER TABLE intents ADD COLUMN from_address VARCHAR(255); |
2 changes: 2 additions & 0 deletions
2
apps/backend/migrations/sqls/20260401000001-purchased-credits-refund-down.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| ALTER TABLE purchased_credits | ||
| DROP COLUMN IF EXISTS refunded_at; |
11 changes: 11 additions & 0 deletions
11
apps/backend/migrations/sqls/20260401000001-purchased-credits-refund-up.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| -- Add refund tracking to purchased_credits. | ||
| -- | ||
| -- refunded_at: Timestamp of when an admin marked this batch as manually | ||
| -- refunded via POST /credits/batches/:id/refund. NULL means | ||
| -- not refunded. The presence of a timestamp is the canonical | ||
| -- source of truth — no separate boolean needed. | ||
| -- Remaining bytes are zeroed out in the same operation so the | ||
| -- user cannot continue using credits they have been refunded for. | ||
|
|
||
| ALTER TABLE purchased_credits | ||
| ADD COLUMN refunded_at TIMESTAMP WITH TIME ZONE; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.