From 7cdddb967356be605cfa5d7c7c944050062e76f3 Mon Sep 17 00:00:00 2001 From: DanRidh Date: Tue, 6 Aug 2024 14:33:44 +0900 Subject: [PATCH 1/4] add credit card api and veritrans api --- android/build.gradle | 2 +- .../pokepay/pokepay_sdk/PokepaySdkPlugin.java | 98 ++++++++++++++- ios/Classes/SwiftPokepaySdkPlugin.swift | 56 +++++++++ ios/pokepay_sdk.podspec | 4 +- lib/bank_api/credit_card.dart | 116 ++++++++++++++++++ lib/pokepay_sdk.dart | 1 + lib/responses/credit_card.dart | 21 ++++ lib/responses/credit_card.g.dart | 17 +++ lib/responses/paginated_credit_cards.dart | 29 +++++ lib/responses/paginated_credit_cards.g.dart | 27 ++++ lib/responses/veritrans_token.dart | 19 +++ lib/responses/veritrans_token.g.dart | 15 +++ lib/veritrans_api/veritrans.dart | 23 ++++ 13 files changed, 423 insertions(+), 5 deletions(-) create mode 100644 lib/bank_api/credit_card.dart create mode 100644 lib/responses/credit_card.dart create mode 100644 lib/responses/credit_card.g.dart create mode 100644 lib/responses/paginated_credit_cards.dart create mode 100644 lib/responses/paginated_credit_cards.g.dart create mode 100644 lib/responses/veritrans_token.dart create mode 100644 lib/responses/veritrans_token.g.dart create mode 100644 lib/veritrans_api/veritrans.dart diff --git a/android/build.gradle b/android/build.gradle index 3888197..6889a7f 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -44,5 +44,5 @@ dependencies { implementation 'com.fasterxml.jackson.core:jackson-annotations:2.11.1' implementation 'com.fasterxml.jackson.core:jackson-core:2.11.1' implementation 'com.fasterxml.jackson.core:jackson-databind:2.11.1' - implementation 'jp.pocket-change.pokepay.android-sdk:pokepaylib:2.0.14' + implementation 'jp.pocket-change.pokepay.android-sdk:pokepaylib:2.0.15' } diff --git a/android/src/main/java/jp/pokepay/pokepay_sdk/PokepaySdkPlugin.java b/android/src/main/java/jp/pokepay/pokepay_sdk/PokepaySdkPlugin.java index 777eee9..dbe15f7 100644 --- a/android/src/main/java/jp/pokepay/pokepay_sdk/PokepaySdkPlugin.java +++ b/android/src/main/java/jp/pokepay/pokepay_sdk/PokepaySdkPlugin.java @@ -77,6 +77,11 @@ import jp.pokepay.pokepaylib.BankAPI.User.GetBankPay; import jp.pokepay.pokepaylib.BankAPI.User.DeleteBankPay; import jp.pokepay.pokepaylib.BankAPI.User.BankPayTopUp; +import jp.pokepay.pokepaylib.BankAPI.autogen.requests.CreateCreditCard; +import jp.pokepay.pokepaylib.BankAPI.autogen.requests.DeleteCreditCard; +import jp.pokepay.pokepaylib.BankAPI.autogen.requests.GetCreditCards; +import jp.pokepay.pokepaylib.BankAPI.autogen.requests.TopupWithCreditCardMdkToken; +import jp.pokepay.pokepaylib.BankAPI.autogen.requests.TopupWithCreditCardMembership; import jp.pokepay.pokepaylib.Env; import jp.pokepay.pokepaylib.JsonConverter; import jp.pokepay.pokepaylib.MessagingAPI.GetMessage; @@ -87,6 +92,7 @@ import jp.pokepay.pokepaylib.OAuthAPI.OAuthRequestError; import jp.pokepay.pokepaylib.OAuthAPI.Token.ExchangeAuthCode; import jp.pokepay.pokepaylib.OAuthAPI.Token.RefreshAccessToken; +import jp.pokepay.pokepaylib.ExternalServiceAPI.Veritrans.GetVeritransToken; import jp.pokepay.pokepaylib.Parameters.TransactionStrategy; import jp.pokepay.pokepaylib.Parameters.Gender; import jp.pokepay.pokepaylib.Parameters.Product; @@ -122,6 +128,9 @@ import jp.pokepay.pokepaylib.Responses.BankPayRedirectUrl; import jp.pokepay.pokepaylib.Responses.IdentificationResult; import jp.pokepay.pokepaylib.Responses.AccountCampaignPointAmounts; +import jp.pokepay.pokepaylib.Responses.VeritransToken; +import jp.pokepay.pokepaylib.BankAPI.autogen.responses.CreditCard; +import jp.pokepay.pokepaylib.BankAPI.autogen.responses.PaginatedCreditCards;; import jp.pokepay.pokepaylib.TokenInfo; /** PokepaySdkPlugin */ @@ -948,7 +957,7 @@ private TaskResult invokeMethod() { BankPayTopUp req = new BankPayTopUp(id, accountId, bankId, amount, requestId); Pokepay.setEnv(env); UserTransaction res = req.send(accessToken); - return new TaskResult(null, res.toString()); + return new TaskResult(null, res.toString()); } case "deleteBankPay": { Env env = flutterEnvToSDKEnv((int)call.argument("env")); @@ -986,7 +995,92 @@ private TaskResult invokeMethod() { GetAccountCampaignPointAmounts req = new GetAccountCampaignPointAmounts(accountId, campaignId); Pokepay.setEnv(env); AccountCampaignPointAmounts res = req.send(accessToken); - return new TaskResult(null, res.toString()); + return new TaskResult(null, res.toString()); + } + case "createCreditCard": { + Env env = flutterEnvToSDKEnv((int)call.argument("env")); + String accessToken = call.argument("accessToken"); + String token = call.argument("token"); + Boolean isCardholderNameSpecified = call.argument("isCardholderNameSpecified"); + String organizationCode = call.argument("organizationCode"); + String userId = call.argument("userId"); + + CreateCreditCard req = new CreateCreditCard(userId, token, organizationCode); + + if(isCardholderNameSpecified != null){ + req.isCardholderNameSpecified(isCardholderNameSpecified); + } + + Pokepay.setEnv(env); + CreditCard res = req.send(accessToken); + return new TaskResult(null, res.toString()); + } + case "deleteCreditCard": { + Env env = flutterEnvToSDKEnv((int)call.argument("env")); + String accessToken = call.argument("accessToken"); + String cardRegisteredAt = call.argument("cardRegisteredAt"); + String organizationCode = call.argument("organizationCode"); + String userId = call.argument("userId"); + + DeleteCreditCard req = new DeleteCreditCard(userId, cardRegisteredAt, organizationCode); + Pokepay.setEnv(env); + NoContent res = req.send(accessToken); + return new TaskResult(null, res.toString()); + } + case "getCreditCards": { + Env env = flutterEnvToSDKEnv((int)call.argument("env")); + String accessToken = call.argument("accessToken"); + String userId = call.argument("userId"); + String before = call.argument("before"); + String after = call.argument("after"); + Integer perPage = call.argument("perPage"); + String organizationCode = call.argument("organizationCode"); + + GetCreditCards req = new GetCreditCards(userId, organizationCode).before(before).after(after).perPage(perPage); + + Pokepay.setEnv(env); + PaginatedCreditCards res = req.send(accessToken); + return new TaskResult(null, res.toString()); + } + case "topupWithCreditCardMdkToken": { + Env env = flutterEnvToSDKEnv((int)call.argument("env")); + String accessToken = call.argument("accessToken"); + String userId = call.argument("userId"); + String token = call.argument("token"); + String accountId = call.argument("accountId"); + Integer amount = call.argument("amount"); + String organizationCode = call.argument("organizationCode"); + Boolean isCardholderNameSpecified = call.argument("isCardholderNameSpecified"); + + TopupWithCreditCardMdkToken req = new TopupWithCreditCardMdkToken(userId, token, accountId, amount, organizationCode).isCardholderNameSpecified(isCardholderNameSpecified); + Pokepay.setEnv(env); + String res = req.send(accessToken); + return new TaskResult(null, res); + } + case "topupWithCreditCardMembership": { + Env env = flutterEnvToSDKEnv((int)call.argument("env")); + String accessToken = call.argument("accessToken"); + String userId = call.argument("userId"); + String cardRegisteredAt = call.argument("cardRegisteredAt"); + String accountId = call.argument("accountId"); + Integer amount = call.argument("amount"); + Boolean deleteCardIfAuthFail = call.argument("deleteCardIfAuthFail"); + String organizationCode = call.argument("organizationCode"); + + TopupWithCreditCardMembership req = new TopupWithCreditCardMembership(userId, cardRegisteredAt, accountId, amount, organizationCode).deleteCardIfAuthFail(deleteCardIfAuthFail); + Pokepay.setEnv(env); + String res = req.send(accessToken); + return new TaskResult(null, res); + } + case "getVeritransToken": { + String cardNumber = call.argument("cardNumber"); + String cardExpiryDate = call.argument("cardExpiryDate"); + String securityCode = call.argument("securityCode"); + String tokenApiKey = call.argument("tokenApiKey"); + + GetVeritransToken req = new GetVeritransToken(cardNumber, cardExpiryDate, securityCode, tokenApiKey); + VeritransToken res = req.send(); + return new TaskResult(null, res.toString()); } default: throw new java.lang.UnsupportedOperationException(); diff --git a/ios/Classes/SwiftPokepaySdkPlugin.swift b/ios/Classes/SwiftPokepaySdkPlugin.swift index ecf26cc..f75863b 100644 --- a/ios/Classes/SwiftPokepaySdkPlugin.swift +++ b/ios/Classes/SwiftPokepaySdkPlugin.swift @@ -665,6 +665,62 @@ private class MethodCallTask { let accountId = args["accountId"] as! String let campaignId = args["campaignId"] as! String client.send(BankAPI.Account.GetAccountCampaignPointAmounts(accountId: accountId, campaignId: campaignId), handler: self.after) + case "createCreditCard": + let env = flutterEnvToSDKEnv(ienv: args["env"] as! Int32) + let accessToken = args["accessToken"] as! String + let client = Pokepay.Client(accessToken:accessToken, env: env) + let token = args["token"] as! String + let isCardholderNameSpecified = args["isCardholderNameSpecified"] as? Bool + let organizationCode = args["organizationCode"] as? String + let userId = args["userId"] as! String + client.send(BankAPI.CreditCard.CreateCreditCard(token: token, isCardholderNameSpecified: isCardholderNameSpecified, organizationCode: organizationCode, userId: userId), handler: self.after) + case "deleteCreditCard": + let env = flutterEnvToSDKEnv(ienv: args["env"] as! Int32) + let accessToken = args["accessToken"] as! String + let client = Pokepay.Client(accessToken:accessToken, env: env) + let cardRegisteredAt = args["cardRegisteredAt"] as! String + let organizationCode = args["organizationCode"] as? String + let userId = args["userId"] as! String + client.send(BankAPI.CreditCard.DeleteCreditCard(cardRegisteredAt: cardRegisteredAt, organizationCode: organizationCode, userId: userId), handler: self.after) + case "getCreditCards": + let env = flutterEnvToSDKEnv(ienv: args["env"] as! Int32) + let accessToken = args["accessToken"] as! String + let client = Pokepay.Client(accessToken:accessToken, env: env) + let userId = args["userId"] as! String + let before = args["before"] as? String + let after = args["after"] as? String + let perPage = args["perPage"] as? Int + let organizationCode = args["organizationCode"] as? String + client.send(BankAPI.CreditCard.GetCreditCards(userId: userId, before: before, after: after, perPage: perPage, organizationCode: organizationCode), handler: self.after) + case "topupWithCreditCardMdkToken": + let env = flutterEnvToSDKEnv(ienv: args["env"] as! Int32) + let accessToken = args["accessToken"] as! String + let client = Pokepay.Client(accessToken:accessToken, env: env) + let userId = args["userId"] as! String + let token = args["token"] as! String + let accountId = args["accountId"] as! String + let amount = args["amount"] as! Int + let organizationCode = args["organizationCode"] as? String + let isCardholderNameSpecified = args["isCardholderNameSpecified"] as? Bool + client.send(BankAPI.CreditCard.TopupWithCreditCardMdkToken(userId: userId, token: token, accountId: accountId, amount: amount, organizationCode: organizationCode, isCardholderNameSpecified: isCardholderNameSpecified), handler: self.after) + case "topupWithCreditCardMembership": + let env = flutterEnvToSDKEnv(ienv: args["env"] as! Int32) + let accessToken = args["accessToken"] as! String + let client = Pokepay.Client(accessToken:accessToken, env: env) + let userId = args["userId"] as! String + let cardRegisteredAt = args["cardRegisteredAt"] as! String + let accountId = args["accountId"] as! String + let amount = args["amount"] as! Int + let deleteCardIfAuthFail = args["deleteCardIfAuthFail"] as? Bool + let organizationCode = args["organizationCode"] as? String + client.send(BankAPI.CreditCard.TopupWithCreditCardMembership(userId: userId, cardRegisteredAt: cardRegisteredAt, accountId: accountId, amount: amount, deleteCardIfAuthFail: deleteCardIfAuthFail, organizationCode: organizationCode), handler: self.after) + case "getVeritransToken": + let veritransClient = Pokepay.VeritransClient() + let cardNumber = args["cardNumber"] as! String + let cardExpiryDate = args["cardExpiryDate"] as! String + let securityCode = args["securityCode"] as! String + let tokenApiKey = args["tokenApiKey"] as! String + veritransClient.send(VeritransAPI.Token.GetVeritransToken(cardNumber: cardNumber, cardExpiryDate: cardExpiryDate, securityCode: securityCode, tokenApiKey: tokenApiKey), handler: self.after) default: self.result(FlutterMethodNotImplemented) } diff --git a/ios/pokepay_sdk.podspec b/ios/pokepay_sdk.podspec index 1679444..07f1e7c 100644 --- a/ios/pokepay_sdk.podspec +++ b/ios/pokepay_sdk.podspec @@ -4,7 +4,7 @@ # Pod::Spec.new do |s| s.name = 'pokepay_sdk' - s.version = '2.0.13' + s.version = '2.0.15' s.summary = 'Pokepay flutter SDK' s.description = <<-DESC Pokepay flutter SDK @@ -15,7 +15,7 @@ Pokepay flutter SDK s.source = { :path => '.' } s.source_files = 'Classes/**/*' s.dependency 'Flutter' - s.dependency 'Pokepay', '2.0.13' + s.dependency 'Pokepay', '2.0.15' s.platform = :ios, '12.0' # Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported. diff --git a/lib/bank_api/credit_card.dart b/lib/bank_api/credit_card.dart new file mode 100644 index 0000000..bc5f310 --- /dev/null +++ b/lib/bank_api/credit_card.dart @@ -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 createCreditCard({ + required String token, + bool? isCardholderNameSpecified, + String? organizationCode, + required String userId, + }) async { + return await invokeMethod( + (j) => CreditCard.fromJson(j), + 'createCreditCard', + { + 'env': this.env.index, + 'accessToken': this.accessToken, + 'token': token, + 'isCardholderNameSpecified': isCardholderNameSpecified, + 'organizationCode': organizationCode, + 'userId': userId, + }, + ); + } + + Future deleteCreditCard({ + required String cardRegisteredAt, + String? organizationCode, + required String userId, + }) async { + return await invokeMethod( + (j) => NoContent.fromJson(j), + 'deleteCreditCard', + { + 'env': this.env.index, + 'accessToken': this.accessToken, + 'cardRegisteredAt': cardRegisteredAt, + 'organizationCode': organizationCode, + 'userId': userId, + }, + ); + } + + Future getCreditCards({ + required String userId, + String? before, + String? after, + int? perPage, + String? organizationCode, + }) async { + return await invokeMethod( + (j) => PaginatedCreditCards.fromJson(j), + 'getCreditCards', + { + 'env': this.env.index, + 'accessToken': this.accessToken, + 'userId': userId, + 'before': before, + 'after': after, + 'perPage': perPage, + 'organizationCode': organizationCode, + }, + ); + } + + Future TopupWithCreditCardMdkToken({ + required String userId, + required String token, + required String accountId, + required int amount, + String? organizationCode, + bool? isCardholderNameSpecified, + }) async { + return await invokeMethod( + (j) => j, + 'topupWithCreditCardMdkToken', + { + 'env': this.env.index, + 'accessToken': this.accessToken, + 'userId': userId, + 'token': token, + 'accountId': accountId, + 'amount': amount, + 'organizationCode': organizationCode, + 'isCardholderNameSpecified': isCardholderNameSpecified, + }, + ); + } + + Future TopupWithCreditCardMembership({ + required String userId, + required String cardRegisteredAt, + required String accountId, + required int amount, + bool? deleteCardIfAuthFail, + String? organizationCode, + }) async { + return await invokeMethod( + (j) => j, + 'topupWithCreditCardMembership', + { + 'env': this.env.index, + 'accessToken': this.accessToken, + 'userId': userId, + 'cardRegisteredAt': cardRegisteredAt, + 'accountId': accountId, + 'amount': amount, + 'deleteCardIfAuthFail': deleteCardIfAuthFail, + 'organizationCode': organizationCode, + }, + ); + } +} diff --git a/lib/pokepay_sdk.dart b/lib/pokepay_sdk.dart index 4dd3847..9f72f6f 100644 --- a/lib/pokepay_sdk.dart +++ b/lib/pokepay_sdk.dart @@ -120,6 +120,7 @@ Future invokeMethod(T factory(dynamic data), logger.d("methodName: " + methodName + " args: " + args.toString()); final String json = await channel.invokeMethod(methodName, args); logger.d("json: " + json); + if (T == String) return factory(json); return factory(jsonDecode(json)); } on PlatformException catch (e) { final String code = e.code; diff --git a/lib/responses/credit_card.dart b/lib/responses/credit_card.dart new file mode 100644 index 0000000..4b6ecf8 --- /dev/null +++ b/lib/responses/credit_card.dart @@ -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 json) => _$CreditCardFromJson(json); + + Map toJson() => _$CreditCardToJson(this); + + @override + String toString() => this.toJson().toString(); +} diff --git a/lib/responses/credit_card.g.dart b/lib/responses/credit_card.g.dart new file mode 100644 index 0000000..ac2c94d --- /dev/null +++ b/lib/responses/credit_card.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'credit_card.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CreditCard _$CreditCardFromJson(Map json) => CreditCard( + cardNumber: json['card_number'] as String, + registeredAt: json['registered_at'] as String, + ); + +Map _$CreditCardToJson(CreditCard instance) => { + 'card_number': instance.cardNumber, + 'registered_at': instance.registeredAt, + }; diff --git a/lib/responses/paginated_credit_cards.dart b/lib/responses/paginated_credit_cards.dart new file mode 100644 index 0000000..32b1658 --- /dev/null +++ b/lib/responses/paginated_credit_cards.dart @@ -0,0 +1,29 @@ +import 'package:json_annotation/json_annotation.dart'; + +import 'credit_card.dart'; + +part 'paginated_credit_cards.g.dart'; + +@JsonSerializable() +class PaginatedCreditCards { + final int? perPage; + final int? count; + final String? next; + final String? prev; + final List items; + + PaginatedCreditCards({ + this.perPage, + this.count, + this.next, + this.prev, + required this.items, + }); + + factory PaginatedCreditCards.fromJson(Map json) => _$PaginatedCreditCardsFromJson(json); + + Map toJson() => _$PaginatedCreditCardsToJson(this); + + @override + String toString() => this.toJson().toString(); +} diff --git a/lib/responses/paginated_credit_cards.g.dart b/lib/responses/paginated_credit_cards.g.dart new file mode 100644 index 0000000..10460b4 --- /dev/null +++ b/lib/responses/paginated_credit_cards.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'paginated_credit_cards.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PaginatedCreditCards _$PaginatedCreditCardsFromJson(Map json) => + PaginatedCreditCards( + perPage: json['per_page'] as int?, + count: json['count'] as int?, + next: json['next'] as String?, + prev: json['prev'] as String?, + items: (json['items'] as List) + .map((e) => CreditCard.fromJson(e as Map)) + .toList(), + ); + +Map _$PaginatedCreditCardsToJson(PaginatedCreditCards instance) => + { + 'per_page': instance.perPage, + 'count': instance.count, + 'next': instance.next, + 'prev': instance.prev, + 'items': instance.items.map((e) => e.toJson()).toList(), + }; diff --git a/lib/responses/veritrans_token.dart b/lib/responses/veritrans_token.dart new file mode 100644 index 0000000..32e4c96 --- /dev/null +++ b/lib/responses/veritrans_token.dart @@ -0,0 +1,19 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'veritrans_token.g.dart'; + +@JsonSerializable() +class VeritransToken { + final String token; + + VeritransToken({ + required this.token, + }); + + factory VeritransToken.fromJson(Map json) => _$VeritransTokenFromJson(json); + + Map toJson() => _$VeritransTokenToJson(this); + + @override + String toString() => this.toJson().toString(); +} diff --git a/lib/responses/veritrans_token.g.dart b/lib/responses/veritrans_token.g.dart new file mode 100644 index 0000000..f2eaa88 --- /dev/null +++ b/lib/responses/veritrans_token.g.dart @@ -0,0 +1,15 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'veritrans_token.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +VeritransToken _$VeritransTokenFromJson(Map json) => VeritransToken( + token: json['token'] as String, + ); + +Map _$VeritransTokenToJson(VeritransToken instance) => { + 'token': instance.token, + }; diff --git a/lib/veritrans_api/veritrans.dart b/lib/veritrans_api/veritrans.dart new file mode 100644 index 0000000..1660ce0 --- /dev/null +++ b/lib/veritrans_api/veritrans.dart @@ -0,0 +1,23 @@ +import 'package:pokepay_sdk/responses/veritrans_token.dart'; + +import '../pokepay_sdk.dart'; + +class VeritransAPI { + Future getVeritransToken({ + required String cardNumber, + required String cardExpiryDate, + required String securityCode, + required String tokenApiKey, + }) async { + return await invokeMethod( + (j) => VeritransToken.fromJson(j), + 'getVeritransToken', + { + 'cardNumber': cardNumber, + 'cardExpiryDate': cardExpiryDate, + 'securityCode': securityCode, + 'tokenApiKey': tokenApiKey, + }, + ); + } +} \ No newline at end of file From ae2cc50a5a5ade8e9c326b38e430e39b61f664d7 Mon Sep 17 00:00:00 2001 From: DanRidh Date: Wed, 7 Aug 2024 14:27:26 +0900 Subject: [PATCH 2/4] add cardholderName to getVeritransToken --- android/build.gradle | 2 +- .../main/java/jp/pokepay/pokepay_sdk/PokepaySdkPlugin.java | 3 ++- ios/Classes/SwiftPokepaySdkPlugin.swift | 3 ++- ios/pokepay_sdk.podspec | 4 ++-- lib/veritrans_api/veritrans.dart | 2 ++ 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 6889a7f..cab4b76 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -44,5 +44,5 @@ dependencies { implementation 'com.fasterxml.jackson.core:jackson-annotations:2.11.1' implementation 'com.fasterxml.jackson.core:jackson-core:2.11.1' implementation 'com.fasterxml.jackson.core:jackson-databind:2.11.1' - implementation 'jp.pocket-change.pokepay.android-sdk:pokepaylib:2.0.15' + implementation 'jp.pocket-change.pokepay.android-sdk:pokepaylib:2.0.16' } diff --git a/android/src/main/java/jp/pokepay/pokepay_sdk/PokepaySdkPlugin.java b/android/src/main/java/jp/pokepay/pokepay_sdk/PokepaySdkPlugin.java index dbe15f7..1c9cce1 100644 --- a/android/src/main/java/jp/pokepay/pokepay_sdk/PokepaySdkPlugin.java +++ b/android/src/main/java/jp/pokepay/pokepay_sdk/PokepaySdkPlugin.java @@ -1077,8 +1077,9 @@ private TaskResult invokeMethod() { String cardExpiryDate = call.argument("cardExpiryDate"); String securityCode = call.argument("securityCode"); String tokenApiKey = call.argument("tokenApiKey"); + String cardholderName = call.argument("cardholderName"); - GetVeritransToken req = new GetVeritransToken(cardNumber, cardExpiryDate, securityCode, tokenApiKey); + GetVeritransToken req = new GetVeritransToken(cardNumber, cardExpiryDate, securityCode, tokenApiKey, cardholderName); VeritransToken res = req.send(); return new TaskResult(null, res.toString()); } diff --git a/ios/Classes/SwiftPokepaySdkPlugin.swift b/ios/Classes/SwiftPokepaySdkPlugin.swift index f75863b..e55b5fc 100644 --- a/ios/Classes/SwiftPokepaySdkPlugin.swift +++ b/ios/Classes/SwiftPokepaySdkPlugin.swift @@ -720,7 +720,8 @@ private class MethodCallTask { let cardExpiryDate = args["cardExpiryDate"] as! String let securityCode = args["securityCode"] as! String let tokenApiKey = args["tokenApiKey"] as! String - veritransClient.send(VeritransAPI.Token.GetVeritransToken(cardNumber: cardNumber, cardExpiryDate: cardExpiryDate, securityCode: securityCode, tokenApiKey: tokenApiKey), handler: self.after) + let cardholderName = args["cardholderName"] as! String + veritransClient.send(VeritransAPI.Token.GetVeritransToken(cardNumber: cardNumber, cardExpiryDate: cardExpiryDate, securityCode: securityCode, tokenApiKey: tokenApiKey, cardholderName: cardholderName), handler: self.after) default: self.result(FlutterMethodNotImplemented) } diff --git a/ios/pokepay_sdk.podspec b/ios/pokepay_sdk.podspec index 07f1e7c..10f4bfc 100644 --- a/ios/pokepay_sdk.podspec +++ b/ios/pokepay_sdk.podspec @@ -4,7 +4,7 @@ # Pod::Spec.new do |s| s.name = 'pokepay_sdk' - s.version = '2.0.15' + s.version = '2.0.16' s.summary = 'Pokepay flutter SDK' s.description = <<-DESC Pokepay flutter SDK @@ -15,7 +15,7 @@ Pokepay flutter SDK s.source = { :path => '.' } s.source_files = 'Classes/**/*' s.dependency 'Flutter' - s.dependency 'Pokepay', '2.0.15' + s.dependency 'Pokepay', '2.0.16' s.platform = :ios, '12.0' # Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported. diff --git a/lib/veritrans_api/veritrans.dart b/lib/veritrans_api/veritrans.dart index 1660ce0..a227449 100644 --- a/lib/veritrans_api/veritrans.dart +++ b/lib/veritrans_api/veritrans.dart @@ -8,6 +8,7 @@ class VeritransAPI { required String cardExpiryDate, required String securityCode, required String tokenApiKey, + required String cardholderName, }) async { return await invokeMethod( (j) => VeritransToken.fromJson(j), @@ -17,6 +18,7 @@ class VeritransAPI { 'cardExpiryDate': cardExpiryDate, 'securityCode': securityCode, 'tokenApiKey': tokenApiKey, + 'cardholderName': cardholderName, }, ); } From 8d883b52b35471ec3589967febe390d7c14cc124 Mon Sep 17 00:00:00 2001 From: DanRidh Date: Wed, 7 Aug 2024 14:29:08 +0900 Subject: [PATCH 3/4] update version to 2.0.16 --- CHANGELOG.md | 4 ++++ pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07e36d9..793da1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.16 +* Added `GetVeritransToken` endpoint +* Added CreditCard endpoints (create, get, delete, topup) + ## 2.0.14 * Fix `createAccountCPMToken` API to handle multiple key values in metadata diff --git a/pubspec.yaml b/pubspec.yaml index bdcce30..0d3b424 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: pokepay_sdk description: SDK for pokepay -version: 2.0.14 +version: 2.0.16 homepage: https://pay.pocket-change.jp/ environment: From fa1b48ec0ee9e69c38b17d9d6fb3a16aa49b76ba Mon Sep 17 00:00:00 2001 From: DanRidh Date: Wed, 7 Aug 2024 17:28:39 +0900 Subject: [PATCH 4/4] remove uneccessary null check --- .../main/java/jp/pokepay/pokepay_sdk/PokepaySdkPlugin.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/android/src/main/java/jp/pokepay/pokepay_sdk/PokepaySdkPlugin.java b/android/src/main/java/jp/pokepay/pokepay_sdk/PokepaySdkPlugin.java index 1c9cce1..9164bb8 100644 --- a/android/src/main/java/jp/pokepay/pokepay_sdk/PokepaySdkPlugin.java +++ b/android/src/main/java/jp/pokepay/pokepay_sdk/PokepaySdkPlugin.java @@ -1005,11 +1005,7 @@ private TaskResult invokeMethod() { String organizationCode = call.argument("organizationCode"); String userId = call.argument("userId"); - CreateCreditCard req = new CreateCreditCard(userId, token, organizationCode); - - if(isCardholderNameSpecified != null){ - req.isCardholderNameSpecified(isCardholderNameSpecified); - } + CreateCreditCard req = new CreateCreditCard(userId, token, organizationCode).isCardholderNameSpecified(isCardholderNameSpecified); Pokepay.setEnv(env); CreditCard res = req.send(accessToken);