Skip to content

Commit

Permalink
chore: document PaymentSdkTransactionType
Browse files Browse the repository at this point in the history
- add documentation for PaymentSdkTransactionType class
  • Loading branch information
muhammadalkady committed Sep 16, 2024
1 parent 5d1a58f commit e4ada12
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions lib/PaymentSdkTransactionType.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
enum PaymentSdkTransactionType { SALE, AUTH, REGISTER }
/// Enum representing different types of payment transactions.
enum PaymentSdkTransactionType {
/// Represents a sale transaction.
SALE,

/// Represents an authorization transaction.
AUTH,

/// Represents a register transaction.
REGISTER
}

/// Extension on [PaymentSdkTransactionType] to provide additional functionality.
extension PaymentSdkTransactionTypeExtension on PaymentSdkTransactionType {
/// Gets the name of the transaction type as a string.
///
/// Returns:
/// - "auth" for [PaymentSdkTransactionType.AUTH]
/// - "register" for [PaymentSdkTransactionType.REGISTER]
/// - "sale" for [PaymentSdkTransactionType.SALE] (default)
String get name {
switch (this) {
case PaymentSdkTransactionType.AUTH:
return "auth";
case PaymentSdkTransactionType.REGISTER:
return "Register";
return "register";
default:
return "sale";
}
}
}
}

0 comments on commit e4ada12

Please sign in to comment.