Impliment soft-payments
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
namespace Controllers.Payment {
|
||||
|
||||
public class PaymentTestor : IPayment {
|
||||
|
||||
public static List<string> ImpodentKeys = new List<string>();
|
||||
|
||||
public (bool, string) CreatePayment() {
|
||||
string guid = Guid.NewGuid().ToString();
|
||||
ImpodentKeys.Add(guid);
|
||||
return (true, guid);
|
||||
}
|
||||
|
||||
public (bool, string) TryPayment(string ImpodentKey, float Price) {
|
||||
try {
|
||||
if (ImpodentKeys.Contains(ImpodentKey)) {
|
||||
ImpodentKeys.Remove(ImpodentKey);
|
||||
return (true, "");
|
||||
} else {
|
||||
return (false, "Payment session closed or never existed");
|
||||
}
|
||||
}catch(Exception e) {
|
||||
return (false, e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user