コード例 #1
0
 public Mobilpay_Payment_Request_Card BuildCardDecrypt(
     MobilpayDecrypt mobilpayDecrypt)
 {
     try
     {
         Mobilpay_Payment_Request_Card paymentRequestCard = new Mobilpay_Payment_Request_Card();
         if (Decrypt(mobilpayDecrypt) == 0)
         {
             return(this.GetCard(mobilpayDecrypt.DecryptedData));
         }
         Exception exception = new Exception("0x300000f3");
         return((Mobilpay_Payment_Request_Card)null);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
 public int BuildXmlEncrypt(Mobilpay_Payment_Request_Card card, MobilpayEncrypt mobilpayEncrypt)
 {
     try
     {
         string message = this.VerifyCardObject(card);
         if (message == "")
         {
             string xmlText = this.GetXmlText(card);
             mobilpayEncrypt.Data = xmlText;
             Encrypt(mobilpayEncrypt);
             return(0);
         }
         Exception exception = new Exception(message);
         return(-1);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #3
0
 public string GetXmlText(Mobilpay_Payment_Request_Card card)
 {
     try
     {
         string message = this.VerifyCardObject(card);
         if (!(this.VerifyCardObject(card) == ""))
         {
             throw new Exception(message);
         }
         XmlSerializer           xmlSerializer = new XmlSerializer(typeof(Mobilpay_Payment_Request_Card));
         Stream                  stream        = (Stream) new MemoryStream();
         XmlSerializerNamespaces namespaces    = new XmlSerializerNamespaces();
         xmlSerializer.Serialize(stream, (object)card, namespaces);
         stream.Position = 0L;
         return(new StreamReader(stream).ReadToEnd());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #4
0
 private string VerifyCardObject(Mobilpay_Payment_Request_Card card)
 {
     if (card.Type == "" || card.Type == null)
     {
         return("type is mandatory");
     }
     if (card.OrderId == "" || card.OrderId == null)
     {
         return("id is mandatory");
     }
     if (card.Signature == "" || card.Signature == null)
     {
         return("signature is mandatory");
     }
     if (card.Invoice == null)
     {
         return("amount is mandatory");
     }
     if (card.Invoice.Amount == new Decimal(0))
     {
         return("amonut is mandatory");
     }
     return(card.Invoice.Currency == "" || card.Invoice.Currency == null ? "currency is mandatory" : "");
 }