Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions static/components/payment-method-selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ window.app.component('tpos-payment-method-selector', {
currency: {type: String, required: true},
currencySymbol: {type: String, required: true},
fiatProvider: {type: Boolean, default: false},
tapToPayEnabled: {type: Boolean, default: false},
allowCashSettlement: {type: Boolean, default: false},
onchainEnabled: {type: Boolean, default: false},
tabsEnabled: {type: Boolean, default: false},
Expand Down Expand Up @@ -70,7 +71,7 @@ window.app.component('tpos-payment-method-selector', {
color="secondary"
rounded
:disable="disabled"
:aria-label="currency + ' TAP'"
:aria-label="'Cash ' + currency"
@click="$emit('select', 'cash')"
>
<div class="row items-center no-wrap q-gutter-x-xs">
Expand All @@ -79,14 +80,14 @@ window.app.component('tpos-payment-method-selector', {
</div>
</q-btn>
</div>
<div class="col-6" v-if="fiatProvider">
<div class="col-6" v-if="tapToPayEnabled">
<q-btn
class="full-width q-px-lg q-py-sm"
:size="drawer ? 'lg' : 'xl'"
color="secondary"
rounded
:disable="disabled"
:aria-label="'CASH ' + currency"
:aria-label="'Tap to Pay ' + currency"
@click="$emit('select', 'fiat_tap')"
>
<div class="row items-center no-wrap q-gutter-x-xs">
Expand Down
3 changes: 3 additions & 0 deletions static/js/tpos.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ window.app = Vue.createApp({
enablePrint: false,
enableRemote: false,
wrapperMode: false,
tapToPayEnabled: false,
receiptData: null,
printText: '',
orderReceipt: false,
Expand Down Expand Up @@ -1922,6 +1923,8 @@ window.app = Vue.createApp({
this.enableRemote = Boolean(tpos.enable_remote)
this.wrapperMode =
new URL(window.location.href).searchParams.get('wrapper') === 'true'
this.tapToPayEnabled =
this.wrapperMode && Boolean(tpos.stripe_card_payments)
this.fiatProvider = tpos.fiat_provider
this.allowPriceAdjustment = tpos.allow_price_adjustment ?? true
this.allowCashSettlement = Boolean(tpos.allow_cash_settlement)
Expand Down
1 change: 1 addition & 0 deletions templates/tpos/_cart.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ <h5 v-show="!denomIsSats" class="q-mt-none q-mb-sm">
:currency="currency"
:currency-symbol="currencySymbol"
:fiat-provider="!!fiatProvider"
:tap-to-pay-enabled="tapToPayEnabled"
:allow-cash-settlement="allowCashSettlement"
:onchain-enabled="onchainEnabled"
:tabs-enabled="tabsEnabled"
Expand Down
1 change: 1 addition & 0 deletions templates/tpos/dialogs.html
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ <h5 class="q-mt-none q-mb-sm">
:currency="currency"
:currency-symbol="currencySymbol"
:fiat-provider="!!fiatProvider"
:tap-to-pay-enabled="tapToPayEnabled"
:allow-cash-settlement="allowCashSettlement"
:onchain-enabled="onchainEnabled"
:tabs-enabled="tabsEnabled"
Expand Down
14 changes: 14 additions & 0 deletions tests/check_static_load.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,20 @@ for (const page of pages) {
}

const html = page.templates.map(t => templateWithIncludes(t)).join('\n')
if (page.name === 'public tpos page (tpos.html)') {
const tapToPayBindings = html.match(
/:tap-to-pay-enabled="tapToPayEnabled"/g
)
const selector = registered['tpos-payment-method-selector']
if (
tapToPayBindings?.length !== 2 ||
!selector?.props?.tapToPayEnabled ||
!selector.template.includes('v-if="tapToPayEnabled"')
) {
failures += 1
console.log('FAIL Tap to Pay visibility is not wrapper-gated')
}
}
for (const tag of usedComponentTags(html)) {
if (registered[tag]) {
console.log(`ok <${tag}> is registered`)
Expand Down
Loading