fees
This commit is contained in:
parent
87925fad74
commit
8f8261f797
5 changed files with 2229 additions and 2123 deletions
|
|
@ -95,9 +95,9 @@ The nostr server will send back a message response, and inside the body there wi
|
||||||
|
|
||||||
- __User__:
|
- __User__:
|
||||||
- expected context content
|
- expected context content
|
||||||
- __user_id__: _string_
|
|
||||||
- __app_id__: _string_
|
- __app_id__: _string_
|
||||||
- __app_user_id__: _string_
|
- __app_user_id__: _string_
|
||||||
|
- __user_id__: _string_
|
||||||
|
|
||||||
- __Admin__:
|
- __Admin__:
|
||||||
- expected context content
|
- expected context content
|
||||||
|
|
@ -372,81 +372,96 @@ The nostr server will send back a message response, and inside the body there wi
|
||||||
## Messages
|
## Messages
|
||||||
### The content of requests and response from the methods
|
### The content of requests and response from the methods
|
||||||
|
|
||||||
### AppUser
|
|
||||||
- __identifier__: _string_
|
|
||||||
- __info__: _[UserInfo](#UserInfo)_
|
|
||||||
- __max_withdrawable__: _number_
|
|
||||||
|
|
||||||
### PayAppUserInvoiceResponse
|
|
||||||
- __preimage__: _string_
|
|
||||||
- __amount_paid__: _number_
|
|
||||||
|
|
||||||
### SetMockAppUserBalanceRequest
|
|
||||||
- __user_identifier__: _string_
|
|
||||||
- __amount__: _number_
|
|
||||||
|
|
||||||
### AuthAppRequest
|
|
||||||
- __name__: _string_
|
|
||||||
- __allow_user_creation__: _boolean_ *this field is optional
|
|
||||||
|
|
||||||
### AuthApp
|
|
||||||
- __app__: _[Application](#Application)_
|
|
||||||
- __auth_token__: _string_
|
|
||||||
|
|
||||||
### SetMockAppBalanceRequest
|
|
||||||
- __amount__: _number_
|
|
||||||
|
|
||||||
### PayInvoiceRequest
|
|
||||||
- __invoice__: _string_
|
|
||||||
- __amount__: _number_
|
|
||||||
|
|
||||||
### EncryptionExchangeRequest
|
### EncryptionExchangeRequest
|
||||||
- __publicKey__: _string_
|
- __publicKey__: _string_
|
||||||
- __deviceId__: _string_
|
- __deviceId__: _string_
|
||||||
|
|
||||||
### OpenChannelRequest
|
### Application
|
||||||
- __destination__: _string_
|
- __name__: _string_
|
||||||
- __fundingAmount__: _number_
|
- __id__: _string_
|
||||||
- __pushAmount__: _number_
|
- __balance__: _number_
|
||||||
- __closeAddress__: _string_
|
- __npub__: _string_
|
||||||
|
|
||||||
### GetUserOperationsRequest
|
### AddAppInvoiceRequest
|
||||||
- __latestIncomingInvoice__: _number_
|
|
||||||
- __latestOutgoingInvoice__: _number_
|
|
||||||
- __latestIncomingTx__: _number_
|
|
||||||
- __latestOutgoingTx__: _number_
|
|
||||||
- __latestIncomingUserToUserPayment__: _number_
|
|
||||||
- __latestOutgoingUserToUserPayment__: _number_
|
|
||||||
|
|
||||||
### GetProductBuyLinkResponse
|
|
||||||
- __link__: _string_
|
|
||||||
|
|
||||||
### PayInvoiceResponse
|
|
||||||
- __preimage__: _string_
|
|
||||||
- __amount_paid__: _number_
|
|
||||||
- __operation_id__: _string_
|
|
||||||
|
|
||||||
### LnurlLinkResponse
|
|
||||||
- __lnurl__: _string_
|
|
||||||
- __k1__: _string_
|
|
||||||
|
|
||||||
### AddAppUserInvoiceRequest
|
|
||||||
- __receiver_identifier__: _string_
|
|
||||||
- __payer_identifier__: _string_
|
- __payer_identifier__: _string_
|
||||||
- __http_callback_url__: _string_
|
- __http_callback_url__: _string_
|
||||||
- __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_
|
- __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_
|
||||||
|
|
||||||
|
### GetAppUserRequest
|
||||||
|
- __user_identifier__: _string_
|
||||||
|
|
||||||
|
### SetMockAppBalanceRequest
|
||||||
|
- __amount__: _number_
|
||||||
|
|
||||||
|
### NewAddressResponse
|
||||||
|
- __address__: _string_
|
||||||
|
|
||||||
|
### PayAddressResponse
|
||||||
|
- __txId__: _string_
|
||||||
|
- __operation_id__: _string_
|
||||||
|
- __service_fee__: _number_
|
||||||
|
- __network_fee__: _number_
|
||||||
|
|
||||||
|
### NewInvoiceRequest
|
||||||
|
- __amountSats__: _number_
|
||||||
|
- __memo__: _string_
|
||||||
|
|
||||||
|
### SetMockInvoiceAsPaidRequest
|
||||||
|
- __invoice__: _string_
|
||||||
|
- __amount__: _number_
|
||||||
|
|
||||||
|
### AddAppUserRequest
|
||||||
|
- __identifier__: _string_
|
||||||
|
- __fail_if_exists__: _boolean_
|
||||||
|
- __balance__: _number_
|
||||||
|
|
||||||
|
### SendAppUserToAppUserPaymentRequest
|
||||||
|
- __from_user_identifier__: _string_
|
||||||
|
- __to_user_identifier__: _string_
|
||||||
|
- __amount__: _number_
|
||||||
|
|
||||||
|
### NewAddressRequest
|
||||||
|
- __addressType__: _[AddressType](#AddressType)_
|
||||||
|
|
||||||
|
### HandleLnurlPayResponse
|
||||||
|
- __pr__: _string_
|
||||||
|
- __routes__: ARRAY of: _[Empty](#Empty)_
|
||||||
|
|
||||||
|
### Product
|
||||||
|
- __id__: _string_
|
||||||
|
- __name__: _string_
|
||||||
|
- __price_sats__: _number_
|
||||||
|
|
||||||
### PayAppUserInvoiceRequest
|
### PayAppUserInvoiceRequest
|
||||||
- __user_identifier__: _string_
|
- __user_identifier__: _string_
|
||||||
- __invoice__: _string_
|
- __invoice__: _string_
|
||||||
- __amount__: _number_
|
- __amount__: _number_
|
||||||
|
|
||||||
### NewInvoiceRequest
|
### PayAppUserInvoiceResponse
|
||||||
- __amountSats__: _number_
|
- __preimage__: _string_
|
||||||
- __memo__: _string_
|
- __amount_paid__: _number_
|
||||||
|
|
||||||
### DecodeInvoiceRequest
|
### GetAppUserLNURLInfoRequest
|
||||||
- __invoice__: _string_
|
- __user_identifier__: _string_
|
||||||
|
- __base_url_override__: _string_
|
||||||
|
|
||||||
|
### PayAddressRequest
|
||||||
|
- __address__: _string_
|
||||||
|
- __amoutSats__: _number_
|
||||||
|
- __satsPerVByte__: _number_
|
||||||
|
|
||||||
|
### PayInvoiceResponse
|
||||||
|
- __preimage__: _string_
|
||||||
|
- __amount_paid__: _number_
|
||||||
|
- __operation_id__: _string_
|
||||||
|
- __service_fee__: _number_
|
||||||
|
- __network_fee__: _number_
|
||||||
|
|
||||||
|
### OpenChannelRequest
|
||||||
|
- __destination__: _string_
|
||||||
|
- __fundingAmount__: _number_
|
||||||
|
- __pushAmount__: _number_
|
||||||
|
- __closeAddress__: _string_
|
||||||
|
|
||||||
### LnurlWithdrawInfoResponse
|
### LnurlWithdrawInfoResponse
|
||||||
- __tag__: _string_
|
- __tag__: _string_
|
||||||
|
|
@ -458,12 +473,13 @@ The nostr server will send back a message response, and inside the body there wi
|
||||||
- __balanceCheck__: _string_
|
- __balanceCheck__: _string_
|
||||||
- __payLink__: _string_
|
- __payLink__: _string_
|
||||||
|
|
||||||
### LnurlPayInfoResponse
|
### GetUserOperationsRequest
|
||||||
- __tag__: _string_
|
- __latestIncomingInvoice__: _number_
|
||||||
- __callback__: _string_
|
- __latestOutgoingInvoice__: _number_
|
||||||
- __maxSendable__: _number_
|
- __latestIncomingTx__: _number_
|
||||||
- __minSendable__: _number_
|
- __latestOutgoingTx__: _number_
|
||||||
- __metadata__: _string_
|
- __latestIncomingUserToUserPayment__: _number_
|
||||||
|
- __latestOutgoingUserToUserPayment__: _number_
|
||||||
|
|
||||||
### UserOperation
|
### UserOperation
|
||||||
- __paidAtUnix__: _number_
|
- __paidAtUnix__: _number_
|
||||||
|
|
@ -472,64 +488,21 @@ The nostr server will send back a message response, and inside the body there wi
|
||||||
- __amount__: _number_
|
- __amount__: _number_
|
||||||
- __identifier__: _string_
|
- __identifier__: _string_
|
||||||
- __operationId__: _string_
|
- __operationId__: _string_
|
||||||
|
- __service_fee__: _number_
|
||||||
### UserOperations
|
- __network_fee__: _number_
|
||||||
- __fromIndex__: _number_
|
|
||||||
- __toIndex__: _number_
|
|
||||||
- __operations__: ARRAY of: _[UserOperation](#UserOperation)_
|
|
||||||
|
|
||||||
### LndGetInfoRequest
|
|
||||||
- __nodeId__: _number_
|
|
||||||
|
|
||||||
### Application
|
|
||||||
- __name__: _string_
|
|
||||||
- __id__: _string_
|
|
||||||
- __balance__: _number_
|
|
||||||
- __npub__: _string_
|
|
||||||
|
|
||||||
### GetAppUserRequest
|
|
||||||
- __user_identifier__: _string_
|
|
||||||
|
|
||||||
### NewAddressResponse
|
|
||||||
- __address__: _string_
|
|
||||||
|
|
||||||
### AddProductRequest
|
|
||||||
- __name__: _string_
|
|
||||||
- __price_sats__: _number_
|
|
||||||
|
|
||||||
### PayAddressResponse
|
|
||||||
- __txId__: _string_
|
|
||||||
- __operation_id__: _string_
|
|
||||||
|
|
||||||
### LiveUserOperation
|
### LiveUserOperation
|
||||||
- __id__: _string_
|
- __id__: _string_
|
||||||
- __operation__: _[UserOperation](#UserOperation)_
|
- __operation__: _[UserOperation](#UserOperation)_
|
||||||
|
|
||||||
### AddAppRequest
|
### Empty
|
||||||
- __name__: _string_
|
|
||||||
- __allow_user_creation__: _boolean_
|
|
||||||
|
|
||||||
### AddAppUserRequest
|
### AddAppUserInvoiceRequest
|
||||||
- __identifier__: _string_
|
- __receiver_identifier__: _string_
|
||||||
- __fail_if_exists__: _boolean_
|
|
||||||
- __balance__: _number_
|
|
||||||
|
|
||||||
### AddAppInvoiceRequest
|
|
||||||
- __payer_identifier__: _string_
|
- __payer_identifier__: _string_
|
||||||
- __http_callback_url__: _string_
|
- __http_callback_url__: _string_
|
||||||
- __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_
|
- __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_
|
||||||
|
|
||||||
### NewAddressRequest
|
|
||||||
- __addressType__: _[AddressType](#AddressType)_
|
|
||||||
|
|
||||||
### NewInvoiceResponse
|
|
||||||
- __invoice__: _string_
|
|
||||||
|
|
||||||
### UserInfo
|
|
||||||
- __userId__: _string_
|
|
||||||
- __balance__: _number_
|
|
||||||
- __max_withdrawable__: _number_
|
|
||||||
|
|
||||||
### GetUserOperationsResponse
|
### GetUserOperationsResponse
|
||||||
- __latestOutgoingInvoiceOperations__: _[UserOperations](#UserOperations)_
|
- __latestOutgoingInvoiceOperations__: _[UserOperations](#UserOperations)_
|
||||||
- __latestIncomingInvoiceOperations__: _[UserOperations](#UserOperations)_
|
- __latestIncomingInvoiceOperations__: _[UserOperations](#UserOperations)_
|
||||||
|
|
@ -538,46 +511,79 @@ The nostr server will send back a message response, and inside the body there wi
|
||||||
- __latestOutgoingUserToUserPayemnts__: _[UserOperations](#UserOperations)_
|
- __latestOutgoingUserToUserPayemnts__: _[UserOperations](#UserOperations)_
|
||||||
- __latestIncomingUserToUserPayemnts__: _[UserOperations](#UserOperations)_
|
- __latestIncomingUserToUserPayemnts__: _[UserOperations](#UserOperations)_
|
||||||
|
|
||||||
### Product
|
### AddProductRequest
|
||||||
- __id__: _string_
|
|
||||||
- __name__: _string_
|
- __name__: _string_
|
||||||
- __price_sats__: _number_
|
- __price_sats__: _number_
|
||||||
|
|
||||||
### Empty
|
### AddAppRequest
|
||||||
|
- __name__: _string_
|
||||||
|
- __allow_user_creation__: _boolean_
|
||||||
|
|
||||||
### SendAppUserToAppUserPaymentRequest
|
### AuthAppRequest
|
||||||
- __from_user_identifier__: _string_
|
- __name__: _string_
|
||||||
- __to_user_identifier__: _string_
|
- __allow_user_creation__: _boolean_ *this field is optional
|
||||||
|
|
||||||
|
### AppUser
|
||||||
|
- __identifier__: _string_
|
||||||
|
- __info__: _[UserInfo](#UserInfo)_
|
||||||
|
- __max_withdrawable__: _number_
|
||||||
|
|
||||||
|
### SetMockAppUserBalanceRequest
|
||||||
|
- __user_identifier__: _string_
|
||||||
- __amount__: _number_
|
- __amount__: _number_
|
||||||
|
|
||||||
|
### DecodeInvoiceResponse
|
||||||
|
- __amount__: _number_
|
||||||
|
|
||||||
|
### UserOperations
|
||||||
|
- __fromIndex__: _number_
|
||||||
|
- __toIndex__: _number_
|
||||||
|
- __operations__: ARRAY of: _[UserOperation](#UserOperation)_
|
||||||
|
|
||||||
|
### GetProductBuyLinkResponse
|
||||||
|
- __link__: _string_
|
||||||
|
|
||||||
|
### NewInvoiceResponse
|
||||||
|
- __invoice__: _string_
|
||||||
|
|
||||||
|
### LnurlPayInfoResponse
|
||||||
|
- __tag__: _string_
|
||||||
|
- __callback__: _string_
|
||||||
|
- __maxSendable__: _number_
|
||||||
|
- __minSendable__: _number_
|
||||||
|
- __metadata__: _string_
|
||||||
|
|
||||||
|
### LndGetInfoRequest
|
||||||
|
- __nodeId__: _number_
|
||||||
|
|
||||||
### SendAppUserToAppPaymentRequest
|
### SendAppUserToAppPaymentRequest
|
||||||
- __from_user_identifier__: _string_
|
- __from_user_identifier__: _string_
|
||||||
- __amount__: _number_
|
- __amount__: _number_
|
||||||
|
|
||||||
### GetAppUserLNURLInfoRequest
|
### DecodeInvoiceRequest
|
||||||
- __user_identifier__: _string_
|
- __invoice__: _string_
|
||||||
- __base_url_override__: _string_
|
|
||||||
|
|
||||||
### OpenChannelResponse
|
### OpenChannelResponse
|
||||||
- __channelId__: _string_
|
- __channelId__: _string_
|
||||||
|
|
||||||
### HandleLnurlPayResponse
|
### LnurlLinkResponse
|
||||||
- __pr__: _string_
|
- __lnurl__: _string_
|
||||||
- __routes__: ARRAY of: _[Empty](#Empty)_
|
- __k1__: _string_
|
||||||
|
|
||||||
### SetMockInvoiceAsPaidRequest
|
### UserInfo
|
||||||
- __invoice__: _string_
|
- __userId__: _string_
|
||||||
- __amount__: _number_
|
- __balance__: _number_
|
||||||
|
- __max_withdrawable__: _number_
|
||||||
|
|
||||||
### LndGetInfoResponse
|
### LndGetInfoResponse
|
||||||
- __alias__: _string_
|
- __alias__: _string_
|
||||||
|
|
||||||
### PayAddressRequest
|
### AuthApp
|
||||||
- __address__: _string_
|
- __app__: _[Application](#Application)_
|
||||||
- __amoutSats__: _number_
|
- __auth_token__: _string_
|
||||||
- __satsPerVByte__: _number_
|
|
||||||
|
|
||||||
### DecodeInvoiceResponse
|
### PayInvoiceRequest
|
||||||
|
- __invoice__: _string_
|
||||||
- __amount__: _number_
|
- __amount__: _number_
|
||||||
## Enums
|
## Enums
|
||||||
### The enumerators used in the messages
|
### The enumerators used in the messages
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -133,7 +133,9 @@ message PayAddressRequest{
|
||||||
|
|
||||||
message PayAddressResponse{
|
message PayAddressResponse{
|
||||||
string txId = 1;
|
string txId = 1;
|
||||||
string operation_id = ;
|
string operation_id = 2;
|
||||||
|
int64 service_fee = 3;
|
||||||
|
int64 network_fee = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
message NewInvoiceRequest{
|
message NewInvoiceRequest{
|
||||||
|
|
@ -159,6 +161,8 @@ message PayInvoiceResponse{
|
||||||
string preimage = 1;
|
string preimage = 1;
|
||||||
int64 amount_paid = 2;
|
int64 amount_paid = 2;
|
||||||
string operation_id = 3;
|
string operation_id = 3;
|
||||||
|
int64 service_fee = 4;
|
||||||
|
int64 network_fee = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message OpenChannelRequest{
|
message OpenChannelRequest{
|
||||||
|
|
@ -229,6 +233,8 @@ message UserOperation {
|
||||||
int64 amount = 4;
|
int64 amount = 4;
|
||||||
string identifier = 5;
|
string identifier = 5;
|
||||||
string operationId = 6;
|
string operationId = 6;
|
||||||
|
int64 service_fee = 7;
|
||||||
|
int64 network_fee = 8;
|
||||||
}
|
}
|
||||||
message UserOperations {
|
message UserOperations {
|
||||||
int64 fromIndex=1;
|
int64 fromIndex=1;
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,10 @@ interface UserOperationInfo {
|
||||||
address?: string
|
address?: string
|
||||||
from_user?: { user_id: string }
|
from_user?: { user_id: string }
|
||||||
to_user?: { user_id: string }
|
to_user?: { user_id: string }
|
||||||
|
service_fee?: number
|
||||||
|
service_fees?: number
|
||||||
|
routing_fees?: number
|
||||||
|
chain_fees?: number
|
||||||
}
|
}
|
||||||
const defaultLnurlPayMetadata = `[["text/plain", "lnurl pay to Lightning.pub"]]`
|
const defaultLnurlPayMetadata = `[["text/plain", "lnurl pay to Lightning.pub"]]`
|
||||||
|
|
||||||
|
|
@ -166,7 +170,9 @@ export default class {
|
||||||
return {
|
return {
|
||||||
preimage: payment ? payment.paymentPreimage : "",
|
preimage: payment ? payment.paymentPreimage : "",
|
||||||
amount_paid: payment ? Number(payment.valueSat) : payAmount,
|
amount_paid: payment ? Number(payment.valueSat) : payAmount,
|
||||||
operation_id: `${+Types.UserOperationType.OUTGOING_INVOICE}-${newPayment.serial_id}`
|
operation_id: `${+Types.UserOperationType.OUTGOING_INVOICE}-${newPayment.serial_id}`,
|
||||||
|
network_fee: routingFees,
|
||||||
|
service_fee: serviceFee
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -204,7 +210,9 @@ export default class {
|
||||||
const newTx = await this.storage.paymentStorage.AddUserTransactionPayment(ctx.user_id, req.address, txId, 0, req.amoutSats, chainFees, serviceFee, !!internalAddress)
|
const newTx = await this.storage.paymentStorage.AddUserTransactionPayment(ctx.user_id, req.address, txId, 0, req.amoutSats, chainFees, serviceFee, !!internalAddress)
|
||||||
return {
|
return {
|
||||||
txId: txId,
|
txId: txId,
|
||||||
operation_id: `${+Types.UserOperationType.OUTGOING_TX}-${newTx.serial_id}`
|
operation_id: `${+Types.UserOperationType.OUTGOING_TX}-${newTx.serial_id}`,
|
||||||
|
network_fee: chainFees,
|
||||||
|
service_fee: serviceFee
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -340,7 +348,9 @@ export default class {
|
||||||
amount: o.paid_amount,
|
amount: o.paid_amount,
|
||||||
paidAtUnix: o.paid_at_unix,
|
paidAtUnix: o.paid_at_unix,
|
||||||
identifier,
|
identifier,
|
||||||
operationId: `${+type}-${o.serial_id}`
|
operationId: `${+type}-${o.serial_id}`,
|
||||||
|
network_fee: o.chain_fees || o.routing_fees || 0,
|
||||||
|
service_fee: o.service_fee || o.service_fees || 0
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue