User Story
As a merchant, I want to accept card payments from customers for their orders, so that I can receive payments and complete sales.
Acceptance Criteria (user/outcome focused; testable)
- Navigation & Input
- Given the merchant is on PaymentEntryScreen, when they enter an amount and press "Next", then the app navigates to ReadCardScreen.
- Card Capture Simulation
- Given the merchant is on ReadCardScreen, when the fake POS SDK is invoked, then it returns a card token within a short delay.
- Gateway Call & Success
- Given a valid PaymentIntent and card token, when the app calls the fake Payment Gateway, then it receives a success response with a unique transactionId.
- Persistence
- Given a successful gateway response, the payment intent in local DB is updated to COMPLETED and stores the transactionId.
- UI Feedback
- After success, the UI displays a simple pop-up dialog that shows success and the transactionId (no dedicated result screen).
- Tests & CI
- Unit tests verify the happy path flow (Repository + ViewModel) and the CI pipeline runs these tests successfully.
Implementation Tasks (developer-focused)
- UI
- Add PaymentEntryScreen: amount input, validation (positive amount), card method auto-selected, and "Next" button to ReadCardScreen.
- Add ReadCardScreen: loading/reading state and invokes FakePosSdk.readCard(), triggers payment, shows simple pop-up dialog on success (transactionId).
- Fake POS SDK
3. Implement FakePosSdk.readCard() to resolve after a short delay and return a fake card token.
- Fake Payment Gateway
4. Implement FakePaymentGateway.charge(amount, idempotencyKey, cardToken) to always return success and a unique transactionId (handle idempotencyKey).
- Repository & Domain
5. PaymentRepository: createPaymentIntent(amount), startCardPayment(intentId) flow: load intent, call FakePosSdk, call FakePaymentGateway, update intent to COMPLETED and save transactionId.
- ViewModels & State
6. ViewModels for PaymentEntryScreen and ReadCardScreen to manage states and transitions.
- Local DB
7. Define/extend PaymentIntent entity: intentId, amount, status (PENDING/COMPLETED/FAILED), idempotencyKey, transactionId, lastError, createdAt, updatedAt.
- Tests
8. Unit test: happy path end-to-end using fakes. ViewModel tests: input -> navigation -> read -> success.
- CI/CD
9. Ensure unit tests run in pipeline; update pipeline to fail on regressions.
Out of Scope
- Retry logic, timeouts, network error handling, or failure flows.
- QR Payments and partial payments.
- Real POS/Gateway integration and security/encryption.
- Advanced/polished UI or dedicated result screen.
References
- README and docs/diagrams for architecture context.
Note: This issue focuses on the happy path only. Failure and retry behaviors will be added in separate tickets later.
User Story
As a merchant, I want to accept card payments from customers for their orders, so that I can receive payments and complete sales.
Acceptance Criteria (user/outcome focused; testable)
Implementation Tasks (developer-focused)
3. Implement FakePosSdk.readCard() to resolve after a short delay and return a fake card token.
4. Implement FakePaymentGateway.charge(amount, idempotencyKey, cardToken) to always return success and a unique transactionId (handle idempotencyKey).
5. PaymentRepository: createPaymentIntent(amount), startCardPayment(intentId) flow: load intent, call FakePosSdk, call FakePaymentGateway, update intent to COMPLETED and save transactionId.
6. ViewModels for PaymentEntryScreen and ReadCardScreen to manage states and transitions.
7. Define/extend PaymentIntent entity: intentId, amount, status (PENDING/COMPLETED/FAILED), idempotencyKey, transactionId, lastError, createdAt, updatedAt.
8. Unit test: happy path end-to-end using fakes. ViewModel tests: input -> navigation -> read -> success.
9. Ensure unit tests run in pipeline; update pipeline to fail on regressions.
Out of Scope
References
Note: This issue focuses on the happy path only. Failure and retry behaviors will be added in separate tickets later.