idrats / yandex_kassa Goto Github PK
View Code? Open in Web Editor NEWYandex.Kassa (Yandex.Checkout) plugin for both Android and iOS platforms
License: BSD 3-Clause "New" or "Revised" License
Yandex.Kassa (Yandex.Checkout) plugin for both Android and iOS platforms
License: BSD 3-Clause "New" or "Revised" License
Карту можно ввести только из буфера обмена, на попытки нажатия клавиш не реагирует. В Android все корректно работает.
Проблема в плагине или в https://github.com/yandex-money/yandex-checkout-payments-swift?
https://github.com/kcrebound/yandex_kassa_example - вот тут пример, 4.1.0 версия
В примере используется взаимодействие с api с секретным ключом из приложения, это не должно быть через backend реаилизовано?
Нельзя использовать showLogs (Boolean) и googlePayTestEnvironment (Boolean) (менять WalletConstants.ENVIRONMENT_TEST на WalletConstants.ENVIRONMENT_PRODUCTION в настройках кассы) без обязательного указания еще и mockConfiguration, которая сводит на нет реальную оплату через Google Pay/отображение логов.
How to do Not Test Token
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:yandex_kassa/yandex_kassa.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
const shopId = 'my_shop_id';
const clientAppKey = 'my_key';
class _MyAppState extends State<MyApp> {
final paymentParameters = PaymentParameters(
amount: Amount(5),
purchaseName: 'Product name',
purchaseDescription: 'Some detailed description of current purchase',
clientApplicationKey: clientAppKey,
iosColorScheme: IosColorScheme.redOrange,
paymentMethods: [PaymentMethod.bankCard, PaymentMethod.sberbank],
androidColorScheme: IosColorScheme.redOrange,
googlePayParameters: GooglePayCardNetwork.values,
shopId: shopId,
);
TokenizationResult tokenizationResult;
Map paymentResult;
bool loading = false;
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
localizationsDelegates: [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: [
const Locale('en', 'US'),
const Locale('ru', 'RU'),
],
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Stack(children: [
Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Spacer(),
Container(
child: OutlineButton(
child: const Text('Open payment screen'),
onPressed: () async {
final result = await YandexKassa.startCheckout(
paymentParameters);
setState(() {
tokenizationResult = result;
});
})),
if (tokenizationResult != null) ...[
(tokenizationResult.success
? Text(
'Token has been successfully received\nToken: ${tokenizationResult?.paymentData?.token ?? ""}\nPayment method: ${tokenizationResult?.paymentData?.paymentMethod ?? ""}',
style: TextStyle(
color: Colors.green,
fontSize: 16,
fontWeight: FontWeight.bold),
textAlign: TextAlign.center,
)
: Text(
'An error occured\n${tokenizationResult.error}',
style: TextStyle(
color: Colors.redAccent,
fontSize: 16,
fontWeight: FontWeight.bold),
textAlign: TextAlign.center,
)),
if (paymentResult != null)
Text(
paymentResult.toString(),
style: TextStyle(
color: Colors.green,
fontSize: 16,
fontWeight: FontWeight.bold),
textAlign: TextAlign.center,
)
],
Spacer(),
])),
if (loading)
Container(
width: double.infinity,
height: double.infinity,
color: Colors.black26,
child: Center(child: CircularProgressIndicator()))
]),
),
);
}
}
Your package works on Android and iOS platforms. It's good, but this feature would be helpful on Web platform too.
Thank you!
Привет, в этом методе кажется paymentParameters вообще не нужен, также без строгого каста в <String, dynamic> вот эта строка 25/kassa.dart:
..addAll({"confirmationUrl": confirmationUrl.toString()})));
выдает исключение:
Unhandled Exception: type '_InternalLinkedHashMap<dynamic, dynamic>' is not a subtype of type 'Map<String, dynamic>' of 'other'
Помогло:
..addAll(<String, dynamic>{"confirmationUrl": confirmationUrl.toString()})));
В YandexKassa.kt/строка 93:
if (data != null && callback != null) callback!!.success(Checkout.createTokenizationResult(data))
Ловит нулл и вылетает при обработке confirm3dsCheckout, со startCheckout нормально.
На iOS 10.0 с версией 3.61 и 4.0.0: confirm3dsCheckout вообще не запускается, в отличии от startCheckout.
Спасибо за плагин/труд.
Ребята меняют бренд, думаю плагин тоже должен переехать, когда основые библиотеки переедут
что еще
Как можно поменять язык на русский, чтобы элементы показывались не на английском?
final confirmationUrl = Uri.parse(payment.confirmationUrl);
await YandexKassa.confirm3dsCheckout(paymentParameters, confirmationUrl);
Вызывает проблему
E/flutter ( 8265): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: type '_InternalLinkedHashMap<dynamic, dynamic>' is not a subtype of type 'Map<String, dynamic>' of 'other'
E/flutter ( 8265): #0 MapMixin.addAll (dart:collection/maps.dart)
E/flutter ( 8265): #1 YandexKassa.confirm3dsCheckout (package:yandex_kassa/kassa.dart:30:19)
pod install --repo-update
[!] Unable to find a specification for YandexCheckoutPayments
depended upon by yandex_kassa
You have either:
pod repo update
or with pod install --repo-update
.Ошибка при настройке выбора платежных сетей Google pay на уровне передачи из Дарта или в Котлине, не смотрел особо.
Добавил напрямую в YandexKassaPlugin, чтобы не мучаться:
val gpayAllowed: HashSet = HashSet()
gpayAllowed.add(GooglePayCardNetwork.AMEX)
gpayAllowed.add(GooglePayCardNetwork.DISCOVER)
gpayAllowed.add(GooglePayCardNetwork.JCB)
gpayAllowed.add(GooglePayCardNetwork.MASTERCARD)
gpayAllowed.add(GooglePayCardNetwork.VISA)
gpayAllowed.add(GooglePayCardNetwork.INTERAC)
gpayAllowed.add(GooglePayCardNetwork.OTHER)
и
GooglePayParameters(gpayAllowed)
После добавления yandex_kassa: ^1.0.2 в зависимости("flutter pub add yandex_kassa"), приложение не запускается. Ошибка :
Execution failed for task ':app:checkDebugAarMetadata'.
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not download checkout-3.0.4.aar (com.yandex.money:checkout:3.0.4)
> Could not get resource 'https://dl.bintray.com/yandex-money/maven/com/yandex/money/checkout/3.0.4/checkout-3.0.4.aar'.
> Could not GET 'https://dl.bintray.com/yandex-money/maven/com/yandex/money/checkout/3.0.4/checkout-3.0.4.aar'. Received status code 403 from server: Forbidden
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.