Coder Social home page Coder Social logo

idrats / yandex_kassa Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 19.0 93 KB

Yandex.Kassa (Yandex.Checkout) plugin for both Android and iOS platforms

License: BSD 3-Clause "New" or "Revised" License

Kotlin 22.38% Ruby 6.63% Swift 27.23% Objective-C 0.95% Dart 42.81%

yandex_kassa's People

Contributors

idrats avatar reetou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

yandex_kassa's Issues

showLogs (Boolean), googlePayTestEnvironment (Boolean) и mockConfiguration (MockConfiguration)

Нельзя использовать showLogs (Boolean) и googlePayTestEnvironment (Boolean) (менять WalletConstants.ENVIRONMENT_TEST на WalletConstants.ENVIRONMENT_PRODUCTION в настройках кассы) без обязательного указания еще и mockConfiguration, которая сводит на нет реальную оплату через Google Pay/отображение логов.

Wrong Amount sum 3725.93 convert to 3725.92

Актуально только для iOS
Сумма 3725.93 при запуске платежа превращается в 3725.92
при этом
3725.934 = 3725.92
а
3725.935 = 3725.94

image

This is Test Token

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()))
        ]),
      ),
    );
  }
}

screen

Add support for web

Your package works on Android and iOS platforms. It's good, but this feature would be helpful on Web platform too.

Thank you!

confirm3dsCheckout

Привет, в этом методе кажется 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.

Спасибо за плагин/труд.

Язык

Как можно поменять язык на русский, чтобы элементы показывались не на английском?

Проблема с вызовом confirm3dsCheckout

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)

fetchGooglePayParameters

Ошибка при настройке выбора платежных сетей 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)

Could not download checkout-3.0.4.aar (com.yandex.money:checkout:3.0.4)

После добавления 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.