public async Task <PaymentResponse> AuthorizeSoapPayment(string paymentId, string paRes) { var authorizeRequest = new AuthenticateData(paymentId, paRes); var xmlData = XmlPreparer.Serialize(authorizeRequest); var(encryptedRc4OneTimeKeyByGatewayPem, encryptedPaymentDataByRc4OneTimeKey, signature) = await CryptData(xmlData); var result = await _ecomClient.AuthenticateAsync(new ecomPaymentType() { KEY = encryptedRc4OneTimeKeyByGatewayPem, DATA = encryptedPaymentDataByRc4OneTimeKey, KEY_INDEX = _keyIndex.ToString(), INTERFACE = _merchantId.ToString(), SIGNATURE = signature, }); var verify = _signature.Verify(xmlData, signature); if (!verify) { throw new MedoroException("Signature validation failed"); } var responseData = DecryptData(result.AuthenticateResponse1.DATA, result.AuthenticateResponse1.KEY); return(XmlPreparer.Deserialize <PaymentResponse>(responseData)); }
//登录 private void button1_Click(object sender, EventArgs e) { Operator op = obj2.Login(textBox1.Text, textBox2.Text, textBox3.Text); AuthenticateData ad = new AuthenticateData(); ad.OperatorId = op.OperatorId; ad.OperatorSession = op.OperatorSession; CallContext.SetData("AuthenticateData", ad); OperatorServerEventSink sink = new OperatorServerEventSink(); sink.Tag = ad; obj2.OperatorStatusChanged += new EventHandler <OperatorServiceInterface.OperatorStatusChangeEventArgs>(sink.OnOperatorStatusChange); sink.OperatorStatusChanged += new EventHandler <OperatorServiceInterface.OperatorStatusChangeEventArgs>(sink_OperatorStatusChanged); }