Skip to content

Commit

Permalink
add rsa, sber, external payment methods
Browse files Browse the repository at this point in the history
  • Loading branch information
yan committed Oct 10, 2024
1 parent af0737f commit 7a59788
Show file tree
Hide file tree
Showing 13 changed files with 320 additions and 153 deletions.
2 changes: 1 addition & 1 deletion example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '11.0'
# platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
8 changes: 4 additions & 4 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
331C8080294A63A400263BE5 = {
Expand Down Expand Up @@ -457,7 +457,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
Expand Down Expand Up @@ -569,7 +569,7 @@
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -638,7 +638,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion example/ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import UIKit
import Flutter

@UIApplicationMain
@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
Expand Down
113 changes: 67 additions & 46 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ class MyApp extends StatelessWidget {
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme:
ColorScheme.fromSeed(seedColor: Colors.deepPurple),
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'PaySelection-Flutter-SDK'),
home: const MyHomePage(
title: 'PaySelection-Flutter-SDK',
),
);
}
}
Expand All @@ -39,62 +40,82 @@ class _MyHomePageState extends State<MyHomePage> {
void initState() {
super.initState();

_pay().proceedResult((responseData) {
showDialog(
context: context,
builder: (builder) => ThreeDS(
url: responseData.redirectUrl ?? '',
)).then((value) => ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(
content: Text(value == true
? 'Success transaction'
: 'Fail transaction'))));

//for check transaction status use config.transactionStatus

// config.transactionStatus(TransactionStatusRequest(
// transactionId: responseData.transactionId ?? "",
// transactionSecretKey:
// responseData.transactionSecretKey ?? ""));


},
(errorCode) => ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(content: Text(errorCode))));
_pay().proceedResult(
(responseData) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
'Success transaction',
),
),
);
// showDialog(
// context: context,
// builder: (builder) => ThreeDS(
// url: responseData.redirectUrl ?? '',
// )).then(
// (value) => ScaffoldMessenger.of(context).showSnackBar(
// SnackBar(
// content: Text(
// value == true ? 'Success transaction' : 'Fail transaction'),
// ),
// ),
// );

// for check transaction status use config.transactionStatus
//
// config.transactionStatus(TransactionStatusRequest(
// transactionId: responseData.transactionId ?? "",
// transactionSecretKey:
// responseData.transactionSecretKey ?? ""));
},
(errorCode) => ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(errorCode),
),
),
);
}

Future<BaseResponse<PublicPayResponse>> _pay() async {
config = PaySelectionSDK(PaySelectionConfig.credential(
config = PaySelectionSDK(
PaySelectionConfig.credential(
publicKey:
'04bd07d3547bd1f90ddbd985feaaec59420cabd082ff5215f34fd1c89c5d8562e8f5e97a5df87d7c99bc6f16a946319f61f9eb3ef7cf355d62469edb96c8bea09e',
'04bd07d3547bd1f90ddbd985feaaec59420cabd082ff5215f34fd1c89c5d8562e8f5e97a5df87d7c99bc6f16a946319f61f9eb3ef7cf355d62469edb96c8bea09e',
publicRsaKey:
'LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQ0lqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FnOEFNSUlDQ2dLQ0FnRUFxbk56eXlwR1R6cENZeDlzMnh6RQpaQ3B4eVkyL2YrbWljb0drWW1rV0M5Szl2SlIvcEtUL0VOUThCT1hIRkFBYW5Mb05PNzVLcmJUQ3Z5Y2pXbkJGCnhYQlJZY2NWeGsxaVB0c0VKbkNlcThmYXMwa2dYMFgzLzFnTFdvbkhheVdTUUl5emFTMXMrWUdsNEJyd2s5c08KTTQyZlk0dkM1WGptU1YxUDNlN2pvNUN1d2hxL2ljUkxZbTg1MXBYRTRiZ3FZYS96NEsrbXhUcWJvdC94b3lhTQpxSmlIOS9EUnQveTc0Z2t6Q0VIRThGQ0M4TkJlVXZUckRWbnlSQ0dtSlpVTDh0QnhPd1N3Ty94M1lzZi9CNU9vCkVjbllWdjVSQmF1MDl4VmFGTFN5QkZiRUsvZnRDUktFeUNQbnpYS2FnbTQ3T2dROEIvTkdhQ0cxRmdVOUhJb2gKd093TmsycWY1NTRPR21Oa0E3MnZCR1E0RTZ4TldUSnFJQWhOTUJQTjFMZGdRNXZTamszTUVJRHQ3Y3FEZzhFRwpCNU0vVS9VT2lVU2tXWmFtR3pXOVZFbkJhRFdWZFpxVVpTc0d0aCtJM093NGRPUUxiZG4rdzljYlpHLzR2VmwvCmFKdTdlQlZ2WVhEL0o0TnIzMk5RZ1o2YzlpMCtNU3RwWFUxMlJ4bzhJK1hCNVpZUTkzNE5iVXJoeDBuMlJhQk0KbGtlSTFtbE1ncWI3ME9BRk5zaDUyNUFIL3k5OVpJTzhsR0RqVEpSdDlKZzdGNVFmUEVWekRIbXdxdy9FaFFjQwpjVG5QaGRLOE53NDJ3QldIVDhXYXg4Y1NxYTdwRytTM2JOYkZvUVJlU1dvK2pzV0JNOU1NemJvckNqYWE1UzRNCnNCV0UyN2FRSElVMU5sTGNqK0laUldzQ0F3RUFBUT09Ci0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQo=',
xSiteId: '21044',
isDebug: true)
isDebug: true,
),
);

var request = PublicPayRequest(
orderId: "SAM_SDK_3",
description: "test payment",
paymentMethod: PaymentMethod.cryptogram,
paymentMethod: PaymentMethod.externalForm,
amount: '10',
currency: 'RUB',
cardDetails: CardDetails(
cardHolderName: "TEST CARD",
cardNumber: "5260111696757102", //success card
// cardNumber: '2408684917843810', //fail card
cvc: "123",
expMonth: "12",
expYear: "24"),
// cardDetails: CardDetails(
// cardHolderName: "TEST CARD",
// cardNumber: "5260111696757102",
// //success card
// // cardNumber: '2408684917843810', //fail card
// cvc: "123",
// expMonth: "12",
// expYear: "24",
// ),
customerInfo: CustomerInfo(
email: "[email protected]",
phone: "+19991231212",
language: "en",
address: "string",
town: "string",
zip: "string",
country: "USA",
isSendReceipt: false,
receiptEmail: '[email protected]',
ip: '8.8.8.8'),
email: "[email protected]",
phone: "+19991231212",
language: "en",
address: "string",
town: "string",
zip: "string",
country: "USA",
isSendReceipt: false,
receiptEmail: '[email protected]',
ip: '8.8.8.8',
),
rebillFlag: false,
);

Expand Down
Loading

0 comments on commit 7a59788

Please sign in to comment.