Beispiel #1
0
        public AlipayClient(
            IOptions <AlipayOptions> optionsAccessor,
            ILogger <AlipayClient> logger)
        {
            Options = optionsAccessor?.Value ?? new AlipayOptions();
            Logger  = logger;

            Client = new HttpClientEx();

            if (string.IsNullOrEmpty(Options.AppId))
            {
                throw new ArgumentNullException(nameof(Options.AppId));
            }

            if (string.IsNullOrEmpty(Options.RsaPrivateKey))
            {
                throw new ArgumentNullException(nameof(Options.RsaPrivateKey));
            }

            if (string.IsNullOrEmpty(Options.RsaPublicKey))
            {
                throw new ArgumentNullException(nameof(Options.RsaPublicKey));
            }

            RSAPrivateParameters = AlipaySignature.GetPrivateParameters(Options.RsaPrivateKey);
            RSAPublicParameters  = AlipaySignature.GetPublicParameters(Options.RsaPublicKey);
        }
Beispiel #2
0
        public AlipayNotifyClient(AlipayOptions options)
        {
            Options = options;

            if (!string.IsNullOrEmpty(Options.RsaPublicKey))
            {
                RSAPublicParameters = AlipaySignature.GetPublicParameters(Options.RsaPublicKey);
            }
        }
Beispiel #3
0
        public AlipayNotifyClient(
            IOptions <AlipayOptions> optionsAccessor,
            ILogger <AlipayNotifyClient> logger)
        {
            Options = optionsAccessor?.Value ?? new AlipayOptions();
            Logger  = logger;

            if (string.IsNullOrEmpty(Options.RsaPublicKey))
            {
                throw new ArgumentNullException(nameof(Options.RsaPublicKey));
            }

            RSAPublicParameters = AlipaySignature.GetPublicParameters(Options.RsaPublicKey);
        }
Beispiel #4
0
        public AlipayClient(AlipayOptions options)
        {
            Options = options;
            Client  = new HttpClientEx();

            if (!string.IsNullOrEmpty(Options.RsaPrivateKey))
            {
                RSAPrivateParameters = AlipaySignature.GetPrivateParameters(Options.RsaPrivateKey);
            }

            if (!string.IsNullOrEmpty(Options.RsaPublicKey))
            {
                RSAPublicParameters = AlipaySignature.GetPublicParameters(Options.RsaPublicKey);
            }
        }