Exemplo n.º 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);
        }
Exemplo n.º 2
0
        public AlipayMobilePublicMultiMediaClient(AlipayOptions options)
        {
            Options = options;
            Client  = new HttpClientEx();

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