Skip to content

Commit 184eb6d

Browse files
Elikem MedehouElikem Medehou
authored andcommitted
(update) on currencies and class name
1 parent 61d5cdb commit 184eb6d

File tree

10 files changed

+296
-126
lines changed

10 files changed

+296
-126
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## [0.1.5] - 2024-04-01
4+
5+
### Update && Minor Breaking Changes
6+
7+
- Adding all the currencies and comment about them
8+
- Adding more comment on payment info class
9+
- Making the core models class start by Moneroo
10+
11+
# Changelog
12+
313
## [0.1.4] - 2024-04-01
414

515
### Chores

example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class _MyHomePageState extends State<MyHomePage> {
4242
builder: (context) => Moneroo(
4343
amount: 1,
4444
apiKey: 'YOUR_API_KEY',
45-
currency: MonerooCurency.XOF,
45+
currency: MonerooCurrency.XOF,
4646
customer: MonerooCustomer(
4747
4848
firstName: 'firstname',

lib/src/api/moneroo_api_wrapper.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class MonerooApi {
4040
Future<MonerooPayment> initPayment({
4141
required int amount,
4242
required MonerooCustomer customer,
43-
MonerooCurency currency = MonerooCurency.XOF,
43+
MonerooCurrency currency = MonerooCurrency.XOF,
4444
String? description,
4545
String? callbackUrl,
4646
Map<String, dynamic>? metadata,
@@ -57,7 +57,7 @@ class MonerooApi {
5757
},
5858
);
5959

60-
final apiResponse = ApiResponse.fromJson(res.data!);
60+
final apiResponse = MonerooApiResponse.fromJson(res.data!);
6161

6262
return MonerooPayment.fromJson(apiResponse.data);
6363
} on DioException catch (e) {
@@ -76,7 +76,7 @@ class MonerooApi {
7676

7777
/// Allow you to retrieve data about a payment given its paymentID. Can be
7878
/// helpful to get the current status of a payment.
79-
Future<PaymentInfos> getPaymentInfos({
79+
Future<MonerooPaymentInfos> getMonerooPaymentInfos({
8080
required String paymentId,
8181
}) async {
8282
try {
@@ -85,9 +85,9 @@ class MonerooApi {
8585
'/${apiVersion.name}${Endpoints.payments}/$paymentId${Endpoints.verify}',
8686
);
8787

88-
final apiResponse = ApiResponse.fromJson(res.data!);
88+
final apiResponse = MonerooApiResponse.fromJson(res.data!);
8989

90-
return PaymentInfos.fromJson(apiResponse.data);
90+
return MonerooPaymentInfos.fromJson(apiResponse.data);
9191
} on DioException catch (e) {
9292
if (e.response == null) throw ServiceUnavailableException();
9393

lib/src/commons/enums.dart

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,64 @@ enum MonerooVersion {
66
}
77

88
/// Allowed currency on Moneroo
9-
enum MonerooCurency {
9+
enum MonerooCurrency {
10+
CDF, // Airtel Congo (airtel_cd)
11+
12+
MWK, // Airtel Money Malawi (airtel_mw)
13+
14+
/// QR Code Nigeria (qr_ngn),
15+
/// Airtel Money Nigeria (airtel_ng),
16+
/// Bank Transfer NG (bank_transfer_ng), Barter (barter)
17+
NGN,
18+
19+
ZMW, // Airtel Zambia (airtel_zm)
20+
21+
GHS, // Credit Card GHS (card_ghs), Crypto GHS (crypto_ghs), Airtel/Tigo Ghana (tigo_gh), Vodafone Ghana (vodafone_gh)
22+
23+
/// Card Kenya (card_kes), M-Pesa Kenya (mpesa_ke),
24+
/// TNM Mpamba Malawi (tnm_mw)
25+
KES,
26+
27+
/// Airtel Tanzania (airtel_tz),
28+
/// Card Tanzania (card_tzs),
29+
/// Vodacom Tanzania (mpesa_tz), Tigo Tanzania (tigo_tz)
30+
TZS,
31+
32+
/// Airtel Uganda (airtel_ug),
33+
/// Card Uganda (card_ugx), MTN MoMo Uganda (mtn_ug)
34+
UGX,
35+
36+
/// Credit Card USD (card_usd),
37+
/// Crypto USD (crypto_usd),
38+
/// Test Payment Method (moneroo_payment_demo)
39+
USD,
40+
41+
/// Credit Card XAF (card_xaf), Crypto XAF (crypto_xaf)
42+
/// EU Mobile Money Cameroon (eu_mobile_cm)
43+
/// MTN MoMo Cameroon (mtn_cm),
44+
/// Orange Money Cameroon (orange_cm), Wave CI (wave_ci)
1045
XAF,
46+
47+
/// Airtel Niger (airtel_ne), Credit Card XOF (card_xof)
48+
/// Crypto XOF (crypto_xof), Moov Burkina Faso (moov_bf)
49+
/// Moov Money Benin (moov_bj), Moov Money CI (moov_ci),
50+
/// Moov Money Mali (moov_ml), Moov Money Togo (moov_tg),
51+
/// MTN MoMo Benin (mtn_bj), MTN MoMo CI (mtn_ci),
52+
/// E-Money Senegal (e_money_sn), Free Money Senegal (freemoney_sn),
53+
/// Mobi Cash Mali (mobi_cash_ml), Orange Burkina Faso (orange_bf),
54+
/// Orange Money CI (orange_ci), Orange Money Guinea (orange_gn),
55+
/// Orange Money Mali (orange_ml),Orange Money Senegal (orange_sn),
56+
/// Wave Senegal (wave_sn), Wizall Senegal (wizall_sn),
57+
/// Togocel Money (togocel)
1158
XOF,
12-
USD,
13-
NGN,
59+
60+
ZAR, // Credit Card ZAR (card_zar)
61+
62+
EUR, // Crypto EUR (crypto_eur)
63+
64+
GNF, // MTN MoMo Guinea (mtn_gn), Orange Money Guinea (orange_gn)
65+
66+
RWF, //Airtel Rwanda (airtel_rw), MTN MoMo Rwanda (mtn_rw)
1467
}
1568

1669
/// Give the current status of a payment

lib/src/models/api_response.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/// Base class to handle API response
2-
class ApiResponse {
2+
class MonerooApiResponse {
33
///
4-
ApiResponse({
4+
MonerooApiResponse({
55
// required this.success,
66
required this.message,
77
required this.data,
88
});
99

1010
///
11-
ApiResponse.fromJson(Map<String, dynamic> json) {
11+
MonerooApiResponse.fromJson(Map<String, dynamic> json) {
1212
// success = json['success'] as bool;
1313
message = json['message'] as String;
1414
data = json['data'] as Map<String, dynamic>;

0 commit comments

Comments
 (0)