-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Diego Alberto
committed
Nov 6, 2019
0 parents
commit 4698a04
Showing
46 changed files
with
1,533 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
bin | ||
obj | ||
.vs | ||
vs | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.