up
This commit is contained in:
parent
703379c938
commit
87925fad74
5 changed files with 2027 additions and 1993 deletions
|
|
@ -372,86 +372,63 @@ 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
|
||||||
|
|
||||||
### GetProductBuyLinkResponse
|
|
||||||
- __link__: _string_
|
|
||||||
|
|
||||||
### AddAppUserRequest
|
|
||||||
- __identifier__: _string_
|
|
||||||
- __fail_if_exists__: _boolean_
|
|
||||||
- __balance__: _number_
|
|
||||||
|
|
||||||
### AppUser
|
### AppUser
|
||||||
- __identifier__: _string_
|
- __identifier__: _string_
|
||||||
- __info__: _[UserInfo](#UserInfo)_
|
- __info__: _[UserInfo](#UserInfo)_
|
||||||
- __max_withdrawable__: _number_
|
- __max_withdrawable__: _number_
|
||||||
|
|
||||||
### PayAppUserInvoiceRequest
|
### PayAppUserInvoiceResponse
|
||||||
|
- __preimage__: _string_
|
||||||
|
- __amount_paid__: _number_
|
||||||
|
|
||||||
|
### SetMockAppUserBalanceRequest
|
||||||
- __user_identifier__: _string_
|
- __user_identifier__: _string_
|
||||||
- __invoice__: _string_
|
|
||||||
- __amount__: _number_
|
- __amount__: _number_
|
||||||
|
|
||||||
### UserOperation
|
### AuthAppRequest
|
||||||
- __paidAtUnix__: _number_
|
|
||||||
- __type__: _[UserOperationType](#UserOperationType)_
|
|
||||||
- __inbound__: _boolean_
|
|
||||||
- __amount__: _number_
|
|
||||||
- __identifier__: _string_
|
|
||||||
- __operationId__: _string_
|
|
||||||
|
|
||||||
### AddProductRequest
|
|
||||||
- __name__: _string_
|
- __name__: _string_
|
||||||
- __price_sats__: _number_
|
- __allow_user_creation__: _boolean_ *this field is optional
|
||||||
|
|
||||||
### LnurlLinkResponse
|
### AuthApp
|
||||||
- __lnurl__: _string_
|
- __app__: _[Application](#Application)_
|
||||||
- __k1__: _string_
|
- __auth_token__: _string_
|
||||||
|
|
||||||
### LiveUserOperation
|
### SetMockAppBalanceRequest
|
||||||
- __id__: _string_
|
|
||||||
- __operation__: _[UserOperation](#UserOperation)_
|
|
||||||
|
|
||||||
### EncryptionExchangeRequest
|
|
||||||
- __publicKey__: _string_
|
|
||||||
- __deviceId__: _string_
|
|
||||||
|
|
||||||
### AddAppInvoiceRequest
|
|
||||||
- __payer_identifier__: _string_
|
|
||||||
- __http_callback_url__: _string_
|
|
||||||
- __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_
|
|
||||||
|
|
||||||
### PayAddressRequest
|
|
||||||
- __address__: _string_
|
|
||||||
- __amoutSats__: _number_
|
|
||||||
- __satsPerVByte__: _number_
|
|
||||||
|
|
||||||
### DecodeInvoiceRequest
|
|
||||||
- __invoice__: _string_
|
|
||||||
|
|
||||||
### DecodeInvoiceResponse
|
|
||||||
- __amount__: _number_
|
- __amount__: _number_
|
||||||
|
|
||||||
### PayInvoiceRequest
|
### PayInvoiceRequest
|
||||||
- __invoice__: _string_
|
- __invoice__: _string_
|
||||||
- __amount__: _number_
|
- __amount__: _number_
|
||||||
|
|
||||||
|
### EncryptionExchangeRequest
|
||||||
|
- __publicKey__: _string_
|
||||||
|
- __deviceId__: _string_
|
||||||
|
|
||||||
|
### OpenChannelRequest
|
||||||
|
- __destination__: _string_
|
||||||
|
- __fundingAmount__: _number_
|
||||||
|
- __pushAmount__: _number_
|
||||||
|
- __closeAddress__: _string_
|
||||||
|
|
||||||
|
### GetUserOperationsRequest
|
||||||
|
- __latestIncomingInvoice__: _number_
|
||||||
|
- __latestOutgoingInvoice__: _number_
|
||||||
|
- __latestIncomingTx__: _number_
|
||||||
|
- __latestOutgoingTx__: _number_
|
||||||
|
- __latestIncomingUserToUserPayment__: _number_
|
||||||
|
- __latestOutgoingUserToUserPayment__: _number_
|
||||||
|
|
||||||
|
### GetProductBuyLinkResponse
|
||||||
|
- __link__: _string_
|
||||||
|
|
||||||
### PayInvoiceResponse
|
### PayInvoiceResponse
|
||||||
- __preimage__: _string_
|
- __preimage__: _string_
|
||||||
- __amount_paid__: _number_
|
- __amount_paid__: _number_
|
||||||
|
- __operation_id__: _string_
|
||||||
|
|
||||||
### UserOperations
|
### LnurlLinkResponse
|
||||||
- __fromIndex__: _number_
|
- __lnurl__: _string_
|
||||||
- __toIndex__: _number_
|
- __k1__: _string_
|
||||||
- __operations__: ARRAY of: _[UserOperation](#UserOperation)_
|
|
||||||
|
|
||||||
### Application
|
|
||||||
- __name__: _string_
|
|
||||||
- __id__: _string_
|
|
||||||
- __balance__: _number_
|
|
||||||
- __npub__: _string_
|
|
||||||
|
|
||||||
### AuthApp
|
|
||||||
- __app__: _[Application](#Application)_
|
|
||||||
- __auth_token__: _string_
|
|
||||||
|
|
||||||
### AddAppUserInvoiceRequest
|
### AddAppUserInvoiceRequest
|
||||||
- __receiver_identifier__: _string_
|
- __receiver_identifier__: _string_
|
||||||
|
|
@ -459,15 +436,17 @@ The nostr server will send back a message response, and inside the body there wi
|
||||||
- __http_callback_url__: _string_
|
- __http_callback_url__: _string_
|
||||||
- __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_
|
- __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_
|
||||||
|
|
||||||
### SetMockAppUserBalanceRequest
|
### PayAppUserInvoiceRequest
|
||||||
- __user_identifier__: _string_
|
- __user_identifier__: _string_
|
||||||
|
- __invoice__: _string_
|
||||||
- __amount__: _number_
|
- __amount__: _number_
|
||||||
|
|
||||||
### NewInvoiceResponse
|
### NewInvoiceRequest
|
||||||
- __invoice__: _string_
|
- __amountSats__: _number_
|
||||||
|
- __memo__: _string_
|
||||||
|
|
||||||
### LndGetInfoRequest
|
### DecodeInvoiceRequest
|
||||||
- __nodeId__: _number_
|
- __invoice__: _string_
|
||||||
|
|
||||||
### LnurlWithdrawInfoResponse
|
### LnurlWithdrawInfoResponse
|
||||||
- __tag__: _string_
|
- __tag__: _string_
|
||||||
|
|
@ -486,6 +465,71 @@ The nostr server will send back a message response, and inside the body there wi
|
||||||
- __minSendable__: _number_
|
- __minSendable__: _number_
|
||||||
- __metadata__: _string_
|
- __metadata__: _string_
|
||||||
|
|
||||||
|
### UserOperation
|
||||||
|
- __paidAtUnix__: _number_
|
||||||
|
- __type__: _[UserOperationType](#UserOperationType)_
|
||||||
|
- __inbound__: _boolean_
|
||||||
|
- __amount__: _number_
|
||||||
|
- __identifier__: _string_
|
||||||
|
- __operationId__: _string_
|
||||||
|
|
||||||
|
### UserOperations
|
||||||
|
- __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
|
||||||
|
- __id__: _string_
|
||||||
|
- __operation__: _[UserOperation](#UserOperation)_
|
||||||
|
|
||||||
|
### AddAppRequest
|
||||||
|
- __name__: _string_
|
||||||
|
- __allow_user_creation__: _boolean_
|
||||||
|
|
||||||
|
### AddAppUserRequest
|
||||||
|
- __identifier__: _string_
|
||||||
|
- __fail_if_exists__: _boolean_
|
||||||
|
- __balance__: _number_
|
||||||
|
|
||||||
|
### AddAppInvoiceRequest
|
||||||
|
- __payer_identifier__: _string_
|
||||||
|
- __http_callback_url__: _string_
|
||||||
|
- __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)_
|
||||||
|
|
@ -499,43 +543,21 @@ The nostr server will send back a message response, and inside the body there wi
|
||||||
- __name__: _string_
|
- __name__: _string_
|
||||||
- __price_sats__: _number_
|
- __price_sats__: _number_
|
||||||
|
|
||||||
### AuthAppRequest
|
### Empty
|
||||||
- __name__: _string_
|
|
||||||
- __allow_user_creation__: _boolean_ *this field is optional
|
|
||||||
|
|
||||||
### SendAppUserToAppUserPaymentRequest
|
### SendAppUserToAppUserPaymentRequest
|
||||||
- __from_user_identifier__: _string_
|
- __from_user_identifier__: _string_
|
||||||
- __to_user_identifier__: _string_
|
- __to_user_identifier__: _string_
|
||||||
- __amount__: _number_
|
- __amount__: _number_
|
||||||
|
|
||||||
|
### SendAppUserToAppPaymentRequest
|
||||||
|
- __from_user_identifier__: _string_
|
||||||
|
- __amount__: _number_
|
||||||
|
|
||||||
### GetAppUserLNURLInfoRequest
|
### GetAppUserLNURLInfoRequest
|
||||||
- __user_identifier__: _string_
|
- __user_identifier__: _string_
|
||||||
- __base_url_override__: _string_
|
- __base_url_override__: _string_
|
||||||
|
|
||||||
### OpenChannelRequest
|
|
||||||
- __destination__: _string_
|
|
||||||
- __fundingAmount__: _number_
|
|
||||||
- __pushAmount__: _number_
|
|
||||||
- __closeAddress__: _string_
|
|
||||||
|
|
||||||
### GetUserOperationsRequest
|
|
||||||
- __latestIncomingInvoice__: _number_
|
|
||||||
- __latestOutgoingInvoice__: _number_
|
|
||||||
- __latestIncomingTx__: _number_
|
|
||||||
- __latestOutgoingTx__: _number_
|
|
||||||
- __latestIncomingUserToUserPayment__: _number_
|
|
||||||
- __latestOutgoingUserToUserPayment__: _number_
|
|
||||||
|
|
||||||
### LndGetInfoResponse
|
|
||||||
- __alias__: _string_
|
|
||||||
|
|
||||||
### AddAppRequest
|
|
||||||
- __name__: _string_
|
|
||||||
- __allow_user_creation__: _boolean_
|
|
||||||
|
|
||||||
### GetAppUserRequest
|
|
||||||
- __user_identifier__: _string_
|
|
||||||
|
|
||||||
### OpenChannelResponse
|
### OpenChannelResponse
|
||||||
- __channelId__: _string_
|
- __channelId__: _string_
|
||||||
|
|
||||||
|
|
@ -543,40 +565,20 @@ The nostr server will send back a message response, and inside the body there wi
|
||||||
- __pr__: _string_
|
- __pr__: _string_
|
||||||
- __routes__: ARRAY of: _[Empty](#Empty)_
|
- __routes__: ARRAY of: _[Empty](#Empty)_
|
||||||
|
|
||||||
### PayAddressResponse
|
|
||||||
- __txId__: _string_
|
|
||||||
|
|
||||||
### NewInvoiceRequest
|
|
||||||
- __amountSats__: _number_
|
|
||||||
- __memo__: _string_
|
|
||||||
|
|
||||||
### UserInfo
|
|
||||||
- __userId__: _string_
|
|
||||||
- __balance__: _number_
|
|
||||||
- __max_withdrawable__: _number_
|
|
||||||
|
|
||||||
### Empty
|
|
||||||
|
|
||||||
### SetMockInvoiceAsPaidRequest
|
### SetMockInvoiceAsPaidRequest
|
||||||
- __invoice__: _string_
|
- __invoice__: _string_
|
||||||
- __amount__: _number_
|
- __amount__: _number_
|
||||||
|
|
||||||
### PayAppUserInvoiceResponse
|
### LndGetInfoResponse
|
||||||
- __preimage__: _string_
|
- __alias__: _string_
|
||||||
- __amount_paid__: _number_
|
|
||||||
|
|
||||||
### SetMockAppBalanceRequest
|
### PayAddressRequest
|
||||||
- __amount__: _number_
|
|
||||||
|
|
||||||
### NewAddressResponse
|
|
||||||
- __address__: _string_
|
- __address__: _string_
|
||||||
|
- __amoutSats__: _number_
|
||||||
|
- __satsPerVByte__: _number_
|
||||||
|
|
||||||
### SendAppUserToAppPaymentRequest
|
### DecodeInvoiceResponse
|
||||||
- __from_user_identifier__: _string_
|
|
||||||
- __amount__: _number_
|
- __amount__: _number_
|
||||||
|
|
||||||
### NewAddressRequest
|
|
||||||
- __addressType__: _[AddressType](#AddressType)_
|
|
||||||
## 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,6 +133,7 @@ message PayAddressRequest{
|
||||||
|
|
||||||
message PayAddressResponse{
|
message PayAddressResponse{
|
||||||
string txId = 1;
|
string txId = 1;
|
||||||
|
string operation_id = ;
|
||||||
}
|
}
|
||||||
|
|
||||||
message NewInvoiceRequest{
|
message NewInvoiceRequest{
|
||||||
|
|
@ -157,6 +158,7 @@ message PayInvoiceRequest{
|
||||||
message PayInvoiceResponse{
|
message PayInvoiceResponse{
|
||||||
string preimage = 1;
|
string preimage = 1;
|
||||||
int64 amount_paid = 2;
|
int64 amount_paid = 2;
|
||||||
|
string operation_id = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message OpenChannelRequest{
|
message OpenChannelRequest{
|
||||||
|
|
|
||||||
|
|
@ -162,10 +162,11 @@ export default class {
|
||||||
await this.storage.userStorage.IncrementUserBalance(linkedApplication.owner.user_id, serviceFee)
|
await this.storage.userStorage.IncrementUserBalance(linkedApplication.owner.user_id, serviceFee)
|
||||||
}
|
}
|
||||||
const routingFees = payment ? payment.feeSat : 0
|
const routingFees = payment ? payment.feeSat : 0
|
||||||
await this.storage.paymentStorage.AddUserInvoicePayment(userId, req.invoice, payAmount, routingFees, serviceFee, !!internalInvoice)
|
const newPayment = await this.storage.paymentStorage.AddUserInvoicePayment(userId, req.invoice, payAmount, routingFees, serviceFee, !!internalInvoice)
|
||||||
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}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -200,9 +201,10 @@ export default class {
|
||||||
if (isAppUserPayment && serviceFee > 0) {
|
if (isAppUserPayment && serviceFee > 0) {
|
||||||
await this.storage.userStorage.IncrementUserBalance(app.owner.user_id, serviceFee)
|
await this.storage.userStorage.IncrementUserBalance(app.owner.user_id, serviceFee)
|
||||||
}
|
}
|
||||||
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}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue