Skip to content

Commit 19b3378

Browse files
committed
Removed unnecessary print statements
1 parent 25542f9 commit 19b3378

File tree

8 files changed

+33
-56
lines changed

8 files changed

+33
-56
lines changed

example/lib/main.dart

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class _HomePageState extends State<HomePage> {
124124
decoration: const InputDecoration(
125125
border: const UnderlineInputBorder(),
126126
labelText: 'CVV'),
127-
onSaved: (value) => assignVariable(value),
127+
onSaved: (String value) => cvv = value,
128128
validator: (String value) =>
129129
value.isEmpty ? fieldIsReq : null,
130130
))
@@ -289,7 +289,7 @@ class _HomePageState extends State<HomePage> {
289289
if (!_allInputsAreValid()) {
290290
return;
291291
}
292-
print("IsLocal: $isLocal");
292+
293293
_charge = Charge();
294294
_charge.card = _getCardFromUI();
295295

@@ -314,7 +314,7 @@ class _HomePageState extends State<HomePage> {
314314

315315
_chargeCard() {
316316
_transaction = null;
317-
print('Sending charge with ${_charge.amount}');
317+
318318
PaystackSdk.chargeCard(context,
319319
charge: _charge,
320320
beforeValidate: (transaction) => handleBeforeValidate(transaction),
@@ -445,7 +445,7 @@ class _HomePageState extends State<HomePage> {
445445
http.Response response = await http.get(url);
446446
var body = response.body;
447447
_charge.accessCode = body;
448-
print('Access Code Response Body = $body');
448+
449449
_chargeCard();
450450
} catch (e) {
451451
setState(() {
@@ -462,7 +462,7 @@ class _HomePageState extends State<HomePage> {
462462
try {
463463
http.Response response = await http.get(url);
464464
var body = response.body;
465-
print('Verify Response Body = $body');
465+
466466
setState(() {
467467
_backendMessage = 'Gateway response: $body';
468468
});
@@ -475,11 +475,6 @@ class _HomePageState extends State<HomePage> {
475475
});
476476
}
477477
}
478-
479-
assignVariable(String value) {
480-
print('CVV legth $value');
481-
cvv = value;
482-
}
483478
}
484479

485480
const fieldIsReq = 'Field is required';

lib/paystack_sdk.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,15 @@ class PaystackSdk {
4646
String paystackBuild =
4747
await Utils.channel.invokeMethod('getVersionCode');
4848
String deviceId = await Utils.channel.invokeMethod('getDeviceId');
49-
var platformInfo = PlatformInfo()
49+
PlatformInfo()
5050
..userAgent = userAgent
5151
..paystackBuild = paystackBuild
5252
..deviceId = deviceId;
5353

54-
print('Platform Info ${platformInfo.toString()}');
55-
5654
_sdkInitialized = true;
5755
completer.complete(PaystackSdk._());
5856
} on PlatformException catch (e) {
59-
print('An error occured while initializing Paystck: ${e.toString()}');
57+
6058
completer.completeError(e);
6159
}
6260
}

lib/src/api/request/charge_request_body.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class ChargeRequestBody extends BaseRequestBody {
3939
Map<String, String> _additionalParameters;
4040

4141
ChargeRequestBody._(Charge charge, String clientData) {
42-
print('Email = ${charge.email}');
4342
this.setDeviceId();
4443
this._clientData = clientData;
4544
this._last4 = charge.card.last4Digits;

lib/src/api/service/api_service.dart

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@ class ApiService {
1919
Future<TransactionApiResponse> charge(Map<String, String> fields) async {
2020
var url = '$baseUrl/charge/mobile_charge';
2121
var completer = Completer<TransactionApiResponse>();
22-
print('charge Request Headers = $headers');
23-
print('charge Request Body = $fields');
22+
2423
try {
2524
http.Response response =
2625
await http.post(url, body: fields, headers: headers);
2726
var body = response.body;
28-
print("Api Charge body = $body");
27+
2928
var statusCode = response.statusCode;
30-
print('Status code = $statusCode');
29+
3130
if (statusCode == HttpStatus.OK) {
3231
Map<String, dynamic> responseBody = json.decode(body);
3332
completer.complete(TransactionApiResponse.fromMap(responseBody));
@@ -36,7 +35,7 @@ class ApiService {
3635
'$statusCode and response: $body');
3736
}
3837
} catch (e) {
39-
print('Something went wrong during charge request ${e.toString()}');
38+
4039
completer.completeError('charge transaction failed error: $e');
4140
}
4241

@@ -46,13 +45,13 @@ class ApiService {
4645
Future<TransactionApiResponse> validateCharge(
4746
Map<String, String> fields) async {
4847
var url = '$baseUrl/charge/validate';
49-
print('Validating Charge via $url');
48+
5049
var completer = Completer<TransactionApiResponse>();
5150
try {
5251
http.Response response =
5352
await http.post(url, body: fields, headers: headers);
5453
var body = response.body;
55-
print("Api Validate Charge body = $body");
54+
5655
var statusCode = response.statusCode;
5756
if (statusCode == HttpStatus.OK) {
5857
Map<String, dynamic> responseBody = json.decode(body);
@@ -62,8 +61,7 @@ class ApiService {
6261
'status code: $statusCode and response: $body');
6362
}
6463
} catch (e) {
65-
print('Something went wrong during validate charge request ${e
66-
.toString()}');
64+
6765
completer.completeError('validate charge transaction failed error: $e');
6866
}
6967

@@ -85,7 +83,7 @@ class ApiService {
8583
'$statusCode and response: $body');
8684
}
8785
} catch (e) {
88-
print('Something went wrong during requery request ${e.toString()}');
86+
8987
completer.completeError('requery transaction failed error: $e');
9088
}
9189

lib/src/paystack.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ class Paystack {
6060

6161
transactionManager.chargeCard();
6262
} catch (e) {
63-
print('Something went wrong while charging card in Paystack class. '
64-
'Reason ${e.toString()}');
63+
6564
assert(onError != null);
6665
onError(e, null);
6766
}

lib/src/transaction_manager.dart

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -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);

lib/src/ui/pin_input_ui.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ class _PinInputUIState extends State<PinInputUI> {
213213
}
214214

215215
void _handleNumberPress(int number) {
216-
print('Pressed $number');
216+
217217
setState(() {
218218
_selectedPins.add(number.toString());
219219
});

lib/src/utils/crypto.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ class Crypto {
99
try {
1010
String result = await Utils.channel
1111
.invokeMethod('getEncryptedData', {"stringData": data});
12-
print('Encryption Successful. Result: $result');
1312
completer.complete(result);
1413
} on PlatformException catch (e) {
15-
print('Encryption Failed. Reason: $e');
1614
completer.completeError(e);
1715
}
1816

0 commit comments

Comments
 (0)