Fixes and sample
This commit is contained in:
@@ -5,11 +5,18 @@ namespace Darkmatter.Fonepay
|
||||
public sealed class FonepayError : Exception
|
||||
{
|
||||
public int ErrorCode { get; }
|
||||
public string Docs { get; }
|
||||
|
||||
public FonepayError(int errorCode, string message,
|
||||
string docs)
|
||||
public FonepayError(int errorCode, string message, string docs)
|
||||
: base(message)
|
||||
{
|
||||
ErrorCode = errorCode;
|
||||
Docs = docs ?? throw new ArgumentNullException(nameof(docs));
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{base.ToString()} (ErrorCode: {ErrorCode}, Docs: {Docs})";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,10 +10,8 @@ namespace Darkmatter.Fonepay
|
||||
public struct QrRequest
|
||||
{
|
||||
public float amount;
|
||||
public string prn;
|
||||
public string remarks1;
|
||||
public string remarks2;
|
||||
public string pm;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
@@ -23,7 +21,6 @@ namespace Darkmatter.Fonepay
|
||||
public string prn;
|
||||
public string remarks1;
|
||||
public string remarks2;
|
||||
public string pm;
|
||||
public string merchantCode;
|
||||
public string dataValidation;
|
||||
public string username;
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b231c6bbbdf4b519ac94e2d745b84c4
|
||||
timeCreated: 1778143935
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Darkmatter.Fonepay
|
||||
{
|
||||
public enum PaymentOutcome
|
||||
{
|
||||
Failed,
|
||||
Complete,
|
||||
CancelledByUser
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b18f877972094e3993a95d2ae363f12a
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
|
||||
namespace Darkmatter.Fonepay
|
||||
{
|
||||
[Serializable]
|
||||
public struct QRPaymentStatus
|
||||
{
|
||||
public string remarks1;
|
||||
public string remarks2;
|
||||
public DateTime transactionDate;
|
||||
public string productNumber;
|
||||
public float amount;
|
||||
public string message;
|
||||
public bool success;
|
||||
public string commissionType;
|
||||
public float commissionAmount;
|
||||
public float totalCalculatedAmount;
|
||||
public bool paymentSuccess;
|
||||
|
||||
public PaymentOutcome Outcome => (success, paymentSuccess) switch
|
||||
{
|
||||
(true, true) => PaymentOutcome.Complete,
|
||||
(true, false) => PaymentOutcome.CancelledByUser,
|
||||
(false, _) => PaymentOutcome.Failed,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ee6badc7f924737865c86113de9d2ac
|
||||
timeCreated: 1778144200
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace Darkmatter.Fonepay
|
||||
{
|
||||
[Serializable]
|
||||
public struct QRVerificationStatus
|
||||
{
|
||||
public bool success;
|
||||
public string message;
|
||||
public bool qrVerified;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f26424156fc543c487793821806dd8c7
|
||||
timeCreated: 1778144700
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace Darkmatter.Fonepay
|
||||
{
|
||||
[Serializable]
|
||||
public struct TransactionStatus
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d83df4253afa4d4b968ad3b8c88da203
|
||||
timeCreated: 1778143652
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Darkmatter.Fonepay
|
||||
{
|
||||
[Serializable]
|
||||
public struct WebsocketMessage<T>
|
||||
{
|
||||
public string merchantId;
|
||||
public string deviceId;
|
||||
public string transactionStatus;
|
||||
private T _status;
|
||||
public T Status => _status ??= JsonUtility.FromJson<T>(transactionStatus);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f74983b79502486a891686f80f33737c
|
||||
timeCreated: 1778143616
|
||||
Reference in New Issue
Block a user