Add Anypay token (#518)
* Add AnyPay token for interacting with the AnyPay API for Cake Pay payments * Add missing commas Co-authored-by: mkyq <53115730+mkyq@users.noreply.github.com>
Justin Ehrenhofer committed
Nov 3, 2022 at 15:53 UTC
30bac3cb6c4348038e3add58eb55b9d034c0013c
2 files changed
+9
-2
lib/anypay/anypay_api.dart
+8
-2
@@ -5,11 +5,13 @@ import 'package:http/http.dart';
5
import 'package:cw_core/crypto_currency.dart';
6
import 'package:cake_wallet/anypay/any_pay_payment.dart';
7
import 'package:cake_wallet/anypay/any_pay_trasnaction.dart';
8
+import 'package:cake_wallet/.secrets.g.dart' as secrets;
9
10
class AnyPayApi {
11
static const contentTypePaymentRequest = 'application/payment-request';
12
static const contentTypePayment = 'application/payment';
13
static const xPayproVersion = '2';
14
+ static const anypayToken = secrets.anypayToken;
15
16
static String chainByScheme(String scheme) {
17
switch (scheme.toLowerCase()) {
@@ -44,7 +46,9 @@ class AnyPayApi {
46
final headers = <String, String>{
47
'Content-Type': contentTypePaymentRequest,
48
'X-Paypro-Version': xPayproVersion,
47
- 'Accept': '*/*',};
49
+ 'Accept': '*/*',
50
+ 'x-wallet': 'cake',
51
+ 'x-wallet-token': anypayToken,};
52
final body = <String, dynamic>{
53
'chain': chainByScheme(scheme),
54
'currency': currencyByScheme(scheme).title};
@@ -66,7 +70,9 @@ class AnyPayApi {
70
final headers = <String, String>{
71
'Content-Type': contentTypePayment,
72
'X-Paypro-Version': xPayproVersion,
69
- 'Accept': '*/*',};
73
+ 'Accept': '*/*',
74
+ 'x-wallet': 'cake',
75
+ 'x-wallet-token': anypayToken,};
76
final body = <String, dynamic>{
77
'chain': chain,
78
'currency': currency,
tool/utils/secret_key.dart
+1
@@ -26,6 +26,7 @@ class SecretKey {
26
SecretKey('sideShiftAffiliateId', () => ''),
27
SecretKey('sideShiftApiKey', () => ''),
28
SecretKey('simpleSwapApiKey', () => ''),
29
+ SecretKey('anypayToken', () => ''),
30
SecretKey('onramperApiKey', () => ''),
31
];
32