示例#1
0
 /// <remarks/>
 public void transAlertsAsync(Transaction transaction, object userState) {
     if ((this.transAlertsOperationCompleted == null)) {
         this.transAlertsOperationCompleted = new System.Threading.SendOrPostCallback(this.OntransAlertsOperationCompleted);
     }
     this.InvokeAsync("transAlerts", new object[] {
                 transaction}, this.transAlertsOperationCompleted, userState);
 }
示例#2
0
        public Transaction GetFormValues(ITNWebServiceContract client)
        {
            String sharedKey = Sharedkeytxt.Text;
              if(String.IsNullOrEmpty(WebserviceURLtxt.Text))
              {
            answertxt.ForeColor = Color.Red;
            answertxt.Text = "Wprowadź URL usługi";
            return null;
              }
              client.Url = WebserviceURLtxt.Text;

              //Stringi
              String docHash = String.Empty;
              String transID = transIDtxt.Text;
              if(String.IsNullOrEmpty(transID))
              {
            answertxt.ForeColor = Color.Red;
            answertxt.Text = "Wprowadź transID";
            return null;
              }
              String orderID = orderIDtxt.Text;
              if(String.IsNullOrEmpty(orderID))
              {
            answertxt.ForeColor = Color.Red;
            answertxt.Text = "Wprowadź orderID";
            return null;
              }
              String transTitle = transTitletxt.Text;
              //Kwota
              Boolean amountCorrect = false;
              Decimal amountValue;
              amountCorrect = Decimal.TryParse(valuetxt.Text.Replace(".", ","), out amountValue);
              if(!amountCorrect)
              {
            amountCorrect = Decimal.TryParse(valuetxt.Text = valuetxt.Text.Replace(",","."), out amountValue);
              }
              if(!amountCorrect)
              {
            answertxt.ForeColor = Color.Red;
            answertxt.Text = "Zły format kwoty";
            return null;
              }
              Amount amount = new Amount() {
            currency =(AmountCurrency) Enum.Parse(typeof(AmountCurrency), currencytxt.Text, true),
            value = amountValue };
              //Daty
              DateTime transDate;
              try
            {
            transDate = transDatedtp.Value;
            }
            catch (Exception)
            {
            answertxt.ForeColor = Color.Red;
            answertxt.Text = "Zły format transDate";
            return null;
            }
              DateTime statusDate = statusDatedtp.Value;
              try
              {
            statusDate = statusDatedtp.Value;
              }
              catch(Exception)
              {
            answertxt.ForeColor = Color.Red;
            answertxt.Text = "Zły format statusDate";
            return null;
              }
              //inty
              int paywayID = 0;
              try
              {
            paywayID = Convert.ToInt32(paywayIDtxt.Text);
              }
              catch(Exception)
              {
            answertxt.ForeColor = Color.Red;
            answertxt.Text = "Zły format paywayID (musi być int)";
            return null;
              }
              int merchantID = 0;
              try
              {
            merchantID = Convert.ToInt32(merchantIDtxt.Text);
              }
              catch(Exception)
              {
            answertxt.ForeColor = Color.Red;
            answertxt.Text = "Zły format merchantID (musi być int)";
            return null;
              }
              int status = 0;
              try
              {
            status = Convert.ToInt32(statustxt.Text);
              }
              catch(Exception)
              {
            answertxt.ForeColor = Color.Red;
            answertxt.Text = "Zły format statusu (musi być int)";
            return null;
              }
              CustomerData customerData = null;
              if(!(String.IsNullOrEmpty(customerAddresstxt.Text) && String.IsNullOrEmpty(customerNRBtxt.Text)))
              {
            customerData = new CustomerData() { customerAddress = customerAddresstxt.Text, customerNRB = customerNRBtxt.Text };
              }

              Transaction transaction = new Transaction()
              {
            transID = transID,
            amount = new Amount() { currency = (AmountCurrency)Enum.Parse(typeof(AmountCurrency),
              currencytxt.Text, true), value = amountValue },
            docHash = String.Empty,
            orderID = orderID,
            status = status,
            transTitle = transTitle,
            transDate = transDate,
            customerData = customerData,
            merchantID = merchantID,
            statusDate = statusDate,
            paywayID = paywayID
              };
              StringBuilder sb = new StringBuilder();
              sb.Append(transaction.merchantID).Append(transaction.orderID).Append(transaction.transID).
            Append(transaction.transDate.ToString("yyyy-MM-dd HH:mm:ss")).
            Append(transaction.transTitle).
            Append(transaction.amount.value.ToString("0.00").Replace(",", ".")).Append(transaction.amount.currency).
            Append(transaction.paywayID).Append(transaction.statusDate.ToString("yyyy-MM-dd HH:mm:ss")).
            Append(transaction.status).Append(transaction.customerData == null ? String.Empty : transaction.customerData.customerAddress).
            Append(transaction.customerData == null ? String.Empty : transaction.customerData.customerNRB).Append(sharedKey);
              using(MD5 md5Hash = MD5.Create())
              {
            transaction.docHash = GetHash(md5Hash, sb.ToString());
              }
              hashtxt.Text = transaction.docHash;
              return transaction;
        }
示例#3
0
 /// <remarks/>
 public void transAlertsAsync(Transaction transaction) {
     this.transAlertsAsync(transaction, null);
 }