public static ExchangeBitcoinResponse FromJObject(JObject jObject)
        {
            var isSuccess = jObject["success"].ToObject <bool>();
            var errors    = jObject["errors"] == null
                ? null : jObject["errors"].Values <string>();
            var tjo          = jObject["transfer"];
            var transferInfo = new TransferInfo(
                tjo.Value <string>("_type"),
                tjo.Value <string>("code"),
                tjo.Value <DateTime?>("created_at"),
                tjo["fees"]
                .Select(token => (JProperty)token)
                .Select(jProperty =>
                        new CoinbaseFee(
                            jProperty.Name,
                            new PriceUnit(
                                jProperty.Value["cents"].Value <decimal>() * .01m,
                                jProperty.Value["currency_iso"].Value <string>()))),
                tjo.Value <string>("status"),
                tjo.Value <DateTime?>("payout_date"),
                PriceUnit.FromJToken(tjo["btc"]),
                PriceUnit.FromJToken(tjo["subtotal"]),
                PriceUnit.FromJToken(tjo["total"])
                );

            return(new ExchangeBitcoinResponse(isSuccess, errors, transferInfo));
        }
Esempio n. 2
0
 public TransferInfo(string type, string code, DateTime? createdAt,
     IEnumerable<CoinbaseFee> fees, string status, DateTime? payoutDate,
     PriceUnit bitcoinAmount, PriceUnit subtotal, PriceUnit total)
 {
     this.Type = type;
     this.Code = code;
     this.CreatedAt = createdAt;
     this.Fees = fees.ToArray();
     this.Status = status;
     this.PayoutDate = payoutDate;
     this.BitcoinAmount = bitcoinAmount;
     this.Subtotal = subtotal;
     this.Total = total;
 }
Esempio n. 3
0
 public TransferInfo(string type, string code, DateTime?createdAt,
                     IEnumerable <CoinbaseFee> fees, string status, DateTime?payoutDate,
                     PriceUnit bitcoinAmount, PriceUnit subtotal, PriceUnit total)
 {
     this.Type          = type;
     this.Code          = code;
     this.CreatedAt     = createdAt;
     this.Fees          = fees.ToArray();
     this.Status        = status;
     this.PayoutDate    = payoutDate;
     this.BitcoinAmount = bitcoinAmount;
     this.Subtotal      = subtotal;
     this.Total         = total;
 }
Esempio n. 4
0
 public PriceBuyResponse(PriceUnit subtotal, IEnumerable <CoinbaseFee> fees, PriceUnit totalAmount)
 {
     this.Subtotal    = subtotal;
     this.Fees        = fees.ToArray();
     this.TotalAmount = totalAmount;
 }
Esempio n. 5
0
 public PriceBuyResponse(PriceUnit subtotal, IEnumerable<CoinbaseFee> fees, PriceUnit totalAmount)
 {
     this.Subtotal = subtotal;
     this.Fees = fees.ToArray();
     this.TotalAmount = totalAmount;
 }