-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from pokepay/feature/credit-card-api
Credit Card Endpoints
- Loading branch information
Showing
15 changed files
with
428 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
|
||
import 'package:pokepay_sdk/responses/credit_card.dart'; | ||
import 'package:pokepay_sdk/responses/paginated_credit_cards.dart'; | ||
|
||
import '../pokepay_sdk.dart'; | ||
import '../responses.dart'; | ||
|
||
extension CreditCardAPI on PokepayAPI { | ||
Future<CreditCard> createCreditCard({ | ||
required String token, | ||
bool? isCardholderNameSpecified, | ||
String? organizationCode, | ||
required String userId, | ||
}) async { | ||
return await invokeMethod<CreditCard>( | ||
(j) => CreditCard.fromJson(j), | ||
'createCreditCard', | ||
{ | ||
'env': this.env.index, | ||
'accessToken': this.accessToken, | ||
'token': token, | ||
'isCardholderNameSpecified': isCardholderNameSpecified, | ||
'organizationCode': organizationCode, | ||
'userId': userId, | ||
}, | ||
); | ||
} | ||
|
||
Future<NoContent> deleteCreditCard({ | ||
required String cardRegisteredAt, | ||
String? organizationCode, | ||
required String userId, | ||
}) async { | ||
return await invokeMethod<NoContent>( | ||
(j) => NoContent.fromJson(j), | ||
'deleteCreditCard', | ||
{ | ||
'env': this.env.index, | ||
'accessToken': this.accessToken, | ||
'cardRegisteredAt': cardRegisteredAt, | ||
'organizationCode': organizationCode, | ||
'userId': userId, | ||
}, | ||
); | ||
} | ||
|
||
Future<PaginatedCreditCards> getCreditCards({ | ||
required String userId, | ||
String? before, | ||
String? after, | ||
int? perPage, | ||
String? organizationCode, | ||
}) async { | ||
return await invokeMethod<PaginatedCreditCards>( | ||
(j) => PaginatedCreditCards.fromJson(j), | ||
'getCreditCards', | ||
{ | ||
'env': this.env.index, | ||
'accessToken': this.accessToken, | ||
'userId': userId, | ||
'before': before, | ||
'after': after, | ||
'perPage': perPage, | ||
'organizationCode': organizationCode, | ||
}, | ||
); | ||
} | ||
|
||
Future<String> TopupWithCreditCardMdkToken({ | ||
required String userId, | ||
required String token, | ||
required String accountId, | ||
required int amount, | ||
String? organizationCode, | ||
bool? isCardholderNameSpecified, | ||
}) async { | ||
return await invokeMethod<String>( | ||
(j) => j, | ||
'topupWithCreditCardMdkToken', | ||
{ | ||
'env': this.env.index, | ||
'accessToken': this.accessToken, | ||
'userId': userId, | ||
'token': token, | ||
'accountId': accountId, | ||
'amount': amount, | ||
'organizationCode': organizationCode, | ||
'isCardholderNameSpecified': isCardholderNameSpecified, | ||
}, | ||
); | ||
} | ||
|
||
Future<String> TopupWithCreditCardMembership({ | ||
required String userId, | ||
required String cardRegisteredAt, | ||
required String accountId, | ||
required int amount, | ||
bool? deleteCardIfAuthFail, | ||
String? organizationCode, | ||
}) async { | ||
return await invokeMethod<String>( | ||
(j) => j, | ||
'topupWithCreditCardMembership', | ||
{ | ||
'env': this.env.index, | ||
'accessToken': this.accessToken, | ||
'userId': userId, | ||
'cardRegisteredAt': cardRegisteredAt, | ||
'accountId': accountId, | ||
'amount': amount, | ||
'deleteCardIfAuthFail': deleteCardIfAuthFail, | ||
'organizationCode': organizationCode, | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import 'package:json_annotation/json_annotation.dart'; | ||
|
||
part 'credit_card.g.dart'; | ||
|
||
@JsonSerializable() | ||
class CreditCard { | ||
final String cardNumber; | ||
final String registeredAt; | ||
|
||
CreditCard({ | ||
required this.cardNumber, | ||
required this.registeredAt, | ||
}); | ||
|
||
factory CreditCard.fromJson(Map<String, dynamic> json) => _$CreditCardFromJson(json); | ||
|
||
Map<String, dynamic> toJson() => _$CreditCardToJson(this); | ||
|
||
@override | ||
String toString() => this.toJson().toString(); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.