forked from kechankrisna/aba_payment
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4942f27
commit 5fd971f
Showing
14 changed files
with
194 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,5 @@ | |
|
||
.packages | ||
.pub/ | ||
|
||
*.env | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import 'package:aba_payment/aba_payment.dart'; | ||
import 'package:flutter_dotenv/flutter_dotenv.dart'; | ||
|
||
final ABAMerchant merchant = ABAMerchant( | ||
merchantID: "mylekha", | ||
merchantApiName: "pwmylekham", | ||
merchantApiKey: "cea2a8308c634a458b983def9303781f", | ||
baseApiUrl: "https://checkout-uat.payway.com.kh", | ||
merchantID: dotenv.get('ABA_PAYWAY_MERCHANT_ID'), | ||
merchantApiName: dotenv.get('ABA_PAYWAY_MERCHANT_NAME'), | ||
merchantApiKey: dotenv.get('ABA_PAYWAY_API_KEY'), | ||
baseApiUrl: dotenv.get('ABA_PAYWAY_API_URL'), | ||
refererDomain: "https://mylekha.app", | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
import 'package:aba_payment/aba_payment.dart'; | ||
import 'package:aba_payment/service/aba_client_helper.dart'; | ||
import 'package:aba_payment_example/models/item_model.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_easyloading/flutter_easyloading.dart'; | ||
import '../config.dart'; | ||
|
@@ -13,15 +11,15 @@ class CartScreen extends StatefulWidget { | |
class _CartScreenState extends State<CartScreen> { | ||
bool _isLoading = false; | ||
ABAMerchant _merchant = merchant; | ||
|
||
double _total = 6.00; | ||
double _shipping = 0.0; | ||
String _firstname = "Miss"; | ||
String _lastname = "My Lekha"; | ||
String _phone = "010464144"; | ||
String _email = "[email protected]"; | ||
String _checkoutApiUrl = "http://127.0.0.1:8000/api/v1/app/checkout_page"; | ||
List<ItemModel> _items = []; | ||
String _checkoutApiUrl = | ||
"http://localhost/api/v1/integrate/payway/checkout_page"; | ||
List<ABATransactionItem> _items = []; | ||
|
||
initialize() { | ||
if (mounted) { | ||
|
@@ -32,11 +30,10 @@ class _CartScreenState extends State<CartScreen> { | |
_lastname = "My Lekha"; | ||
_phone = "010464144"; | ||
_email = "[email protected]"; | ||
_checkoutApiUrl = "http://127.0.0.1:8000/api/v1/app/checkout_page"; | ||
_items = [ | ||
// ItemModel(name: "item 1", price: 1.00, quantity: 1), | ||
// ItemModel(name: "item 2", price: 2.00, quantity: 2), | ||
// ItemModel(name: "item 3", price: 3.00, quantity: 3), | ||
ABATransactionItem(name: "item 1", price: 1, quantity: 1), | ||
ABATransactionItem(name: "item 2", price: 2, quantity: 1), | ||
ABATransactionItem(name: "item 3", price: 3, quantity: 1), | ||
]; | ||
}); | ||
} | ||
|
@@ -62,7 +59,7 @@ class _CartScreenState extends State<CartScreen> { | |
..._items.map( | ||
(item) => ListTile( | ||
title: Text("${item.name}"), | ||
subtitle: Text("price: x${item.price}"), | ||
subtitle: Text("price: x${item.price}\$"), | ||
trailing: Text("${item.quantity}"), | ||
), | ||
), | ||
|
@@ -77,7 +74,7 @@ class _CartScreenState extends State<CartScreen> { | |
lastname: _lastname, | ||
email: _email, | ||
phone: _phone, | ||
items: [..._items.map((e) => e.toMap()).toList()], | ||
items: _items, | ||
checkoutApiUrl: _checkoutApiUrl, | ||
merchant: _merchant, | ||
onBeginCheckout: (transaction) { | ||
|
@@ -103,9 +100,9 @@ class _CartScreenState extends State<CartScreen> { | |
// onPaymentFail: (transaction) { | ||
// print("onPaymentFail ${transaction.toMap()}"); | ||
// }, | ||
// onPaymentSuccess: (transaction) { | ||
// print("onPaymentSuccess ${transaction.toMap()}"); | ||
// }, | ||
onPaymentSuccess: (transaction) { | ||
print("onPaymentSuccess ${transaction.toMap()}"); | ||
}, | ||
), | ||
], | ||
), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export './model/aba_mechant.dart'; | ||
export './model/aba_transaction.dart'; | ||
export './model/aba_transacition_item.dart'; | ||
export './model/aba_server_response.dart'; | ||
export './model/aba_payment.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
class ABATransactionItem { | ||
String name; | ||
double quantity; | ||
double price; | ||
|
||
ABATransactionItem({this.name, this.quantity, this.price}); | ||
|
||
factory ABATransactionItem.fromMap(Map<String, dynamic> map) { | ||
return ABATransactionItem( | ||
name: map["name"], | ||
quantity: double.tryParse("${map["quantity"]}"), | ||
price: double.tryParse("${map["price"]}"), | ||
); | ||
} | ||
|
||
copyWith({ | ||
String name, | ||
double quantity, | ||
double price, | ||
}) { | ||
return ABATransactionItem( | ||
name: name ?? this.name, | ||
quantity: quantity ?? this.quantity, | ||
price: price ?? this.price, | ||
); | ||
} | ||
|
||
Map<String, dynamic> toMap() { | ||
return { | ||
"name": name, | ||
"quantity": quantity, | ||
"price": price, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.