generate static method

  1. @visibleForTesting
String generate(
  1. String terminalKey,
  2. String password,
  3. AcquiringRequest request
)

Создает токен, на основе terminalKey, password, request

Можно использовать только для тестирования

Implementation

@visibleForTesting
static String generate(
  String terminalKey,
  String password,
  AcquiringRequest request,
) {
  final Map<String, dynamic> temp = request.toJson()
    ..addAll(<String, dynamic>{
      JsonKeys.terminalKey: terminalKey,
      JsonKeys.password: password,
    });
  final List<String> sortedKeys = List<String>.from(temp.keys)..sort();
  final StringBuffer buffer = StringBuffer();

  for (int i = 0; i < sortedKeys.length; i++) {
    if (!Ignore.ignoredFields.contains(sortedKeys[i])) {
      buffer.write(temp[sortedKeys[i]]);
    }
  }

  return CryptoUtils.sha256(buffer.toString());
}