Esempio n. 1
0
        protected void getauthorizeapi()
        {
            Client client = new Client();
            client.client_id = "895963850ade9e8f5652ecabc7e16b3d561ea22f8d8b4c4207e6784a0db3a01f";
            client.client_secret = "6b08be21178a7f76229d7cae91a33eed023b7bf5aede577f4cc7d73ec5bd6e3f";
            client.scope = "invoice_read_write";
            client.redirect_uri = "http://119.226.189.186:8100/DemoWebGoCoin/";

            Boolean b_auth = client.authorize_api();
            if (b_auth)
            {
                GoCoinAPI.User currentuser = new GoCoinAPI.User();
                currentuser = client.api.user.self();

                GoCoinAPI.Invoices invoices = new GoCoinAPI.Invoices();
                invoices.price_currency = "BTC";
                invoices.base_price = 20000;
                invoices.base_price_currency = "USD";
                invoices.confirmations_required = 6;
                invoices.notification_level = "all";

                LitInvoices.Text = SerializeJson(client.api.invoices.create(currentuser.merchant_id, invoices));

            }
            else
            {
                Response.Redirect("Error in getting the Invoices Data", false);
            }
        }
Esempio n. 2
0
        protected void getauthorizeapi()
        {
            Client client = new Client();

            client.client_id     = "895963850ade9e8f5652ecabc7e16b3d561ea22f8d8b4c4207e6784a0db3a01f";
            client.client_secret = "6b08be21178a7f76229d7cae91a33eed023b7bf5aede577f4cc7d73ec5bd6e3f";
            client.scope         = "invoice_read_write";
            client.redirect_uri  = "http://119.226.189.186:8100/DemoWebGoCoin/";

            Boolean b_auth = client.authorize_api();

            if (b_auth)
            {
                GoCoinAPI.User currentuser = new GoCoinAPI.User();
                currentuser = client.api.user.self();

                GoCoinAPI.Invoices invoices = new GoCoinAPI.Invoices();
                invoices.price_currency         = "BTC";
                invoices.base_price             = 20000;
                invoices.base_price_currency    = "USD";
                invoices.confirmations_required = 6;
                invoices.notification_level     = "all";

                LitInvoices.Text = SerializeJson(client.api.invoices.create(currentuser.merchant_id, invoices));
            }
            else
            {
                Response.Redirect("Error in getting the Invoices Data", false);
            }
        }
Esempio n. 3
0
 public Api(Client client)
 {
    this._client = client;
    this._user = new User(this);
    this._merchants = new Merchant(this);
    this._invoices = new Invoices(this);
    this._accounts = new Accounts(this);
 }
Esempio n. 4
0
 public Api(Client client)
 {
    this._client = client;
    this._user = new User(this);
    this._merchants = new Merchant(this);
    this._invoices = new Invoices(this);
    this._accounts = new Accounts(this);
    this.Baseapiurl = client.request_client(client.secure) + "://" + client.host.Trim('/') + "/" + client.path.Trim('/') + "/" + client.api_version.Trim('/') + "/";
     this.BaseapiSecureUrl = this.Baseapiurl.Replace("http://", "https://");
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            // getauthorizeapi();

            Client client   = new Client("your api key");
            var    invoice1 = new Invoices
            {
                price_currency         = "BTC",
                base_price             = 134.00f,
                base_price_currency    = "USD",
                confirmations_required = 6,
                notification_level     = "all",
                callback_url           = "https://www.example.com/gocoin/callback",
                redirect_url           = "https://www.example.com/redirect"
            };

            GoCoinAPI.Invoices inv   = client.api.invoices.create("your merchant id", invoice1);
            string             token = client.getToken();

            LitAccessToken.Text = token;
            Boolean b_auth = client.authorize_api();

            if (b_auth)
            {
                GoCoinAPI.User currentuser = new GoCoinAPI.User();
                currentuser = client.api.user.self();
                Response.Write(" User Calls");
                Response.Write("</br>");
                Response.Write("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
                Response.Write("</br>");
                Response.Write("</br>");
                Response.Write(" User get");
                Response.Write("</br>");
                Response.Write(SerializeJson(client.api.user.get(currentuser.id)));
                Response.Write("</br>");
            }
            else
            {
                Response.Redirect("Error in getting the User Data", false);
            }
        }
Esempio n. 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
           // getauthorizeapi();

           Client client = new Client("your api key");
            var invoice1 = new Invoices
                {
                    price_currency = "BTC",
                    base_price = 134.00f,
                    base_price_currency = "USD",
                    confirmations_required = 6,
                    notification_level = "all",
                    callback_url = "https://www.example.com/gocoin/callback",
                    redirect_url = "https://www.example.com/redirect"
                };

            GoCoinAPI.Invoices inv =  client.api.invoices.create("your merchant id",invoice1);
            string token = client.getToken();
                LitAccessToken.Text = token;
             Boolean b_auth = client.authorize_api();
            if (b_auth)
            {
                GoCoinAPI.User currentuser = new GoCoinAPI.User();
                currentuser = client.api.user.self();
                Response.Write(" User Calls");
                Response.Write("</br>");
                Response.Write("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
                Response.Write("</br>");
                Response.Write("</br>");
                Response.Write(" User get");
                Response.Write("</br>");
                Response.Write(SerializeJson(client.api.user.get(currentuser.id)));
                Response.Write("</br>");
            }
            else
            {
                Response.Redirect("Error in getting the User Data", false);

            }
        }
Esempio n. 7
0
 // Todo: Searialize type T to Json
 private string SerializeJson(Invoices obj)
 {
     return JsonConvert.SerializeObject(obj);
 }
Esempio n. 8
0
 /// <summary>
 /// Create a new invoice.
 /// </summary>
 /// <param name="_merchantid">Merchant's id.</param>
 /// <param name="_invoice">New invoice data.</param>
 /// <returns>The created Invoice.</returns>
 public Invoices create(string  _merchantid, Invoices _invoice)
 {             
     Callbackurl = "merchants/" + _merchantid + "/invoices";
     restClient = new RestClient(this._api.BaseapiSecureUrl, HttpVerb.POST, SerializeJson(_invoice), Callbackurl, this._api.client.token);
     Invoices Invoices_create = DeserializeJson(restClient.MakeRequest());
     return Invoices_create;
 }