fix
This commit is contained in:
@@ -52,7 +52,11 @@ class ApiService {
|
||||
try {
|
||||
final response = await _dio.post(
|
||||
"$baseUrl/auth/client/login",
|
||||
data: {"phone": phone, "model": model, "systemId": systemId},
|
||||
data: {
|
||||
"phone": phone,
|
||||
"model": model,
|
||||
"systemId": systemId
|
||||
},
|
||||
);
|
||||
|
||||
if (response.statusCode == 200 || response.statusCode == 201) {
|
||||
@@ -177,13 +181,9 @@ class ApiService {
|
||||
cardsJson.map((cardJson) async {
|
||||
return PaymentCard(
|
||||
id: cardJson['id'],
|
||||
clientId: cardJson['clientId'],
|
||||
expirationMonth: cardJson['expirationMonth'],
|
||||
expirationYear: cardJson['expirationYear'],
|
||||
cardHolder: cardJson['cardHolder'],
|
||||
bindingId: cardJson['bindingId'],
|
||||
cardLastNumber: cardJson['cardLastNumber'],
|
||||
isMain: cardJson['isMain'],
|
||||
type: cardJson['cardType'],
|
||||
);
|
||||
}),
|
||||
);
|
||||
@@ -517,13 +517,13 @@ class ApiService {
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> activateSubscription({required int optionId}) async {
|
||||
Future<bool> activateSubscription({required int optionId, required int cardId}) async {
|
||||
const url = "$baseUrl/scootersubscription/client";
|
||||
|
||||
try {
|
||||
final response = await _dio.post(
|
||||
url,
|
||||
data: {"optionId": optionId},
|
||||
data: {"optionId": optionId, "cardId": cardId},
|
||||
options: await _getAuthOptions(),
|
||||
);
|
||||
|
||||
@@ -539,31 +539,25 @@ class ApiService {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> addPaymentCard({
|
||||
required String cardNumber,
|
||||
required String cardHolder,
|
||||
required int expirationMonth,
|
||||
required int expirationYear,
|
||||
required String cvv,
|
||||
}) async {
|
||||
Future<Map<String, dynamic>> addPaymentCard() async {
|
||||
const url = "$baseUrl/client/card";
|
||||
final cleanCardNumber = cardNumber.replaceAll(' ', '');
|
||||
/*final cleanCardNumber = cardNumber.replaceAll(' ', '');*/
|
||||
|
||||
try {
|
||||
final response = await _dio.post(
|
||||
url,
|
||||
data: {
|
||||
/*data: {
|
||||
"cardNumber": cleanCardNumber,
|
||||
"cardHolder": cardHolder,
|
||||
"expirationMonth": expirationMonth,
|
||||
"expirationYear": expirationYear,
|
||||
"cvv": cvv,
|
||||
},
|
||||
},*/
|
||||
options: await _getAuthOptions(),
|
||||
);
|
||||
|
||||
if (response.statusCode == 200 || response.statusCode == 201) {
|
||||
return;
|
||||
return response.data;
|
||||
}
|
||||
|
||||
throw AuthException('Непредвиденный статус: ${response.statusCode}', 0);
|
||||
|
||||
Reference in New Issue
Block a user