fix rules wiring
This commit is contained in:
parent
a2d502baa9
commit
19ee91cd5f
10 changed files with 65 additions and 20 deletions
|
|
@ -965,11 +965,13 @@ The nostr server will send back a message response, and inside the body there wi
|
|||
|
||||
### PayAppUserInvoiceRequest
|
||||
- __amount__: _number_
|
||||
- __debit_npub__: _string_ *this field is optional
|
||||
- __invoice__: _string_
|
||||
- __user_identifier__: _string_
|
||||
|
||||
### PayInvoiceRequest
|
||||
- __amount__: _number_
|
||||
- __debit_npub__: _string_ *this field is optional
|
||||
- __invoice__: _string_
|
||||
|
||||
### PayInvoiceResponse
|
||||
|
|
|
|||
|
|
@ -367,12 +367,14 @@ type PayAddressResponse struct {
|
|||
}
|
||||
type PayAppUserInvoiceRequest struct {
|
||||
Amount int64 `json:"amount"`
|
||||
Debit_npub string `json:"debit_npub"`
|
||||
Invoice string `json:"invoice"`
|
||||
User_identifier string `json:"user_identifier"`
|
||||
}
|
||||
type PayInvoiceRequest struct {
|
||||
Amount int64 `json:"amount"`
|
||||
Invoice string `json:"invoice"`
|
||||
Amount int64 `json:"amount"`
|
||||
Debit_npub string `json:"debit_npub"`
|
||||
Invoice string `json:"invoice"`
|
||||
}
|
||||
type PayInvoiceResponse struct {
|
||||
Amount_paid int64 `json:"amount_paid"`
|
||||
|
|
|
|||
|
|
@ -2079,13 +2079,16 @@ export const PayAddressResponseValidate = (o?: PayAddressResponse, opts: PayAddr
|
|||
|
||||
export type PayAppUserInvoiceRequest = {
|
||||
amount: number
|
||||
debit_npub?: string
|
||||
invoice: string
|
||||
user_identifier: string
|
||||
}
|
||||
export const PayAppUserInvoiceRequestOptionalFields: [] = []
|
||||
export type PayAppUserInvoiceRequestOptionalField = 'debit_npub'
|
||||
export const PayAppUserInvoiceRequestOptionalFields: PayAppUserInvoiceRequestOptionalField[] = ['debit_npub']
|
||||
export type PayAppUserInvoiceRequestOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
checkOptionalsAreSet?: PayAppUserInvoiceRequestOptionalField[]
|
||||
amount_CustomCheck?: (v: number) => boolean
|
||||
debit_npub_CustomCheck?: (v?: string) => boolean
|
||||
invoice_CustomCheck?: (v: string) => boolean
|
||||
user_identifier_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
|
|
@ -2096,6 +2099,9 @@ export const PayAppUserInvoiceRequestValidate = (o?: PayAppUserInvoiceRequest, o
|
|||
if (typeof o.amount !== 'number') return new Error(`${path}.amount: is not a number`)
|
||||
if (opts.amount_CustomCheck && !opts.amount_CustomCheck(o.amount)) return new Error(`${path}.amount: custom check failed`)
|
||||
|
||||
if ((o.debit_npub || opts.allOptionalsAreSet || opts.checkOptionalsAreSet?.includes('debit_npub')) && typeof o.debit_npub !== 'string') return new Error(`${path}.debit_npub: is not a string`)
|
||||
if (opts.debit_npub_CustomCheck && !opts.debit_npub_CustomCheck(o.debit_npub)) return new Error(`${path}.debit_npub: custom check failed`)
|
||||
|
||||
if (typeof o.invoice !== 'string') return new Error(`${path}.invoice: is not a string`)
|
||||
if (opts.invoice_CustomCheck && !opts.invoice_CustomCheck(o.invoice)) return new Error(`${path}.invoice: custom check failed`)
|
||||
|
||||
|
|
@ -2107,12 +2113,15 @@ export const PayAppUserInvoiceRequestValidate = (o?: PayAppUserInvoiceRequest, o
|
|||
|
||||
export type PayInvoiceRequest = {
|
||||
amount: number
|
||||
debit_npub?: string
|
||||
invoice: string
|
||||
}
|
||||
export const PayInvoiceRequestOptionalFields: [] = []
|
||||
export type PayInvoiceRequestOptionalField = 'debit_npub'
|
||||
export const PayInvoiceRequestOptionalFields: PayInvoiceRequestOptionalField[] = ['debit_npub']
|
||||
export type PayInvoiceRequestOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
checkOptionalsAreSet?: PayInvoiceRequestOptionalField[]
|
||||
amount_CustomCheck?: (v: number) => boolean
|
||||
debit_npub_CustomCheck?: (v?: string) => boolean
|
||||
invoice_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const PayInvoiceRequestValidate = (o?: PayInvoiceRequest, opts: PayInvoiceRequestOptions = {}, path: string = 'PayInvoiceRequest::root.'): Error | null => {
|
||||
|
|
@ -2122,6 +2131,9 @@ export const PayInvoiceRequestValidate = (o?: PayInvoiceRequest, opts: PayInvoic
|
|||
if (typeof o.amount !== 'number') return new Error(`${path}.amount: is not a number`)
|
||||
if (opts.amount_CustomCheck && !opts.amount_CustomCheck(o.amount)) return new Error(`${path}.amount: custom check failed`)
|
||||
|
||||
if ((o.debit_npub || opts.allOptionalsAreSet || opts.checkOptionalsAreSet?.includes('debit_npub')) && typeof o.debit_npub !== 'string') return new Error(`${path}.debit_npub: is not a string`)
|
||||
if (opts.debit_npub_CustomCheck && !opts.debit_npub_CustomCheck(o.debit_npub)) return new Error(`${path}.debit_npub: custom check failed`)
|
||||
|
||||
if (typeof o.invoice !== 'string') return new Error(`${path}.invoice: is not a string`)
|
||||
if (opts.invoice_CustomCheck && !opts.invoice_CustomCheck(o.invoice)) return new Error(`${path}.invoice: custom check failed`)
|
||||
|
||||
|
|
|
|||
|
|
@ -215,6 +215,7 @@ message PayAppUserInvoiceRequest {
|
|||
string user_identifier = 1;
|
||||
string invoice = 2;
|
||||
int64 amount = 3;
|
||||
optional string debit_npub = 4;
|
||||
}
|
||||
|
||||
message SendAppUserToAppUserPaymentRequest {
|
||||
|
|
@ -283,6 +284,7 @@ message DecodeInvoiceResponse{
|
|||
message PayInvoiceRequest{
|
||||
string invoice = 1;
|
||||
int64 amount = 2;
|
||||
optional string debit_npub = 3;
|
||||
}
|
||||
|
||||
message PayInvoiceResponse{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue