Skip to content

Commit fc701fa

Browse files
authored
Merge branch 'master' into feat/merge-addresses-button-detail
2 parents df1856b + 06e5e3a commit fc701fa

19 files changed

Lines changed: 523 additions & 137 deletions

File tree

PRIVACY.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
## Privacy Policy
2+
3+
**Effective Date:** 2025-05-03
4+
5+
At PayButton.org, your privacy matters. Here’s what we collect and how we use it:
6+
7+
1. **What We Collect**
8+
- Basic info associated with your account (eg. email, organization)
9+
- Technical data (eg. IP address, browser info) for security and analytics
10+
- Payment metadata (eg. amount, recipient address) for transaction records
11+
12+
2. **What We Don’t Collect**
13+
- Credit card information
14+
- Private keys
15+
16+
3. **Cookies & Analytics**
17+
- We use cookies and tracking tools (like Google Analytics) to improve site performance.
18+
19+
4. **Third Parties**
20+
- We may use third-party services (e.g., CDN, analytics providers), but we don’t share your personal data for marketing.
21+
22+
5. **Your Control**
23+
- You can update your account settings anytime.
24+
- Contact us to request data deletion or access.
25+
26+
6. **Security**
27+
- We take reasonable steps to protect your data, but no system is 100% secure.
28+
29+
7. **Changes**
30+
- We may revise this policy. Continued use means you accept the new terms.

TERMS.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## Terms of Use
2+
3+
**Effective Date:** 2025-05-03
4+
5+
Welcome to PayButton.org. By using this site, you agree to the following terms:
6+
7+
1. **Eligibility**: This service is available worldwide and may be used by individuals of any age.
8+
2. **Account**: You may create an account to manage your settings. You are responsible for keeping your login information secure.
9+
3. **Usage**: PayButton.org does not store or control funds. Any payment activity you associate with your PayButton account is read-only and on-chain.
10+
4. **Conduct**: You agree not to abuse the platform or use it for illegal activity. We may suspend accounts for violations.
11+
5. **Changes**: We may update these terms at any time. Continued use of the site means you accept the changes.
12+
6. **Disclaimer**: PayButton.org is provided “as is” without warranty. We are not responsible for losses resulting from site use or payment activity.

assets/settings-slider-icon.png

10 KB
Loading

components/ButtonGenerator/CodeBlock.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@ export default function CodeBlock ({ button }): JSX.Element {
5555
return camelToKebabCase(key) + `="${value as string}"`
5656
}
5757
} else if (codeType === 'js') {
58-
if (key === 'amount' || key === 'goalAmount' || key === 'onSuccess' || key === 'onTransaction' || typeof value === 'boolean') {
58+
if (key === 'amount' ||
59+
key === 'goalAmount' ||
60+
key === 'onSuccess' ||
61+
key === 'onTransaction' ||
62+
key === 'onClose' ||
63+
key === 'onOpen' ||
64+
typeof value === 'boolean') {
5965
if (key === 'randomSatoshis' && button.amount <= 0) {
6066
return ''
6167
} else return ` ${key}: ${value as string}`
@@ -67,7 +73,13 @@ export default function CodeBlock ({ button }): JSX.Element {
6773
return ` ${key}: '${value as string}'`
6874
}
6975
} else {
70-
if (key === 'amount' || key === 'goalAmount' || key === 'onSuccess' || key === 'onTransaction' || typeof value === 'boolean') {
76+
if (key === 'amount' ||
77+
key === 'goalAmount' ||
78+
key === 'onSuccess' ||
79+
key === 'onTransaction' ||
80+
key === 'onClose' ||
81+
key === 'onOpen' ||
82+
typeof value === 'boolean') {
7183
if (key === 'randomSatoshis' && button.amount <= 0) {
7284
return ''
7385
} else return `const ${key} = ${value as string}`

components/ButtonGenerator/data.js

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,16 @@ export const generatorFormFields = [
8989
onChange: 'handleChange',
9090
helpText: 'The text displayed upon successful payment'
9191
},
92+
{
93+
name: 'Contribution Offset',
94+
placeholder: 'Contribution Offset',
95+
key: 'contributionOffset',
96+
className: 'col_lg',
97+
type: 'input',
98+
onChange: 'handleChange',
99+
helpText: 'Adjusts the total contributions displayed, simulating prior contributions or subtracting from the total.',
100+
advanced: true
101+
},
92102
{
93103
name: 'Widget',
94104
key: 'widget',
@@ -180,4 +190,63 @@ export const generatorFormFields = [
180190
helpText: 'Removes the random ID generated for the payment that is used to prevent the onSuccess callback to be triggered by a person who has the payment screen open at the same time as another',
181191
advanced: true
182192
},
193+
{
194+
name: 'Disable Altpayment',
195+
key: 'disableAltpayment',
196+
className: 'col_sm_center',
197+
type: 'boolean',
198+
default: false,
199+
helpText: 'Disables altpayment logic',
200+
advanced: true
201+
},
202+
{
203+
name: 'On-close',
204+
placeholder: 'Callback function',
205+
key: 'onClose',
206+
className: 'col_lg',
207+
type: 'input',
208+
onChange: 'handleChange',
209+
helpText: 'Callback function that runs when the button dialog closes',
210+
advanced: true
211+
},
212+
{
213+
name: 'Auto close',
214+
key: 'autoClose',
215+
className: 'col_sm_center',
216+
type: 'boolean',
217+
default: true,
218+
helpText: 'Enables auto-close of the button dialog after a successful payment',
219+
advanced: true
220+
},
221+
{
222+
name: 'On-open',
223+
placeholder: 'Callback function',
224+
key: 'onOpen',
225+
className: 'col_lg',
226+
type: 'input',
227+
onChange: 'handleChange',
228+
helpText: 'Callback function that runs when the button dialog opens',
229+
advanced: true
230+
},
231+
{
232+
name: 'Ws base url',
233+
placeholder: 'Your websocket server',
234+
key: 'wsBaseUrl',
235+
className: 'col_lg',
236+
type: 'input',
237+
onChange: 'handleChange',
238+
helpText: 'Link to the websocket server that will be used',
239+
advanced: true
240+
},
241+
{
242+
name: 'Api base url',
243+
placeholder: 'Your api server',
244+
key: 'apiBaseUrl',
245+
className: 'col_lg',
246+
type: 'input',
247+
onChange: 'handleChange',
248+
helpText: 'Link to the api server that will be used',
249+
advanced: true
250+
},
251+
183252
]

components/ButtonGenerator/index.tsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ interface ButtonState {
3636
editable: boolean
3737
widget: boolean
3838
disablePaymentId: boolean
39+
contributionOffset: number
40+
disableAltpayment: boolean
3941
opReturn: string
4042
[key: string]: any
4143
}
@@ -74,7 +76,14 @@ export const initialButtonState: ButtonState = {
7476
editable: false,
7577
widget: false,
7678
disablePaymentId: false,
77-
opReturn: ''
79+
opReturn: '',
80+
contributionOffset: 0,
81+
disableAltpayment: false,
82+
autoClose: true,
83+
onOpen: '',
84+
onClose: '',
85+
wsBaseURL: '',
86+
apiBaseURL: '',
7887
}
7988

8089
export default function ButtonGenerator (): JSX.Element {
@@ -379,6 +388,8 @@ export default function ButtonGenerator (): JSX.Element {
379388
randomSatoshis={button.randomSatoshis}
380389
hideToasts={button.hideToasts}
381390
disableEnforceFocus={button.disableEnforceFocus}
391+
contributionOffset={button.contributionOffset}
392+
disableAltpayment={button.disableAltpayment}
382393
disabled={button.disabled}
383394
editable={button.editable}
384395
/>
@@ -412,8 +423,15 @@ export default function ButtonGenerator (): JSX.Element {
412423
randomSatoshis={button.randomSatoshis}
413424
hideToasts={button.hideToasts}
414425
disableEnforceFocus={button.disableEnforceFocus}
426+
contributionOffset={button.contributionOffset}
427+
disableAltpayment={button.disableAltpayment}
415428
disabled={button.disabled}
416429
editable={button.editable}
430+
autoClose={button.autoClose}
431+
onOpen={button.onOpen}
432+
onClose={button.onClose}
433+
wsBaseURL={button.wsBaseURL}
434+
apiBaseURL={button.apiBaseURL}
417435
/>
418436
)
419437
)

components/Paybutton/PaybuttonTrigger.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ export default ({ paybuttonId, emailCredits }: IProps): JSX.Element => {
213213
<div>&lt;opReturn&gt;</div>
214214
<div>&lt;signature&gt;</div>
215215
<div>&lt;inputAddresses&gt;</div>
216+
<div>&lt;value&gt;</div>
217+
216218
</div>
217219
</div>
218220
{/* Tooltip */}

components/TableContainer/TableContainerGetter.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ const TableContainer = ({ columns, dataGetter, opts, ssr, tableRefreshCount, emp
8080
usePagination
8181
)
8282

83+
useEffect(() => {
84+
gotoPage(0)
85+
}, [tableRefreshCount])
86+
8387
useEffect(() => {
8488
void (async () => {
8589
setLoading(true)

constants/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ export const TRIGGER_POST_VARIABLES = [
241241
'<signature>',
242242
'<timestamp>',
243243
'<txId>',
244-
'<inputAddresses>'
244+
'<inputAddresses>',
245+
'<value>'
245246
]
246247

247248
export const PAYBUTTON_TRANSACTIONS_FILE_HEADERS = {

pages/api/payments/count/index.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { CacheGet } from 'redis/index'
22
import { fetchUserProfileFromId } from 'services/userService'
33
import { setSession } from 'utils/setSession'
4+
import { getFilteredTransactionCount } from 'services/transactionService'
45

56
export default async (req: any, res: any): Promise<void> => {
67
if (req.method === 'GET') {
@@ -10,7 +11,20 @@ export default async (req: any, res: any): Promise<void> => {
1011
const userProfile = await fetchUserProfileFromId(userId)
1112
const userPreferredTimezone = userProfile?.preferredTimezone
1213
const timezone = userPreferredTimezone !== '' ? userPreferredTimezone : userReqTimezone
13-
const resJSON = await CacheGet.paymentsCount(userId, timezone)
14-
res.status(200).json(resJSON)
14+
15+
let buttonIds: string[] | undefined
16+
if (typeof req.query.buttonIds === 'string' && req.query.buttonIds !== '') {
17+
buttonIds = (req.query.buttonIds as string).split(',')
18+
}
19+
20+
if ((buttonIds !== undefined) && buttonIds.length > 0) {
21+
const totalCount = await getFilteredTransactionCount(userId, buttonIds)
22+
res.status(200).json(totalCount)
23+
} else {
24+
const resJSON = await CacheGet.paymentsCount(userId, timezone)
25+
res.status(200).json(resJSON)
26+
}
27+
} else {
28+
res.status(405).json({ error: 'Method not allowed' })
1529
}
1630
}

0 commit comments

Comments
 (0)