Git Product home page Git Product logo

alipay_kit's People

Contributors

droplet-js avatar ra1no3o avatar sulisong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alipay_kit's Issues

android gradle编译失败

FAILURE: Build failed with an exception.

  • Where:
    Build file '/Users/ra1no3o/flutter/.pub-cache/hosted/pub.dartlang.org/alipay_kit-2.2.0-nullsafety/android/build.gradle' line: 22

  • What went wrong:
    A problem occurred evaluating root project 'alipay_kit'.

Project with path ':alipay_kit' could not be found in root project 'alipay_kit'.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 538ms

The plugin alipay_kit could not be built due to the issue above.

group 'io.github.v7lin.alipay_kit'
version '2.2.0'

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0'
    }
}

rootProject.allprojects {
    repositories {
        google()
        jcenter()

        // 私仓
        flatDir {
            dirs project(':alipay_kit').file('libs')
        }
    }
}

apply plugin: 'com.android.library'

android {
    compileSdkVersion 28

    defaultConfig {
        minSdkVersion 16

        // library 混淆 -> 随 library 引用,自动添加到 apk 打包混淆
        consumerProguardFiles 'consumer-rules.pro'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    flavorDimensions 'vendor'

    productFlavors {
        vendor {
            dimension 'vendor'

            // library 混淆 -> 随 library 引用,自动添加到 apk 打包混淆
            consumerProguardFiles 'consumer-vendor-rules.pro'
        }
    }
}

dependencies {
    implementation 'androidx.annotation:annotation:1.0.0'

    // v15.8.01
    vendorImplementation(name: 'alipaysdk-15.8.01.210112203525', ext: 'aar')
}

发现一个巨大的问题

作者写的这个插件很棒,不过这样存在巨大安全隐患就是把私钥暴露在app内部,一般流程私钥严禁写在app内部

支付宝坑

支付宝SDK坑爹统计

  • Android 支付宝,支付成功还能返回取消事件!!!你敢信???但这是真的!!!日了狗了!!!

gradle编译错误

Direct local .aar file dependencies are not supported when building an AAR. The resulting AAR would be broken because the classes and Android resources from any local .aar file dependencies would not be packaged in the resulting AAR. Previous versions of the Android Gradle Plugin produce broken AARs in this case too (despite not throwing this error). The following direct local .aar file dependencies of the :alipay_kit project caused this error: /Users/hhyy/.pub-cache/hosted/pub.flutter-io.cn/alipay_kit-1.1.0/android/libs/alipaySdk-15.7.6-20200521195109.aar

iOS 使用payOrderSign闪退

"app_id=2021001186622059&charset=utf-8&format=JSON&version=1.0&sign_type=RSA2&timestamp=2020-08-28+17%3A58%3A41&notify_url=http%3A%2F%2F47.242.6.15%2Fapi%2Fmobile%2Fpay%2FnotifData&return_url=http%3A%2F%2F47.242.6.15%2Fapi%2Fmobile%2Fpay%2FreturnData&method=alipay.trade.app.pay&biz_content=%7B%22product_code%22%3A%22QUICK_MSECURITY_PAY%22%2C%22out_trade_no%22%3A1598608721%2C%22total_amount%22%3A0.01%2C%22subject%22%3A%22%E4%B8%80%E6%AC%A1%E4%BB%B7%E6%A0%BC%22%7D&sign=XVu9wUETy9CJpj1hA8ua7yl8EK0s4oEU4xpiEC7g3n5B%2BFhdLgqDtA5%2BHkQShSIlHCvnclX%2BK507vFDVEEKap2k1Tt%2FXIcCxldLhbBO1yd532H%2BvqIdiWlHaTewGcsRGtWiHMo77bMiJOxqLRCtWpuJ0YyrStt5pIegaFQU7Vd4rWCrWIaQ9iHJ%2B2RTgskIO%2FLm0iu6uWeh3na0XCTjQt0vkImGOWxZXw55durYgDRamPzeVSaouKv20yJHgQ3u8ecwIPaKrTQoq"

这是后台给的数据,在安卓设备上运行正常,在苹果设备上会闪退

flutter和原生混合开发,调起支付报错

纯flutter项目,支付是OK的,但是flutter和原生混合开发,调用支付会报错,请问是哪里配置的问题吗?

Unhandled Exception: MissingPluginException(No implementation found for method pay on channel v7lin.github.io/alipay_kit)

周期扣款

周期扣款

支付后签约

和普通支付一个流程

先签约后代扣

后端设置 return_url: ${your app scheme}://${custom host}/alipay/page_sign/return_url

Future<bool> _showAlipayPageSignAlert(BuildContext context, {required String url}) async {
  final dynamic result = await showCupertinoDialog(
    context: context,
    builder: (BuildContext context) {
      return WillPopScope(
        child: CupertinoAlertDialog(
          content: SizedBox(
            height: 40,
            child: Stack(
              children: <Widget>[
                Visibility(
                  visible: false,
                  maintainState: true,
                  maintainAnimation: true,
                  maintainSize: true,
                  maintainInteractivity: false,
                  child: AlipayPageSignSlientExec(url: url),
                ),
                Center(
                  child: CupertinoActivityIndicator(radius: 12),
                ),
              ],
            ),
          ),
        ),
        onWillPop: () => Future<bool>.value(false),
      );
    },
    barrierDismissible: false,
  );
  return result is bool && result;
}

// 先签约后扣费
// https://opendocs.alipay.com/open/00a05b?pathHash=4f048b01#%E6%97%A0%E7%BA%BF%E7%AB%AF%E5%94%A4%E8%B5%B7%E7%AD%BE%E7%BA%A6%E8%AF%B4%E6%98%8E
// url 后端处理
// [encodeURIComponent](https://blog.csdn.net/KokJuis/article/details/84140514)
// final String signParams = url.replace("https://openapi.alipay.com/gateway.do?","");
// url = "alipays://platformapi/startapp?appId=60000157&appClearTop=false&startMultApp=YES&sign_params="+ encodeURIComponent(signParams)
// url 客户端处理
// final String signParams = url.replaceAll('https://openapi.alipay.com/gateway.do?', '');
// url = 'alipays://platformapi/startapp?appId=60000157&appClearTop=false&startMultApp=YES&sign_params=${Uri.encodeQueryComponent(signParams)}';
class AlipayPageSignSlientExec extends StatefulWidget {
  const AlipayPageSignSlientExec({
    super.key,
    required this.url,
  });

  final String url;

  @override
  State<StatefulWidget> createState() {
    return _AlipayPageSignSlientExecState();
  }
}

class _AlipayPageSignSlientExecState extends State<AlipayPageSignSlientExec> with WidgetsBindingObserver {
  Route<dynamic>? _route;
  late final StreamSubscription<String> _linkClickSubs;

  @override
  void initState() {
    super.initState();
    WidgetsBinding.instance.addObserver(this);
    _linkClickSubs = LinkKitPlatform.instance.linkClickStream().listen((String event) {
      _evalDeepLink(context, event);
    });
    launchUrlString(widget.url, mode: LaunchMode.externalApplication);
  }

  // ${your app scheme}://${custom host}/alipay/page_sign/return_url?msg=Success&charset=utf-8&code=10000&method=alipay.user.agreement.page.sign.return
  Future<void> _evalDeepLink(BuildContext context, String url) async {
    final Uri uri = Uri.parse(url);
    if (uri.path == '/alipay/page_sign/return_url') {
      if (kDebugMode) {
        print('Alipay Page Sign: $url');
      }
      if (uri.queryParameters['code'] == '10000') {
        if (_route?.isActive ?? false) {
          Navigator.of(context).pop(true);
        }
      } else {
        if (_route?.isActive ?? false) {
          Navigator.of(context).pop(false);
        }
      }
    }
  }

  @override
  void didChangeAppLifecycleState(AppLifecycleState state) {
    if (state == AppLifecycleState.resumed) {
      _clearSubscription();
    }
  }

  Future<void> _clearSubscription() async {
    await Future<void>.delayed(const Duration(seconds: 1));// 取消事件不走 deep link 回调,只能在 resumed 里取消(这会与 deep link 回调冲突,故作延迟)
    if (_route?.isActive ?? false) {
      // ignore: use_build_context_synchronously
      Navigator.of(context).pop(false);
    }
  }

  @override
  void didChangeDependencies() {
    super.didChangeDependencies();
    _route ??= ModalRoute.of(context);
  }

  @override
  void dispose() {
    _linkClickSubs.cancel();
    WidgetsBinding.instance.removeObserver(this);
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return SizedBox();
  }
}

ios 测试 alipay_kit 出现 如下错误 没有导入 alipay_kit_ios

Unhandled Exception: MissingPluginException(No implementation found for method isInstalled on channel v7lin.github.io/alipay_kit)

[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method isInstalled on channel v7lin.github.io/alipay_kit)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:313:7)

#1 MethodChannelAlipayKit.isInstalled (package:alipay_kit/src/alipay_kit_method_channel.dart:46:12)

#2 _HomeState.build. (package:alipay_kit_example/main.dart:85:30)

Execution failed for task ':alipay_kit:processVendorDebugManifest'.

Launching lib/main.dart on VOG AL00 in debug mode...
/Users/zhoufan/flutter/.pub-cache/hosted/pub.flutter-io.cn/alipay_kit-2.0.0/android/src/vendor/AndroidManifest.xml:6:9-63 Error:
Missing 'package' key attribute on element package at AndroidManifest.xml:6:9-63
/Users/zhoufan/flutter/.pub-cache/hosted/pub.flutter-io.cn/alipay_kit-2.0.0/android/src/vendor/AndroidManifest.xml Error:
Validation failed, exiting

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':alipay_kit:processVendorDebugManifest'.

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Manifest merger failed with multiple errors, see logs

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 2s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 2,738ms
Exception: Gradle task assembleDebug failed with exit code 1

能封装一个调用sdk的通用方法吗?

Hi,v7lin:
我需要用到支付宝的身份验证,目前貌似没有办法通过fake_alipay使用,也搜不到:MethodChannel 传入的 v7lin.github.io/fake_alipay ,不知道自己该怎么搞(我是一个前端),所以提了此issue。
谢谢!

FAILURE: Build failed with an exception.

Android Studio 4.2.1

classpath 'com.android.tools.build:gradle:4.2.1'

distributionUrl=https://services.gradle.org/distributions/gradle-6.7.1-bin.zip

Flutter SDK 2.2.1

使用命令打包:flutter build apk

FAILURE: Build failed with an exception.

  • Where:
    Build file '*****/alipay_kit-2.2.0-nullsafety/android/build.gradle' line: 22

  • What went wrong:
    A problem occurred evaluating root project 'alipay_kit'.

Project with path ':alipay_kit' could not be found in root project 'alipay_kit'.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 4s

The plugin alipay_kit could not be built due to the issue above.

    rootProject.allprojects {
        repositories {
            google()
            jcenter()

            // 私仓
            flatDir {
                dirs project(':alipay_kit').file('libs')  // 错误位置
            }
        }
    }

大神求解 这个插件是支付授权or支付宝第三方登录

我测试demo成功后没有返回用户信息,是不是只是支付的?新手,着实有点看不太懂好不容易找到你的插件.
以下是代码支付总是提示商家参数错误。。。
ListTile(
title: Text('支付'),
onTap: () {
Map<String, dynamic> bizContent = <String, dynamic>{
'timeout_express': '30m',
'total_amount': '0.01',
'product_code': 'QUICK_MSECURITY_PAY',
'body': '测试Body',
'subject': '1',
'out_trade_no': '2020072321300023155',
};
Map<String, dynamic> orderInfo = <String, dynamic>{
'app_id': _ALIPAY_APPID,
'method': 'alipay.trade.app.pay',
'charset': 'utf-8',
'timestamp': DateUtils.getNow(),
'version': '1.0',
'biz_content': json.encode(bizContent),
};
_alipay.payOrderJson(
orderInfo: json.encode(orderInfo),
signType: Alipay.SIGNTYPE_RSA2,
privateKey: _ALIPAY_PRIVATEKEY,
);
},
),

utdid 直接继承在alipay里 无法替换

Duplicate class com.ta.utdid2.a.a.a found in modules jetified-alipaysdk-15.8.01.210112203525-runtime (:alipaysdk-15.8.01.210112203525:) and jetified-utdid-1.5.2.1 (com.umeng.umsdk:utdid:1.5.2.1)

ios支付出现闪退

这个是闪退的日志:DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib

有没有前端不需要privateKey的支付和登录函数?

首先感谢开源。我看了你的demo,在payOrderMap和auth函数中,privateKey都是标注为@required,我个人感觉前端(客户端)保存这个值感觉有点不安全,被反编译了怎么办?privateKey无非是用来算sign,这个sign完全可以通过后台计算,而且必须由后台算,否则,比如前端拿到privateKey自己修改price,再自己调用支付宝api,那风险太大

pod脚本似乎不能正常工作

AS控制台错误信息如下
Resolving dependencies of Podfile
[!] CocoaPods could not find compatible versions for pod "AlipaySDK-iOS":
In Podfile:
fake_alipay (from .symlinks/plugins/fake_alipay/ios) was resolved to 0.0.1, which depends on
AlipaySDK-iOS (~> 15.5.5)

None of your spec sources contain a spec satisfying the dependency: `AlipaySDK-iOS (~> 15.5.5)`.

大神,来活了,求解 “使用或覆盖了已过时的 API。”

注: //flutter/.pub-cache/hosted/pub.flutter-io.cn/fake_alipay-0.2.3/android/src/main/java/io/github/v7lin/fakealipay/FakeAlipayPlugin.java使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
注: 某些输入文件使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
注: 某些输入文件使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
注: 某些输入文件使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。

关于支付宝商户密钥长度的问题

作者您好:
目前使用您的SDK发现一个问题,您的SDK在调用支付时,验证了商户私钥的长度不能低于2048位,但是目前使用支付宝官方的密钥生成工具生成出来的密钥只有1000多位,即便在生成时选择了密钥长度为2048位。

请问这个问题怎么解决呢?

这个bug很牛逼 点击查看详情

[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: Unsupported operation: PEMKey(MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCB0M........

#0 RsaKeyParser.parsePrivate (package:alipay_kit/src/crypto/rsa.dart:29:5)
#1 RsaSigner.sha256Rsa (package:alipay_kit/src/crypto/rsa.dart:96:24)
#2 Alipay._sign (package:alipay_kit/src/alipay.dart:191:31)
#3 Alipay.auth (package:alipay_kit/src/alipay.dart:150:25)

Screen Shot 2022-03-08 at 2 49 42 PM

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.