Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Diego Alberto committed Nov 6, 2019
0 parents commit 4698a04
Show file tree
Hide file tree
Showing 46 changed files with 1,533 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
bin
obj
.vs
vs
.vscode
22 changes: 22 additions & 0 deletions Gerencianet.SDK.Examples/CancelCarnet.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;

namespace Gerencianet.SDK.Examples {
internal class CancelCarnet {
public static void Execute () {
dynamic endpoints = new Endpoints (Credentials.ClientId, Credentials.ClientSecret,
Credentials.Sandbox);

var param = new {
id = 0
};

try {
var response = endpoints.CancelCarnet (param);
Console.WriteLine (response);
} catch (GnException e) {
Console.WriteLine (e.ErrorType);
Console.WriteLine (e.Message);
}
}
}
}
22 changes: 22 additions & 0 deletions Gerencianet.SDK.Examples/CancelCharge.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;

namespace Gerencianet.SDK.Examples {
internal class CancelCharge {
public static void Execute () {
dynamic endpoints = new Endpoints (Credentials.ClientId, Credentials.ClientSecret,
Credentials.Sandbox);

var param = new {
id = 0
};

try {
var response = endpoints.CancelCharge (param);
Console.WriteLine (response);
} catch (GnException e) {
Console.WriteLine (e.ErrorType);
Console.WriteLine (e.Message);
}
}
}
}
23 changes: 23 additions & 0 deletions Gerencianet.SDK.Examples/CancelParcel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;

namespace Gerencianet.SDK.Examples {
internal class CancelParcel {
public static void Execute () {
dynamic endpoints = new Endpoints (Credentials.ClientId, Credentials.ClientSecret,
Credentials.Sandbox);

var param = new {
id = 0,
parcel = 1
};

try {
var response = endpoints.CancelParcel (param);
Console.WriteLine (response);
} catch (GnException e) {
Console.WriteLine (e.ErrorType);
Console.WriteLine (e.Message);
}
}
}
}
22 changes: 22 additions & 0 deletions Gerencianet.SDK.Examples/CancelSubscription.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;

namespace Gerencianet.SDK.Examples {
internal class CancelSubscription {
public static void Execute () {
dynamic endpoints = new Endpoints (Credentials.ClientId, Credentials.ClientSecret,
Credentials.Sandbox);

var param = new {
id = 0
};

try {
var response = endpoints.CancelSubscription (param);
Console.WriteLine (response);
} catch (GnException e) {
Console.WriteLine (e.ErrorType);
Console.WriteLine (e.Message);
}
}
}
}
31 changes: 31 additions & 0 deletions Gerencianet.SDK.Examples/ChargeLink.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;

namespace Gerencianet.SDK.Examples {
internal class ChargeLink {
public static void Execute () {
dynamic endpoints = new Endpoints (Credentials.ClientId, Credentials.ClientSecret,
Credentials.Sandbox);

var param = new {
id = 1000
};

var body = new {
billet_discount = 0,
card_discount = 0,
message = "",
expire_at = DateTime.Now.AddDays (3).ToString ("yyyy-MM-dd"),
request_delivery_address = false,
payment_method = "all"
};

try {
var response = endpoints.ChargeLink (param, body);
Console.WriteLine (response);
} catch (GnException e) {
Console.WriteLine (e.ErrorType);
Console.WriteLine (e.Message);
}
}
}
}
37 changes: 37 additions & 0 deletions Gerencianet.SDK.Examples/CreateBilletPayment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;

namespace Gerencianet.SDK.Examples {
internal class CreateBilletPayment {
public static void Execute () {
dynamic endpoints = new Endpoints (Credentials.ClientId, Credentials.ClientSecret,
Credentials.Sandbox);

var param = new {
id = 1000
};

var body = new {
payment = new {
banking_billet = new {
expire_at = DateTime.Now.AddDays (1).ToString ("yyyy-MM-dd"),
customer = new {
name = "Gorbadoc Oldbuck",
email = "oldbuck@gerencianet.com.br",
cpf = "04267484171",
birth = "1977-01-15",
phone_number = "5144916523"
}
}
}
};

try {
var response = endpoints.PayCharge (param, body);
Console.WriteLine (response);
} catch (GnException e) {
Console.WriteLine (e.ErrorType);
Console.WriteLine (e.Message);
}
}
}
}
46 changes: 46 additions & 0 deletions Gerencianet.SDK.Examples/CreateCardPayment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System;

namespace Gerencianet.SDK.Examples {
internal class CreateCardPayment {
public static void Execute () {
dynamic endpoints = new Endpoints (Credentials.ClientId, Credentials.ClientSecret,
Credentials.Sandbox);

var param = new {
id = 1000
};

var body = new {
payment = new {
credit_card = new {
installments = 1,
payment_token = "6426f3abd8688639c6772963669bbb8e0eb3c319",
billing_address = new {
street = "Av. JK",
number = 909,
neighborhood = "Bauxita",
zipcode = "35400000",
city = "Ouro Preto",
state = "MG"
},
customer = new {
name = "Gorbadoc Oldbuck",
email = "oldbuck@gerencianet.com.br",
cpf = "04267484171",
birth = "1977-01-15",
phone_number = "5144916523"
}
}
}
};

try {
var response = endpoints.PayCharge (param, body);
Console.WriteLine (response);
} catch (GnException e) {
Console.WriteLine (e.ErrorType);
Console.WriteLine (e.Message);
}
}
}
}
38 changes: 38 additions & 0 deletions Gerencianet.SDK.Examples/CreateCarnet.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System;

namespace Gerencianet.SDK.Examples {
internal class CreateCarnet {
public static void Execute () {
dynamic endpoints = new Endpoints (Credentials.ClientId, Credentials.ClientSecret,
Credentials.Sandbox);

var body = new {
items = new [] {
new {
name = "Carnet Item 1",
value = 1000,
amount = 2
}
},
customer = new {
name = "Gorbadoc Oldbuck",
email = "oldbuck@gerencianet.com.br",
cpf = "04267484171",
birth = "1977-01-15",
phone_number = "5144916523"
},
repeats = 12,
split_items = false,
expire_at = DateTime.Now.AddDays (5).ToString ("yyyy-MM-dd")
};

try {
var response = endpoints.CreateCarnet (null, body);
Console.WriteLine (response);
} catch (GnException e) {
Console.WriteLine (e.ErrorType);
Console.WriteLine (e.Message);
}
}
}
}
26 changes: 26 additions & 0 deletions Gerencianet.SDK.Examples/CreateCarnetHistory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;

namespace Gerencianet.SDK.Examples {
internal class CreateCarnetHistory {
public static void Execute () {
dynamic endpoints = new Endpoints (Credentials.ClientId, Credentials.ClientSecret,
Credentials.Sandbox);

var param = new {
id = 1001
};

var body = new {
description = "This carnet is about a service"
};

try {
var response = endpoints.CreateCarnetHistory (param, body);
Console.WriteLine (response);
} catch (GnException e) {
Console.WriteLine (e.ErrorType);
Console.WriteLine (e.Message);
}
}
}
}
34 changes: 34 additions & 0 deletions Gerencianet.SDK.Examples/CreateCharge.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;

namespace Gerencianet.SDK.Examples {
internal class CreateCharge {
public static void Execute () {
dynamic endpoints = new Endpoints (Credentials.ClientId, Credentials.ClientSecret,
Credentials.Sandbox, Credentials.PartnerToken);

var body = new {
items = new [] {
new {
name = "Product 1",
value = 1000,
amount = 2
}
},
shippings = new [] {
new {
name = "Default Shipping Cost",
value = 100
}
}
};

try {
var response = endpoints.CreateCharge (null, body);
Console.WriteLine (response);
} catch (GnException e) {
Console.WriteLine (e.ErrorType);
Console.WriteLine (e.Message);
}
}
}
}
26 changes: 26 additions & 0 deletions Gerencianet.SDK.Examples/CreateChargeHistory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;

namespace Gerencianet.SDK.Examples {
internal class CreateChargeHistory {
public static void Execute () {
dynamic endpoints = new Endpoints (Credentials.ClientId, Credentials.ClientSecret,
Credentials.Sandbox);

var param = new {
id = 1000
};

var body = new {
description = "This charge was not fully paid"
};

try {
var response = endpoints.CreateChargeHistory (param, body);
Console.WriteLine (response);
} catch (GnException e) {
Console.WriteLine (e.ErrorType);
Console.WriteLine (e.Message);
}
}
}
}
24 changes: 24 additions & 0 deletions Gerencianet.SDK.Examples/CreatePlan.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;

namespace Gerencianet.SDK.Examples {
internal class CreatePlan {
public static void Execute () {
dynamic endpoints = new Endpoints (Credentials.ClientId, Credentials.ClientSecret,
Credentials.Sandbox);

var body = new {
name = "My first plan",
repeats = 24,
interval = 2
};

try {
var response = endpoints.CreatePlan (null, body);
Console.WriteLine (response);
} catch (GnException e) {
Console.WriteLine (e.ErrorType);
Console.WriteLine (e.Message);
}
}
}
}
Loading

0 comments on commit 4698a04

Please sign in to comment.