Skip to content

Commit

Permalink
Merge pull request #69 from entdark/best2pay
Browse files Browse the repository at this point in the history
Best2pay enhancements
  • Loading branch information
pocheshire committed Jun 12, 2019
2 parents a30bdd3 + 20b6ddb commit cc0e9f1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/app-ropio/AppRopio.Payments/Best2Pay/API/Best2Pay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class Best2Pay

public bool IsTest { get; set; }

public Best2Pay(int sector, string password, string forwardUrl, string forwardVerifyUrl)
public Best2Pay(int sector, string password, string forwardUrl, string forwardVerifyUrl, bool test)
{
_password = password;
_sector = sector;
Expand All @@ -24,7 +24,7 @@ public Best2Pay(int sector, string password, string forwardUrl, string forwardVe
#if DEBUG
IsTest = true;
#else
IsTest = false;
IsTest = test;
#endif
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public string RequestString(int sector, string password, string forwardURL)
if (ID != -1) data += "&id=" + ID;
if (!string.IsNullOrEmpty(firstname) && firstname.Length != 0) data += "&firstname=" + firstname;
if (!string.IsNullOrEmpty(lastname) && lastname.Length != 0) data += "&lastname=" + lastname;
if (email.Length != 0) data += "&email=" + email;
if (!string.IsNullOrEmpty(email) && email.Length != 0) data += "&email=" + email;
data += "&wm=" + (wm ? "1" : "0");
data += "&ym=" + (ym ? "1" : "0");
data += "&qiwi=" + (qiwi ? "1" : "0");
Expand All @@ -48,7 +48,7 @@ public string RequestString(int sector, string password, string forwardURL)

if (!string.IsNullOrEmpty(lastname) && lastname.Length != 0) data.Add("lastname", lastname);

if (email.Length != 0) data.Add("email", email);
if (!string.IsNullOrEmpty(email) && email.Length != 0) data.Add("email", email);

data.Add("wm", (wm ? "1" : "0"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public string RequestString(int sector, string password, string forwardURL)
if (description.Length != 0) data += "&description=" + description;
data += "&sector=" + sector;
data += "&url=" + forwardURL;
if (email.Length != 0) data += "&email=" + email;
if (phone.Length != 0) data += "&phone=" + phone;
if (!string.IsNullOrEmpty(email) && email.Length != 0) data += "&email=" + email;
if (!string.IsNullOrEmpty(phone) && phone.Length != 0) data += "&phone=" + phone;
if (signature.Length != 0) data += "&signature=" + signature;
if (bank_name.Length != 0) data += "&bank_name=" + bank_name;
if (address.Length != 0) data += "&address=" + address;
Expand Down Expand Up @@ -71,9 +71,9 @@ public string RequestString(int sector, string password, string forwardURL)
data.Add("sector", sector.ToString());
data.Add("url", forwardURL);

if (email.Length != 0) data.Add("email", email);
if (!string.IsNullOrEmpty(email) && email.Length != 0) data.Add("email", email);

if (phone.Length != 0) data.Add("phone", phone);
if (!string.IsNullOrEmpty(phone) && phone.Length != 0) data.Add("phone", phone);

if (signature.Length != 0) data.Add("signature", signature);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
namespace AppRopio.Payments.Best2Pay.Core.Models
namespace AppRopio.Payments.Best2Pay.Core.Models
{
public class Best2PayConfig
{
Expand All @@ -8,5 +7,7 @@ public class Best2PayConfig
public string Password { get; set; }

public bool EPayment { get; set; }

public bool Test { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public Best2PayVmService()
_forwardUrl = platform == PlatformType.iPhone || platform == PlatformType.iPad ? @"https://best2pay.ru/mobileAPI/iOS" : @"https://best2pay.ru/mobileAPI/Android";
_forwardVerifyUrl = "https://best2pay.ru/mobileAPI/Phone";

_best2Pay = new API.Best2Pay(Config.Sector, Config.Password, _forwardUrl, _forwardVerifyUrl);
_best2Pay = new API.Best2Pay(Config.Sector, Config.Password, _forwardUrl, _forwardVerifyUrl, Config.Test);
}

public async Task<PaymentOrderInfo> GetPaymentInfo(string orderId)
Expand Down

0 comments on commit cc0e9f1

Please sign in to comment.