-
Notifications
You must be signed in to change notification settings - Fork 52
Rename merchant API key to partner API key #369
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
base: main
Are you sure you want to change the base?
Conversation
Update API key naming throughout POS app to use 'partner' terminology for consistency with platform branding. Changes include environment variables, secure storage keys, store state/methods, UI text, and documentation. Adds migration function to handle upgrade path for existing users. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Claude finished @ignaciosantise's task in 1m 27s —— View job Code Review CompleteReviewed PR #369: Rename merchant API key to partner API key SummaryPR size: 15 files, 291 lines changed (163 additions, 128 deletions) - within acceptable limits. Comprehensive review completed across all changed files, including migration logic, secure storage implementations, settings store, and UI components. Found 3 issue(s)Issue 1: User-facing text still references "merchant settings"ID: settings-merchant-terminology-a4f2 Context:
Recommendation: Update user-facing strings for consistency: // Line 160
`Use ${biometricLabel} to change partner settings`
// Line 357
subtitle="Enter your PIN to save partner settings"
// Line 369
subtitle="Set a 4-digit PIN to protect partner settings"Issue 2: Migration runs on every app startID: layout-migration-performance-b8c1 Context:
Recommendation: Track migration completion to prevent repeated execution: // In secure storage
const MIGRATION_COMPLETED_KEY = "migration_partner_api_key_completed";
export async function migratePartnerApiKey(): Promise<void> {
const migrationCompleted = storage.getItem<boolean>(MIGRATION_COMPLETED_KEY);
if (migrationCompleted) return;
const OLD_KEY = "merchant_api_key";
const NEW_KEY = "partner_api_key";
const oldValue = await SecureStore.getItemAsync(OLD_KEY);
if (oldValue) {
const newValue = await SecureStore.getItemAsync(NEW_KEY);
if (!newValue) {
await SecureStore.setItemAsync(NEW_KEY, oldValue);
}
await SecureStore.deleteItemAsync(OLD_KEY);
}
storage.setItem(MIGRATION_COMPLETED_KEY, true);
}Issue 3: Comment reference outdatedID: payment-comment-terminology-c7d3 Context:
Recommendation: Update JSDoc to reflect new terminology: /**
* Get partner API headers for authenticated requests
* @returns Headers object with Api-Key, Merchant-Id, and SDK headers
* @throws Error if API key or merchant ID is missing
*/Positive Observations
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR renames API key terminology from "merchant" to "partner" throughout the POS app for consistency with platform branding. The changes affect environment variables, secure storage keys, store methods, UI text, and error messages, with a migration function to handle the upgrade path for existing users.
Changes:
- Renamed environment variable from
EXPO_PUBLIC_DEFAULT_MERCHANT_API_KEYtoEXPO_PUBLIC_DEFAULT_PARTNER_API_KEY - Updated secure storage key from
merchant_api_keytopartner_api_keywith migration support - Renamed store state and methods (e.g.,
isMerchantApiKeySet→isPartnerApiKeySet) - Updated all UI labels, placeholders, and error messages to use "partner API key" terminology
- Added
migratePartnerApiKey()function to preserve existing users' API keys during upgrade
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| dapps/pos-app/utils/secure-storage.web.ts | Added migration function and renamed storage key constant |
| dapps/pos-app/utils/secure-storage.ts | Added migration function and renamed storage key constant |
| dapps/pos-app/utils/merchant-config.ts | Renamed environment variable and config method |
| dapps/pos-app/store/useSettingsStore.ts | Renamed state properties and methods, updated env default handling |
| dapps/pos-app/services/payment.web.ts | Updated variable names and error message |
| dapps/pos-app/services/payment.ts | Updated variable names and error message |
| dapps/pos-app/hooks/use-merchant-flow.ts | Renamed all state and method references |
| dapps/pos-app/app/settings.tsx | Updated UI labels and references |
| dapps/pos-app/app/index.tsx | Updated state property reference |
| dapps/pos-app/app/_layout.tsx | Added migration execution and state synchronization |
| dapps/pos-app/tests/utils/store-helpers.ts | Updated test helper storage keys |
| dapps/pos-app/tests/store/useSettingsStore.test.ts | Renamed test descriptions and assertions |
| dapps/pos-app/tests/services/payment.test.ts | Updated storage keys and error message assertions |
| dapps/pos-app/AGENTS.md | Updated documentation for environment variable and code examples |
| dapps/pos-app/.env.example | Updated environment variable name |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add migration completion tracking to avoid running on every app start - Move migration to onRehydrateStorage to fix race condition with defaults - Update user-facing text from "merchant settings" to "partner settings" - Update JSDoc comment in payment.ts for new terminology - Add test coverage for migration function (5 test cases) - Simplify _layout.tsx by removing redundant migration call Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PR Review Feedback AddressedAll issues from the code review have been addressed in commit 7724eb5: Issue 1: User-facing text still references "merchant settings"Status: ✅ Fixed
Issue 2: Migration runs on every app startStatus: ✅ Fixed
Issue 3: Comment reference outdated in payment.tsStatus: ✅ Fixed
Additional Improvements
|
Reverted user-facing PIN and biometric prompt text to use "merchant settings" instead of "partner settings" per user preference. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add an info log entry to track when the partner API key migration from the old merchant_api_key is performed. This helps with debugging and monitoring app updates in production. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
Renames API key terminology from "merchant" to "partner" throughout the POS app for consistency with platform branding. Updates environment variables, secure storage keys, store methods, UI text, and error messages.
Changes
EXPO_PUBLIC_DEFAULT_MERCHANT_API_KEY→EXPO_PUBLIC_DEFAULT_PARTNER_API_KEYmerchant_api_key→partner_api_keyisMerchantApiKeySet→isPartnerApiKeySet, and related methodsTest plan
🤖 Generated with Claude Code