@@ -51,37 +51,29 @@ class TransactionManager {
5151 }
5252
5353 _initiate () async {
54- print ( "Started _initiate" );
54+
5555 if (TransactionManager .processing) {
5656 throw ProcessingException ();
5757 }
5858 _setProcessingOn ();
59- print ( 'Tansaction Manager: _initiate: 1' );
59+
6060 _apiService = ApiService ();
61- print ('Tansaction Manager: _initiate: 2' );
6261 _chargeRequestBody = await ChargeRequestBody .getChargeRequestBody (_charge);
63- print ('Tansaction Manager: _initiate: 3' );
6462 _validateRequestBody = ValidateRequestBody ();
65- print ('Tansaction Manager: _initiate: 4' );
6663 }
6764
6865 chargeCard () async {
69- print ( "chargeCard Entered" );
66+
7067 try {
71- print ('chargeCard Started If' );
7268 if (_charge.card == null || ! _charge.card.isValid ()) {
73- print ('chargeCard True' );
7469 _getCardInfoFrmUI (_charge.card);
7570 } else {
76- print ("chargeCard Is Flase" );
7771 await _initiate ();
78- print ("chargeCard IS False 2" );
7972 _sendChargeToServer ();
8073 }
81- print ( "chargeCard End If" );
74+
8275 } catch (e) {
83- print (
84- 'Something went wrong while charging card. Reason: ${e .toString ()}' );
76+
8577 if (! (e is ProcessingException )) {
8678 _setProcessingOff ();
8779 }
@@ -90,12 +82,11 @@ class TransactionManager {
9082 }
9183
9284 _sendChargeToServer () {
93- print ( 'Started _sendChargeToServer' );
85+
9486 try {
9587 _initiateChargeOnServer ();
9688 } catch (e) {
97- print ('Something went wrong while sending charge to server. '
98- 'Reason: ${e .toString ()}' );
89+
9990 _notifyProcessingError (e);
10091 }
10192 }
@@ -104,7 +95,7 @@ class TransactionManager {
10495 try {
10596 _validateChargeOnServer ();
10697 } catch (e) {
107- print ( 'Something went wrong while validating. Reason ${ e . toString ()}' );
98+
10899 _notifyProcessingError (e);
109100 }
110101 }
@@ -113,7 +104,7 @@ class TransactionManager {
113104 try {
114105 _reQueryChargeOnServer ();
115106 } catch (e) {
116- print ( 'Something went wrong while reQuering ${ e . toString ()}' );
107+
117108 _notifyProcessingError (e);
118109 }
119110 }
@@ -180,7 +171,6 @@ class TransactionManager {
180171 return ;
181172 }
182173
183- print ('Gotten Here ----------- 3' );
184174
185175 if (apiResponse.hasValidAuth () &&
186176 (apiResponse.auth.toLowerCase () == 'otp' .toLowerCase () ||
@@ -192,7 +182,7 @@ class TransactionManager {
192182 return ;
193183 }
194184 }
195- print ( 'Gotten Here ----------- 4' );
185+
196186 if (status == '0' .toLowerCase () || status == 'error' ) {
197187 if (apiResponse.message.toLowerCase () ==
198188 'Invalid Data Sent' .toLowerCase () &&
@@ -201,20 +191,20 @@ class TransactionManager {
201191 _sendChargeToServer ();
202192 return ;
203193 }
204- print ( 'Gotten Here ----------- 5' );
194+
205195
206196 if (apiResponse.message.toLowerCase () ==
207197 'Access code has expired' .toLowerCase ()) {
208198 _notifyProcessingError (ExpiredAccessCodeException (apiResponse.message));
209199 return ;
210200 }
211201
212- print ( 'Gotten Here ----------- 6' );
202+
213203 _notifyProcessingError (ChargeException (apiResponse.message));
214204 return ;
215205 }
216206
217- print ( 'Gotten Here ----------- 7' );
207+
218208 _notifyProcessingError (PaystackException ('Unknown server response' ));
219209 }
220210
@@ -300,16 +290,16 @@ class TransactionManager {
300290 }
301291
302292 _getAuthFrmUI (String url) async {
303- print ( 'Want to get authorization from' );
293+
304294 String result =
305295 await Utils .channel.invokeMethod ('getAuthorization' , {"authUrl" : url});
306296 TransactionApiResponse apiResponse;
307297 try {
308298 Map <String , dynamic > responseMap = json.decode (result);
309299 apiResponse = TransactionApiResponse .fromMap (responseMap);
310- print ( 'API response = $ responseMap ' );
300+
311301 } catch (e) {
312- print ( 'Error occured during authentication. Error ${ e . toString ()}' );
302+
313303 apiResponse = TransactionApiResponse .unknownServerResponse ();
314304 }
315305 _handleApiResponse (apiResponse);
0 commit comments