-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed virtaul accounts, cards and added subscriptions
- Loading branch information
cleopatra27
committed
Jan 12, 2020
1 parent
072da76
commit cf57c34
Showing
28 changed files
with
4,684 additions
and
68 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
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 |
---|---|---|
@@ -1,17 +1,21 @@ | ||
using System; using System.Collections.Generic; using System.Text; using System.Net.Http; using System.Threading.Tasks; using Rave.api; using Rave.config; using Newtonsoft.Json; | ||
//using System; //using System.Collections.Generic; //using System.Text; //using System.Net.Http; //using System.Threading.Tasks; //using Rave.api; //using Rave.config; //using Newtonsoft.Json; | ||
//using Rave.Models.VirtualAccount; | ||
|
||
namespace Rave.Models.Charge | ||
{ | ||
public class CreateVirtualAccounts : Base<RaveResponse<Account.ResponseData>, Account.ResponseData> | ||
{ | ||
public CreateVirtualAccounts(RaveConfig conf) : base(conf) { } | ||
//namespace Rave.Models.Charge | ||
//{ | ||
// public class CreateVirtualAccounts : Base<RaveResponse<Card.ResponseData>, Card.ResponseData> | ||
// { | ||
// public CreateVirtualAccounts(RaveConfig conf) : base(conf) { } | ||
|
||
public override async Task<RaveResponse<Account.ResponseData>> Charge(IParams Params, bool isRecurring = false) { | ||
//if (Params.TxRef.Equals(null)) | ||
//{ | ||
|
||
//} | ||
// public override async Task<RaveResponse<Card.ResponseData>> Create(VirtualAccountParams virtualaccountparams) | ||
// { | ||
|
||
var encryptedKey = PayDataEncrypt.GetEncryptionKey(Config.SecretKey); var encryptedData = PayDataEncrypt.EncryptData(encryptedKey, JsonConvert.SerializeObject(Params)); var content = new StringContent(JsonConvert.SerializeObject(new { PBFPubKey = Params.PbfPubKey, client = encryptedData, alg = "3DES-24" }), Encoding.UTF8, "application/json"); var requestMessage = new HttpRequestMessage(HttpMethod.Post, Endpoints.CreateaccountNumber) { Content = content }; var result = await RaveRequest.Request(requestMessage); return result; } | ||
} | ||
} | ||
// var content = new StringContent(JsonConvert.SerializeObject(new { virtualaccountparams }), Encoding.UTF8, "application/json"); | ||
// var requestMessage = new HttpRequestMessage(HttpMethod.Post, Endpoints.CreateaccountNumber) { Content = content }; | ||
|
||
// var result = await RaveRequest.Request(requestMessage); | ||
// return result; | ||
// } | ||
// } | ||
//} |
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,30 @@ | ||
using System; | ||
using RestSharp; | ||
using Newtonsoft.Json; | ||
namespace Rave.Models.Ebills | ||
|
||
{ | ||
public class CreateOrder | ||
{ | ||
public CreateOrder() | ||
{ | ||
} | ||
|
||
public string doCreateOrder(EbillsCreateRequestParams ebillscreaterequestparams) | ||
{ | ||
|
||
var client = new RestClient("https://api.ravepay.co/flwv3-pug/getpaidx/api/ebills/generateorder/"); | ||
client.Timeout = -1; | ||
var request = new RestRequest(Method.POST); | ||
request.AddHeader("Content-Type", "application/json"); | ||
request.AddParameter("application/json", JsonConvert.SerializeObject(ebillscreaterequestparams), ParameterType.RequestBody); | ||
IRestResponse response = client.Execute(request); | ||
Console.WriteLine(response.Content); | ||
|
||
return response.Content; | ||
|
||
} | ||
|
||
|
||
} | ||
} |
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,58 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Rave.Models.Charge; | ||
using Newtonsoft.Json; | ||
|
||
namespace Rave.Models.Ebills | ||
{ | ||
public class EbillsCreateRequestParams | ||
{ | ||
public EbillsCreateRequestParams( string currency, int numberofunits, string narration, string seckey, string email, int amount, string phonenumber, string txRef, string ip) | ||
{ | ||
Country = "NG"; | ||
Currency = currency; | ||
Numberofunits = numberofunits; | ||
Narration = narration; | ||
SECKEY = seckey; | ||
Amount = amount; | ||
Phonenumber = phonenumber; | ||
Email = email; | ||
TxRef = txRef; | ||
IP = ip; | ||
|
||
} | ||
|
||
|
||
[JsonProperty("country")] | ||
public string Country { get; set; } | ||
|
||
[JsonProperty("currency")] | ||
public string Currency { get; set; } | ||
|
||
[JsonProperty("numberofunits")] | ||
public int Numberofunits { get; set; } | ||
|
||
[JsonProperty("narration")] | ||
public string Narration { get; set; } | ||
|
||
[JsonProperty("SECKEY")] | ||
public string SECKEY { get; set; } | ||
|
||
[JsonProperty("amount")] | ||
public int Amount { get; set; } | ||
|
||
[JsonProperty("phonenumber")] | ||
public string Phonenumber { get; set; } | ||
|
||
[JsonProperty("email")] | ||
public string Email { get; set; } | ||
|
||
[JsonProperty("txRef")] | ||
public string TxRef { get; set; } | ||
|
||
[JsonProperty("IP")] | ||
public string IP { get; set; } | ||
|
||
} | ||
} |
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,36 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Rave.Models.Charge; | ||
using Newtonsoft.Json; | ||
|
||
namespace Rave.Models.Ebills | ||
{ | ||
public class EbillsUpdateRequestParams | ||
{ | ||
public EbillsUpdateRequestParams(string currency, string seckey, int amount, string reference) | ||
{ | ||
|
||
Currency = currency; | ||
SECKEY = seckey; | ||
Amount = amount; | ||
Reference = reference; | ||
|
||
} | ||
|
||
|
||
[JsonProperty("currency")] | ||
public string Currency { get; set; } | ||
|
||
|
||
[JsonProperty("SECKEY")] | ||
public string SECKEY { get; set; } | ||
|
||
[JsonProperty("amount")] | ||
public int Amount { get; set; } | ||
|
||
|
||
[JsonProperty("reference")] | ||
public string Reference { get; set; } | ||
} | ||
} |
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,28 @@ | ||
using System; | ||
using RestSharp; | ||
using Newtonsoft.Json; | ||
namespace Rave.Models.Ebills | ||
{ | ||
public class UpdateOrder | ||
{ | ||
public UpdateOrder() | ||
{ | ||
} | ||
|
||
public string doUpdateOrder(EbillsUpdateRequestParams ebillsupdaterequestparams) | ||
{ | ||
|
||
var client = new RestClient("https://api.ravepay.co/flwv3-pug/getpaidx/api/ebills/update/"); | ||
client.Timeout = -1; | ||
var request = new RestRequest(Method.POST); | ||
request.AddHeader("Content-Type", "application/json"); | ||
request.AddParameter("application/json", JsonConvert.SerializeObject(ebillsupdaterequestparams), ParameterType.RequestBody); | ||
IRestResponse response = client.Execute(request); | ||
Console.WriteLine(response.Content); | ||
|
||
return response.Content; | ||
|
||
} | ||
|
||
} | ||
} |
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,25 @@ | ||
using System; | ||
using RestSharp; | ||
using Newtonsoft.Json; | ||
namespace Rave.Models.Subscriptions | ||
{ | ||
public class ActivateSubscription | ||
{ | ||
public ActivateSubscription() | ||
{ | ||
} | ||
|
||
public string doActivateSubscription(SubscriptionRequestParams activatesubscriptionrequestparams) | ||
{ | ||
var client = new RestClient("https://api.ravepay.co/v2/gpx/subscriptions/"+ activatesubscriptionrequestparams .Id+ "/activate?fetch_by_tx="+activatesubscriptionrequestparams.fetch_by_tx+""); | ||
client.Timeout = -1; | ||
var request = new RestRequest(Method.GET); | ||
request.AddHeader("content-type", "application/json"); | ||
request.AddParameter("application/json", JsonConvert.SerializeObject( new { activatesubscriptionrequestparams.Seckey }), ParameterType.RequestBody); | ||
IRestResponse response = client.Execute(request); | ||
Console.WriteLine(response.Content); | ||
|
||
return response.Content; | ||
} | ||
} | ||
} |
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; | ||
using RestSharp; | ||
using Newtonsoft.Json; | ||
namespace Rave.Models.Subscriptions | ||
{ | ||
public class CancelSubscription | ||
{ | ||
public CancelSubscription() | ||
{ | ||
} | ||
|
||
public string doCancelSubscription(SubscriptionRequestParams cancelsubscriptionrequestparams) | ||
{ | ||
|
||
var client = new RestClient("https://api.ravepay.co/v2/gpx/subscriptions/"+ cancelsubscriptionrequestparams .Id+ "/cancel?fetch_by_tx="+ cancelsubscriptionrequestparams .fetch_by_tx+ ""); | ||
client.Timeout = -1; | ||
var request = new RestRequest(Method.GET); | ||
request.AddHeader("content-type", "application/json"); | ||
request.AddParameter("application/json", JsonConvert.SerializeObject( new { cancelsubscriptionrequestparams.Seckey }), ParameterType.RequestBody); | ||
IRestResponse response = client.Execute(request); | ||
Console.WriteLine(response.Content); | ||
|
||
return response.Content; | ||
} | ||
} | ||
} |
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; | ||
using RestSharp; | ||
using Newtonsoft.Json; | ||
namespace Rave.Models.Subscriptions | ||
{ | ||
public class FetchSubscription | ||
{ | ||
public FetchSubscription() | ||
{ | ||
} | ||
|
||
public string doFetchSubscription(String seckey , String transactionid) | ||
{ | ||
var client = new RestClient("https://api.ravepay.co/v2/gpx/subscriptions/query?seckey="+ seckey + "&transaction_id="+ transactionid + ""); | ||
client.Timeout = -1; | ||
var request = new RestRequest(Method.GET); | ||
request.AddHeader("content-type", "application/json"); | ||
IRestResponse response = client.Execute(request); | ||
Console.WriteLine(response.Content); | ||
|
||
return response.Content; | ||
} | ||
} | ||
} |
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; | ||
using RestSharp; | ||
using Newtonsoft.Json; | ||
namespace Rave.Models.Subscriptions | ||
{ | ||
public class ListSubscriptions | ||
{ | ||
public ListSubscriptions() | ||
{ | ||
} | ||
|
||
public string doListSubscriptions(String seckey) | ||
{ | ||
var client = new RestClient("https://api.ravepay.co/v2/gpx/subscriptions/query?seckey="+ seckey + ""); | ||
client.Timeout = -1; | ||
var request = new RestRequest(Method.GET); | ||
request.AddHeader("content-type", "application/json"); | ||
IRestResponse response = client.Execute(request); | ||
|
||
return response.Content; | ||
} | ||
} | ||
} |
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,32 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Rave.Models.Charge; | ||
using Newtonsoft.Json; | ||
namespace Rave.Models.Subscriptions | ||
{ | ||
public class SubscriptionRequestParams | ||
{ | ||
public SubscriptionRequestParams(string id, string seckey, string fetch_by_tx) | ||
{ | ||
|
||
Id = id; | ||
Seckey = seckey; | ||
fetch_by_tx = "1"; | ||
|
||
} | ||
|
||
|
||
[JsonProperty("id")] | ||
public string Id { get; set; } | ||
|
||
|
||
[JsonProperty("seckey")] | ||
public string Seckey { get; set; } | ||
|
||
[JsonProperty("fetch_by_tx")] | ||
public string fetch_by_tx { get; set; } | ||
|
||
|
||
} | ||
} |
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 |
---|---|---|
@@ -1,10 +1,52 @@ | ||
using System; | ||
using Newtonsoft.Json; | ||
using RestSharp; | ||
|
||
namespace Rave.Models.VirtualAccount | ||
{ | ||
public class VirtualAccount | ||
{ | ||
public VirtualAccount() | ||
{ | ||
} | ||
|
||
public String CreateStaticVirtualAccount(VirtualAccountParams virtualaccountparams) | ||
{ | ||
|
||
var client = new RestClient("https://api.ravepay.co/v2/banktransfers/accountnumbers"); | ||
client.Timeout = -1; | ||
var request = new RestRequest(Method.POST); | ||
request.AddHeader("Content-Type", "application/json"); | ||
request.AddParameter("application/json", JsonConvert.SerializeObject( new { virtualaccountparams.email, virtualaccountparams.Is_permanent, virtualaccountparams.seckey, virtualaccountparams.TxRef, virtualaccountparams.Narration }), ParameterType.RequestBody); | ||
IRestResponse response = client.Execute(request); | ||
Console.WriteLine(response.Content); | ||
return response.Content; | ||
} | ||
|
||
public String CreateTransactionVirtualAccount(VirtualAccountParams virtualaccountparams) | ||
{ | ||
|
||
var client = new RestClient("https://api.ravepay.co/v2/banktransfers/accountnumbers"); | ||
client.Timeout = -1; | ||
var request = new RestRequest(Method.POST); | ||
request.AddHeader("Content-Type", "application/json"); | ||
request.AddParameter("application/json", JsonConvert.SerializeObject(new { virtualaccountparams.seckey, virtualaccountparams.Amount, virtualaccountparams.Narration, virtualaccountparams.email, virtualaccountparams .TxRef}), ParameterType.RequestBody); | ||
IRestResponse response = client.Execute(request); | ||
Console.WriteLine(response.Content); | ||
return response.Content; | ||
} | ||
|
||
public String CreateDurationStaticVirtualAccount(VirtualAccountParams virtualaccountparams) | ||
{ | ||
|
||
var client = new RestClient("https://api.ravepay.co/v2/banktransfers/accountnumbers"); | ||
client.Timeout = -1; | ||
var request = new RestRequest(Method.POST); | ||
request.AddHeader("Content-Type", "application/json"); | ||
request.AddParameter("application/json", JsonConvert.SerializeObject(new { virtualaccountparams.email, virtualaccountparams.Frequency, virtualaccountparams.Narration, virtualaccountparams .Duration, virtualaccountparams .seckey, virtualaccountparams .TxRef}), ParameterType.RequestBody); | ||
IRestResponse response = client.Execute(request); | ||
Console.WriteLine(response.Content); | ||
return response.Content; | ||
} | ||
} | ||
} |
Oops, something went wrong.