Class MoneyInService
Inheritance
Implements
Namespace: DirectScale.Disco.Extension.Services
Assembly: DirectScale.Disco.Extension.Abstractions.dll
Syntax
public class MoneyInService : Object, IMoneyInService
Constructors
MoneyInService(IApiService)
Declaration
public MoneyInService(IApiService apiService)
Parameters
| Type | Name | Description |
|---|---|---|
| IApiService | apiService |
Methods
GetAddPaymentIframe(String, Int32, Int32, String, Address)
Finds any merchant that this associateId can use in this storeId and returns Iframe information that can be used to display a form for payment input.
Use
Declaration
public Task<Iframe> GetAddPaymentIframe(string frameId, int associateId, int storeId, string languageCode, Address fallbackAddress)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | frameId | Unused. |
| System.Int32 | associateId | Associate adding a payment. |
| System.Int32 | storeId | The store being used. |
| System.String | languageCode | The associate's prefered language. |
| Address | fallbackAddress | Used to find associate's region if associate doesn't have a address set. Also, must always have CountryCode set. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<Iframe> | Iframe information that can be used to display a form for an associate to fill out to add a payment method. |
GetBalance(Int32, Int32, String)
Get's the associateId's balance with merchantId if merchant CanGetBalance.
Declaration
public Task<string> GetBalance(int merchantId, int associateId, string currencyCode)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | merchantId | The merchant that can store balances. |
| System.Int32 | associateId | The associate with a balance. |
| System.String | currencyCode | The currency being used. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.String> | A string representation of the balance, possibly null. |
Remarks
This was used to display the balance to the user, so a string is returned and may be formatted with special currency symbols ($, €). Parsing may be required if this value needs to be used in other ways.
GetPaymentMethods(Int32, Int32)
Gets all the payment methods available for associateId to use in storeId.
Declaration
public Task<Payment[]> GetPaymentMethods(int associateId, int storeId)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | associateId | The associate making a purchase. |
| System.Int32 | storeId | The store being used for purchase. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<Payment[]> | Payment merchants that can be used for purchase, or an empty array if none found. |
SavePaymentMethod(Int32, Payment)
Saves a new payment method for associateId.
Declaration
public Task<Payment> SavePaymentMethod(int associateId, Payment payment)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | associateId | The associate with the payment. |
| Payment | payment | The new payment information. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<Payment> | The found payment method or null. |
See Also
ValidateCurrency(Int32, String)
Should throw an exception if merchantId can't accept paymentCurrencyCode.
Declaration
public Task ValidateCurrency(int merchantId, string paymentCurrencyCode)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | merchantId | Merchant being used. |
| System.String | paymentCurrencyCode | Currency being used. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task |
Exceptions
| Type | Condition |
|---|---|
| System.NotImplementedException | Always. |