From 30bac3cb6c4348038e3add58eb55b9d034c0013c Mon Sep 17 00:00:00 2001 From: Justin Ehrenhofer Date: Thu, 3 Nov 2022 15:53:33 -0500 Subject: [PATCH] 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> --- lib/anypay/anypay_api.dart | 10 ++++++++-- tool/utils/secret_key.dart | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/anypay/anypay_api.dart b/lib/anypay/anypay_api.dart index b53a3ebd1..5eb9e460b 100644 --- a/lib/anypay/anypay_api.dart +++ b/lib/anypay/anypay_api.dart @@ -5,11 +5,13 @@ import 'package:http/http.dart'; import 'package:cw_core/crypto_currency.dart'; import 'package:cake_wallet/anypay/any_pay_payment.dart'; import 'package:cake_wallet/anypay/any_pay_trasnaction.dart'; +import 'package:cake_wallet/.secrets.g.dart' as secrets; class AnyPayApi { static const contentTypePaymentRequest = 'application/payment-request'; static const contentTypePayment = 'application/payment'; static const xPayproVersion = '2'; + static const anypayToken = secrets.anypayToken; static String chainByScheme(String scheme) { switch (scheme.toLowerCase()) { @@ -44,7 +46,9 @@ class AnyPayApi { final headers = { 'Content-Type': contentTypePaymentRequest, 'X-Paypro-Version': xPayproVersion, - 'Accept': '*/*',}; + 'Accept': '*/*', + 'x-wallet': 'cake', + 'x-wallet-token': anypayToken,}; final body = { 'chain': chainByScheme(scheme), 'currency': currencyByScheme(scheme).title}; @@ -66,7 +70,9 @@ class AnyPayApi { final headers = { 'Content-Type': contentTypePayment, 'X-Paypro-Version': xPayproVersion, - 'Accept': '*/*',}; + 'Accept': '*/*', + 'x-wallet': 'cake', + 'x-wallet-token': anypayToken,}; final body = { 'chain': chain, 'currency': currency, diff --git a/tool/utils/secret_key.dart b/tool/utils/secret_key.dart index 4502bca74..64c7beefd 100644 --- a/tool/utils/secret_key.dart +++ b/tool/utils/secret_key.dart @@ -26,6 +26,7 @@ class SecretKey { SecretKey('sideShiftAffiliateId', () => ''), SecretKey('sideShiftApiKey', () => ''), SecretKey('simpleSwapApiKey', () => ''), + SecretKey('anypayToken', () => ''), SecretKey('onramperApiKey', () => ''), ];