mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 03:59:23 +00:00
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>
This commit is contained in:
parent
6e01bbb1a5
commit
30bac3cb6c
2 changed files with 9 additions and 2 deletions
|
@ -5,11 +5,13 @@ import 'package:http/http.dart';
|
||||||
import 'package:cw_core/crypto_currency.dart';
|
import 'package:cw_core/crypto_currency.dart';
|
||||||
import 'package:cake_wallet/anypay/any_pay_payment.dart';
|
import 'package:cake_wallet/anypay/any_pay_payment.dart';
|
||||||
import 'package:cake_wallet/anypay/any_pay_trasnaction.dart';
|
import 'package:cake_wallet/anypay/any_pay_trasnaction.dart';
|
||||||
|
import 'package:cake_wallet/.secrets.g.dart' as secrets;
|
||||||
|
|
||||||
class AnyPayApi {
|
class AnyPayApi {
|
||||||
static const contentTypePaymentRequest = 'application/payment-request';
|
static const contentTypePaymentRequest = 'application/payment-request';
|
||||||
static const contentTypePayment = 'application/payment';
|
static const contentTypePayment = 'application/payment';
|
||||||
static const xPayproVersion = '2';
|
static const xPayproVersion = '2';
|
||||||
|
static const anypayToken = secrets.anypayToken;
|
||||||
|
|
||||||
static String chainByScheme(String scheme) {
|
static String chainByScheme(String scheme) {
|
||||||
switch (scheme.toLowerCase()) {
|
switch (scheme.toLowerCase()) {
|
||||||
|
@ -44,7 +46,9 @@ class AnyPayApi {
|
||||||
final headers = <String, String>{
|
final headers = <String, String>{
|
||||||
'Content-Type': contentTypePaymentRequest,
|
'Content-Type': contentTypePaymentRequest,
|
||||||
'X-Paypro-Version': xPayproVersion,
|
'X-Paypro-Version': xPayproVersion,
|
||||||
'Accept': '*/*',};
|
'Accept': '*/*',
|
||||||
|
'x-wallet': 'cake',
|
||||||
|
'x-wallet-token': anypayToken,};
|
||||||
final body = <String, dynamic>{
|
final body = <String, dynamic>{
|
||||||
'chain': chainByScheme(scheme),
|
'chain': chainByScheme(scheme),
|
||||||
'currency': currencyByScheme(scheme).title};
|
'currency': currencyByScheme(scheme).title};
|
||||||
|
@ -66,7 +70,9 @@ class AnyPayApi {
|
||||||
final headers = <String, String>{
|
final headers = <String, String>{
|
||||||
'Content-Type': contentTypePayment,
|
'Content-Type': contentTypePayment,
|
||||||
'X-Paypro-Version': xPayproVersion,
|
'X-Paypro-Version': xPayproVersion,
|
||||||
'Accept': '*/*',};
|
'Accept': '*/*',
|
||||||
|
'x-wallet': 'cake',
|
||||||
|
'x-wallet-token': anypayToken,};
|
||||||
final body = <String, dynamic>{
|
final body = <String, dynamic>{
|
||||||
'chain': chain,
|
'chain': chain,
|
||||||
'currency': currency,
|
'currency': currency,
|
||||||
|
|
|
@ -26,6 +26,7 @@ class SecretKey {
|
||||||
SecretKey('sideShiftAffiliateId', () => ''),
|
SecretKey('sideShiftAffiliateId', () => ''),
|
||||||
SecretKey('sideShiftApiKey', () => ''),
|
SecretKey('sideShiftApiKey', () => ''),
|
||||||
SecretKey('simpleSwapApiKey', () => ''),
|
SecretKey('simpleSwapApiKey', () => ''),
|
||||||
|
SecretKey('anypayToken', () => ''),
|
||||||
SecretKey('onramperApiKey', () => ''),
|
SecretKey('onramperApiKey', () => ''),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue