Skip to content

Commit 0e3673c

Browse files
authored
Align error code enums to PascalCase (#554)
Standardizes error code enums to PascalCase to stay aligned with OpenIAP naming and updates mappings, docs, samples, and tests accordingly. Tests: `dart test` *(fails: flutter_test requires a Flutter host environment; run `flutter test` locally)* <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - Refactor - Breaking change: public ErrorCode members renamed from e-prefixed lowerCamelCase to PascalCase (e.g., eUserCancelled → UserCancelled). Update integrations and error handling. - New Features - Added many new error codes to broaden platform and billing coverage (e.g., BillingUnavailable, ProductAlreadyOwned, PurchaseNotAllowed, NotInitialized, AlreadyInitialized, etc.). - Documentation - Updated API docs, guides, migration notes, examples, and mappings to reflect renamed and added ErrorCode values. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent a4b996c commit 0e3673c

25 files changed

+621
-573
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ This major release redesigns the API to fully comply with the [Open IAP](https:/
467467
- **iOS**: Now requires iOS 11.0+ with StoreKit 2 support (iOS 15.0+)
468468
- **Android**: Updated to Billing Client v8.0.0
469469
- **API Changes**:
470-
- Enum naming convention: `E_UNKNOWN``eUnknown` (lowerCamelCase)
470+
- Enum naming convention: `E_UNKNOWN``Unknown` (PascalCase)
471471
- Channel access: `FlutterInappPurchase.channel``FlutterInappPurchase.instance.channel`
472472
- Unified error handling with standardized error codes
473473

docs/docs/api/core-methods.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -564,10 +564,10 @@ try {
564564
await FlutterInappPurchase.instance.initConnection();
565565
} on PurchaseError catch (e) {
566566
switch (e.code) {
567-
case ErrorCode.eAlreadyInitialized:
567+
case ErrorCode.AlreadyInitialized:
568568
print('Already initialized');
569569
break;
570-
case ErrorCode.eNetworkError:
570+
case ErrorCode.NetworkError:
571571
print('Network error - check connection');
572572
break;
573573
default:
@@ -645,7 +645,7 @@ Future<void> makePurchase(String sku) async {
645645
646646
// Success handling happens in purchaseUpdated listener
647647
} on PurchaseError catch (e) {
648-
if (e.code == ErrorCode.eUserCancelled) {
648+
if (e.code == ErrorCode.UserCancelled) {
649649
// User cancelled - don't show error
650650
return;
651651
}

0 commit comments

Comments
 (0)