-
-
Save t-rekttt/02bb0e6eceb04cdf84ff3ab9c24274b8 to your computer and use it in GitHub Desktop.
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
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Runtime.CompilerServices; | |
using System.Threading.Tasks; | |
namespace Y | |
{ | |
public class AccountService : APIService | |
{ | |
public AccountService() | |
{ | |
} | |
public static Task<User> AutoLogin() | |
{ | |
string str = "autosigninwithip/"; | |
string pAddress = App.NativeHelper.GetIPAddress(); | |
if (pAddress.IsEmpty()) | |
{ | |
return Task.FromResult<User>(null); | |
} | |
return APIService.Post<User>(str, pAddress, false, false); | |
} | |
public static Task<string> ChangeLanguage() | |
{ | |
return APIService.Put<string>(string.Concat("setlang/", Settings.CurrentUser.Msisdn, "/", APIService.LanguageInfo), null, false, false); | |
} | |
public static Task<string> CheckPaymentStatus(string orderId) | |
{ | |
return APIService.Get<string>(string.Concat("trx/paymentstatus/", orderId), false, false); | |
} | |
public static Task<string> CheckSubscriber(string msisdn) | |
{ | |
return APIService.Get<string>(string.Concat("subscriberexists/", msisdn), false, false); | |
} | |
public static Task<List<TopupHistory>> GetMonthlyTopupHistory() | |
{ | |
string msisdn; | |
User currentUser = Settings.CurrentUser; | |
if (currentUser != null) | |
{ | |
msisdn = currentUser.Msisdn; | |
} | |
else | |
{ | |
msisdn = null; | |
} | |
return APIService.Get<List<TopupHistory>>(string.Concat("subscriber/monthlytopuphistory/", msisdn), false, false); | |
} | |
public static Task<string> GetNapasHTML(string orderID) | |
{ | |
return APIService.Get<string>(string.Concat("pg/executepayment?orderId=", orderID, "&clientAppId=MOBILE_APP"), false, false); | |
} | |
public static Task<GetNotificationResponse> GetNofitication() | |
{ | |
return APIService.Get<GetNotificationResponse>(string.Concat("pushedcampaign/get/", Settings.CurrentUser.Msisdn), false, false); | |
} | |
public static Task<string> GetOrderId(double amount, string itemCode = null) | |
{ | |
if (itemCode.IsEmpty()) | |
{ | |
int num = (new Random()).Next(1000000, 9999999); | |
itemCode = num.ToString(); | |
} | |
return APIService.Get<string>(string.Concat(new object[] { "trx/initpayment/", Settings.CurrentUser.Msisdn, "/", itemCode, "/", amount, "/E_TOPUP" }), false, false); | |
} | |
public static async Task GetOTP(string msisdn) | |
{ | |
object[] objArray = new object[] { msisdn, APIService.LanguageInfo }; | |
await APIService.Get(string.Format("getotp/{0}/{1}", objArray)); | |
} | |
public static Task<User> GetProfile() | |
{ | |
string msisdn; | |
User currentUser = Settings.CurrentUser; | |
if (currentUser != null) | |
{ | |
msisdn = currentUser.Msisdn; | |
} | |
else | |
{ | |
msisdn = null; | |
} | |
return APIService.Get<User>(string.Concat("subscriber/details/", msisdn), false, false); | |
} | |
public static Task<User> GetProfile(string msisdn) | |
{ | |
return APIService.Get<User>(string.Concat("subscriber/details/", msisdn), false, false); | |
} | |
public static Task<List<CallHistory>> GetWeeklyCallHistory() | |
{ | |
return APIService.Get<List<CallHistory>>(string.Concat("subscriber/weeklycallhistory/", Settings.CurrentUser.Msisdn), false, false); | |
} | |
public static Task<List<SMSHistory>> GetWeeklySMSHistory() | |
{ | |
return APIService.Get<List<SMSHistory>>(string.Concat("subscriber/weeklysmshistory/", Settings.CurrentUser.Msisdn), false, false); | |
} | |
public static Task<User> Login(string username, string password) | |
{ | |
var variable = new { loginId = username, credential = password }; | |
return APIService.Post<User>("login/", variable, false, false); | |
} | |
public static Task<string> Register(string msisdn, string password, string otp) | |
{ | |
return APIService.Post<string>(string.Format("register/", new object[0]), new { loginId = msisdn, credential = password, otp = otp }, false, false); | |
} | |
public static Task<string> ResetPassword(string msisdn, string password, string otp) | |
{ | |
return APIService.Put<string>("resetpassword/", new { loginId = msisdn, password = password, otp = otp }, false, false); | |
} | |
public static Task<string> TopUp(string msisdn, string voucherCode) | |
{ | |
return APIService.Post<string>(string.Format("subscriber/topup/{0}/{1}/{2}", new object[] { Settings.CurrentUser.Msisdn, voucherCode, msisdn }), null, false, false); | |
} | |
public static Task TopUpSuccessfulNotification(double amount) | |
{ | |
return APIService.Get(string.Concat(new object[] { "subscriber/etopup/", Settings.CurrentUser.Msisdn, "/", amount })); | |
} | |
public static Task<UploadImageResponse> UploadImage(string imageBase64) | |
{ | |
return APIService.Post<UploadImageResponse>("avatar/upload/", new { msisdn = Settings.CurrentUser.Msisdn, encodedImage = imageBase64, imageFormat = "jpg" }, false, false); | |
} | |
public static Task<ValidateNumberResponse> ValidateNumbers(List<string> numbers) | |
{ | |
return APIService.Post<ValidateNumberResponse>("validatenumbers/", new { numbers = numbers }, false, false); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment