Tests and package name updated
This commit is contained in:
22
Runtime/Models/FonepayError.cs
Normal file
22
Runtime/Models/FonepayError.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
|
||||
namespace Darkmatter.Fonepay
|
||||
{
|
||||
public sealed class FonepayError : Exception
|
||||
{
|
||||
public int ErrorCode { get; }
|
||||
public string Docs { get; }
|
||||
|
||||
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})";
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Runtime/Models/FonepayError.cs.meta
Normal file
2
Runtime/Models/FonepayError.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 46adc238f3552442bad6f68d9b2ee68a
|
||||
29
Runtime/Models/QrRequest.cs
Normal file
29
Runtime/Models/QrRequest.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
|
||||
namespace Darkmatter.Fonepay
|
||||
{
|
||||
/// <summary>
|
||||
/// User-facing QR request. Credentials (merchantCode/username/password) and the
|
||||
/// HMAC dataValidation are injected by FonepayApiClient at send time.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public struct QrRequest
|
||||
{
|
||||
public float amount;
|
||||
public string remarks1;
|
||||
public string remarks2;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
internal struct QrRequestPayload
|
||||
{
|
||||
public float amount;
|
||||
public string prn;
|
||||
public string remarks1;
|
||||
public string remarks2;
|
||||
public string merchantCode;
|
||||
public string dataValidation;
|
||||
public string username;
|
||||
public string password;
|
||||
}
|
||||
}
|
||||
2
Runtime/Models/QrRequest.cs.meta
Normal file
2
Runtime/Models/QrRequest.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 255c2e13d0ed54987904cd65a5349d29
|
||||
29
Runtime/Models/QrResponse.cs
Normal file
29
Runtime/Models/QrResponse.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Darkmatter.Fonepay
|
||||
{
|
||||
[Serializable]
|
||||
public struct QrResult
|
||||
{
|
||||
public string message;
|
||||
public Texture2D qrCode;
|
||||
public string status;
|
||||
public int statusCode;
|
||||
public bool success;
|
||||
public string thirdpartyQrWebSocketUrl;
|
||||
public string qrMessage;
|
||||
}
|
||||
|
||||
|
||||
[Serializable]
|
||||
internal struct QrResponse
|
||||
{
|
||||
public string message;
|
||||
public string qrMessage;
|
||||
public string status;
|
||||
public int statusCode;
|
||||
public bool success;
|
||||
public string thirdpartyQrWebSocketUrl;
|
||||
}
|
||||
}
|
||||
3
Runtime/Models/QrResponse.cs.meta
Normal file
3
Runtime/Models/QrResponse.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 405247a27c684f08ab11d6ea33d250c0
|
||||
timeCreated: 1778138521
|
||||
32
Runtime/Models/TaxRefundRequest.cs
Normal file
32
Runtime/Models/TaxRefundRequest.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
|
||||
namespace Darkmatter.Fonepay
|
||||
{
|
||||
/// <summary>
|
||||
/// User-facing tax refund request. Credentials and HMAC dataValidation are
|
||||
/// injected by FonepayApiClient at send time.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public struct TaxRefundRequest
|
||||
{
|
||||
public string fonepayTraceId;
|
||||
public string merchantPRN;
|
||||
public string invoiceNumber;
|
||||
public DateTime invoiceDate;
|
||||
public float transactionAmount;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
internal struct TaxRefundRequestPayload
|
||||
{
|
||||
public string fonepayTraceId;
|
||||
public string merchantPRN;
|
||||
public string invoiceNumber;
|
||||
public string invoiceDate;
|
||||
public float transactionAmount;
|
||||
public string merchantCode;
|
||||
public string dataValidation;
|
||||
public string username;
|
||||
public string password;
|
||||
}
|
||||
}
|
||||
3
Runtime/Models/TaxRefundRequest.cs.meta
Normal file
3
Runtime/Models/TaxRefundRequest.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 328f1e46b5a941bbbf5c0e8294fc9c34
|
||||
timeCreated: 1778140313
|
||||
9
Runtime/Models/TaxRefundResponse.cs
Normal file
9
Runtime/Models/TaxRefundResponse.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Darkmatter.Fonepay
|
||||
{
|
||||
public struct TaxRefundResponse
|
||||
{
|
||||
public string fonepayTraceId;
|
||||
public string message;
|
||||
public bool success;
|
||||
}
|
||||
}
|
||||
3
Runtime/Models/TaxRefundResponse.cs.meta
Normal file
3
Runtime/Models/TaxRefundResponse.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ccdcd51d0dc843eabdb25aa3312bd91a
|
||||
timeCreated: 1778140771
|
||||
3
Runtime/Models/Websocket.meta
Normal file
3
Runtime/Models/Websocket.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b231c6bbbdf4b519ac94e2d745b84c4
|
||||
timeCreated: 1778143935
|
||||
9
Runtime/Models/Websocket/PaymentOutcome.cs
Normal file
9
Runtime/Models/Websocket/PaymentOutcome.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Darkmatter.Fonepay
|
||||
{
|
||||
public enum PaymentOutcome
|
||||
{
|
||||
Failed,
|
||||
Complete,
|
||||
CancelledByUser
|
||||
}
|
||||
}
|
||||
2
Runtime/Models/Websocket/PaymentOutcome.cs.meta
Normal file
2
Runtime/Models/Websocket/PaymentOutcome.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b18f877972094e3993a95d2ae363f12a
|
||||
27
Runtime/Models/Websocket/QRPaymentStatus.cs
Normal file
27
Runtime/Models/Websocket/QRPaymentStatus.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
|
||||
namespace Darkmatter.Fonepay
|
||||
{
|
||||
[Serializable]
|
||||
public struct QRPaymentStatus
|
||||
{
|
||||
public string remarks1;
|
||||
public string remarks2;
|
||||
public string 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,
|
||||
};
|
||||
}
|
||||
}
|
||||
3
Runtime/Models/Websocket/QRPaymentStatus.cs.meta
Normal file
3
Runtime/Models/Websocket/QRPaymentStatus.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ee6badc7f924737865c86113de9d2ac
|
||||
timeCreated: 1778144200
|
||||
12
Runtime/Models/Websocket/QRVerificationStatus.cs
Normal file
12
Runtime/Models/Websocket/QRVerificationStatus.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace Darkmatter.Fonepay
|
||||
{
|
||||
[Serializable]
|
||||
public struct QRVerificationStatus
|
||||
{
|
||||
public bool success;
|
||||
public string message;
|
||||
public bool qrVerified;
|
||||
}
|
||||
}
|
||||
3
Runtime/Models/Websocket/QRVerificationStatus.cs.meta
Normal file
3
Runtime/Models/Websocket/QRVerificationStatus.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f26424156fc543c487793821806dd8c7
|
||||
timeCreated: 1778144700
|
||||
9
Runtime/Models/Websocket/TransactionStatus.cs
Normal file
9
Runtime/Models/Websocket/TransactionStatus.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace Darkmatter.Fonepay
|
||||
{
|
||||
[Serializable]
|
||||
public struct TransactionStatus
|
||||
{
|
||||
}
|
||||
}
|
||||
3
Runtime/Models/Websocket/TransactionStatus.cs.meta
Normal file
3
Runtime/Models/Websocket/TransactionStatus.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d83df4253afa4d4b968ad3b8c88da203
|
||||
timeCreated: 1778143652
|
||||
14
Runtime/Models/Websocket/WebsocketMessage.cs
Normal file
14
Runtime/Models/Websocket/WebsocketMessage.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Darkmatter.Fonepay
|
||||
{
|
||||
[Serializable]
|
||||
public struct WebsocketMessage<T>
|
||||
{
|
||||
public string merchantId;
|
||||
public string deviceId;
|
||||
public string transactionStatus;
|
||||
public T Status => JsonUtility.FromJson<T>(transactionStatus);
|
||||
}
|
||||
}
|
||||
3
Runtime/Models/Websocket/WebsocketMessage.cs.meta
Normal file
3
Runtime/Models/Websocket/WebsocketMessage.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f74983b79502486a891686f80f33737c
|
||||
timeCreated: 1778143616
|
||||
Reference in New Issue
Block a user