Example #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);
            }
        }
Example #2
0
    /**
    * Return Authorization url to get auth_code 
    *
    * @return string 
    */

    public string  get_auth_url() {  
        _client  = new Client();
        string url = _client.get_dashboard_url() + "/auth";
        var param = new { response_type = "code", client_id =_client.client_id , redirect_uri = _client.get_current_url(),scope=_client.scope };
        url = _client.create_get_url(url, param);
        return url;
    }
        protected void getauthorizeapi()
        {
            Client client = new Client();
            client.client_id = "895963850ade9e8f5652ecabc7e16b3d561ea22f8d8b4c4207e6784a0db3a01f";
            client.client_secret = "6b08be21178a7f76229d7cae91a33eed023b7bf5aede577f4cc7d73ec5bd6e3f";
            client.scope = "user_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.User Updateduser = new GoCoinAPI.User();
                string userfname = currentuser.first_name;
                string userlname = currentuser.last_name;
                Updateduser.first_name = userfname.Substring(0, 4) + "  " + DateTime.Now; ;
                Updateduser.last_name = userlname.Substring(0,6) + "  " + DateTime.Now;


                Updateduser.id = currentuser.id;
                
                Litupdated_user.Text = SerializeJson(client.api.user.update(Updateduser));
                
            }
            else
            {
                Response.Redirect("Error in getting the User Data", false);
            }
        }
Example #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);
 }
        protected void getauthorizeapi()
        {
            Client client = new Client();
            client.client_id = "895963850ade9e8f5652ecabc7e16b3d561ea22f8d8b4c4207e6784a0db3a01f";
            client.client_secret = "6b08be21178a7f76229d7cae91a33eed023b7bf5aede577f4cc7d73ec5bd6e3f";
            client.scope = "user_read_write user_password_write merchant_read_write invoice_read_write oauth_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();
                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>");
                Response.Write(" Merchants Calls");
                Response.Write("</br>");
                Response.Write("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
                Response.Write("</br>");
                Response.Write(" Merchants get");
                Response.Write("</br>");
                Response.Write(SerializeJson(client.api.merchants.get(currentuser.merchant_id)));
                Response.Write("</br>");
                Response.Write(" Invoices Calls");
                Response.Write("</br>");
                Response.Write("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
                Response.Write("</br>");
                Response.Write(" Invoices get");
                Response.Write("</br>");
                Response.Write(SerializeJson(client.api.invoices.get("b9b9ddfd-7977-4938-b8d1-4aec6da507bc")));
                Response.Write("</br>");
                Response.Write(" Accounts Calls");
                Response.Write("</br>");
                Response.Write("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
                Response.Write("</br>");
                Response.Write(" Account alist");
                Response.Write("</br>");
                Response.Write(SerializeJson(client.api.accounts.alist(currentuser.merchant_id)));
                Response.Write("</br>");
                //Response.Write(" Account get");
                //Response.Write("</br>");
                //Response.Write(SerializeJson(client.api.accounts.get("5cb16865-33d6-4494-8f0f-3d765f4dddb3")));
                Response.Write("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
            }
            else
            {
                Response.Redirect("Error in getting the User Data", false);
            }
        }
Example #6
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://");
 }
Example #7
0
 protected void getauthorizeapi()
 {
     Client client = new Client();
     client.client_id = "895963850ade9e8f5652ecabc7e16b3d561ea22f8d8b4c4207e6784a0db3a01f";
     client.client_secret = "6b08be21178a7f76229d7cae91a33eed023b7bf5aede577f4cc7d73ec5bd6e3f";
     client.scope = "user_read_write";
     client.redirect_uri = "http://119.226.189.186:8100/DemoWebGoCoin/";
   
     Boolean b_auth = client.authorize_api();
     if (b_auth)
     {
        LitUser.Text = SerializeJson(client.api.user.self());
     }
     else
     {
         Response.Redirect("Error in getting the User Data", false);
     }
 }
Example #8
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);

            }
        }
Example #9
0
 protected void getauthorizeapi() {
     string Redirecturl = null;
    
     Client client = new Client();
     client.client_id = "895963850ade9e8f5652ecabc7e16b3d561ea22f8d8b4c4207e6784a0db3a01f";
     client.client_secret = "6b08be21178a7f76229d7cae91a33eed023b7bf5aede577f4cc7d73ec5bd6e3f";
     client.scope = "user_read_write merchant_read_write invoice_read_write oauth_read_write";
     //client.scope = "user_read_write user_password_write";
     client.redirect_uri = "http://119.226.189.186:8100/DemoWebGoCoin/";
     Redirecturl = client.request_client(client.secure) + "://" + client.get_auth_url();
     client.initToken();
     Boolean b_auth = client.authorize_api();
     if (b_auth)
     {
         string token = client.getToken();
         LitAccessToken.Text = token;
     }
     else
     {
         Response.Redirect(Redirecturl, false);
     }
 }
Example #10
0
 public Auth(Client client)
 {
     this._client = client;
 }