Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POS: Receipt Printer #1964

Merged
merged 10 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from 9 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
16 changes: 11 additions & 5 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ PODS:
- React-Core
- react-native-notifications (5.1.0):
- React-Core
- react-native-print (0.11.0):
- React-Core
- react-native-randombytes (3.5.3):
- React
- react-native-restart (0.0.27):
Expand Down Expand Up @@ -563,6 +565,7 @@ DEPENDENCIES:
- "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)"
- react-native-nfc-manager (from `../node_modules/react-native-nfc-manager`)
- react-native-notifications (from `../node_modules/react-native-notifications`)
- react-native-print (from `../node_modules/react-native-print`)
- react-native-randombytes (from `../node_modules/react-native-randombytes`)
- react-native-restart (from `../node_modules/react-native-restart`)
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
Expand Down Expand Up @@ -681,6 +684,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-nfc-manager"
react-native-notifications:
:path: "../node_modules/react-native-notifications"
react-native-print:
:path: "../node_modules/react-native-print"
react-native-randombytes:
:path: "../node_modules/react-native-randombytes"
react-native-restart:
Expand Down Expand Up @@ -761,19 +766,19 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/yoga"

SPEC CHECKSUMS:
boost: 57d2868c099736d80fcd648bf211b4431e51a558
boost: a7c83b31436843459a1961bfd74b96033dc77234
BVLinearGradient: 34a999fda29036898a09c6a6b728b0b4189e1a44
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662
FBLazyVector: 71803c074f6325f10b5ec891c443b6bbabef0ca7
FBReactNativeSpec: 448e08a759d29a96e15725ae532445bf4343567c
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
glog: 476ee3e89abb49e07f822b48323c51c57124b572
hermes-engine: f6cf92a471053245614d9d8097736f6337d5b86c
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
lottie-ios: 8f97d3271e155c2d688875c29cd3c74908aef5f8
lottie-react-native: 8f9d4be452e23f6e5ca0fdc11669dc99ab52be81
RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1
RCT-Folly: 0080d0a6ebf2577475bda044aa59e2ca1f909cda
RCTRequired: df81ab637d35fac9e6eb94611cfd20f0feb05455
RCTTypeSafety: 4636e4a36c7c2df332bda6d59b19b41c443d4287
React: e0cc5197a804031a6c53fb38483c3485fcb9d6f3
Expand All @@ -798,6 +803,7 @@ SPEC CHECKSUMS:
react-native-netinfo: fefd4e98d75cbdd6e85fc530f7111a8afdf2b0c5
react-native-nfc-manager: 250424ac5f6b2827f98bec7a1ed7f27615852ed4
react-native-notifications: 4601a5a8db4ced6ae7cfc43b44d35fe437ac50c4
react-native-print: f704aef52d931bfce6d1d84351dbb5232d7ecb89
react-native-randombytes: 3638d24759d67c68f6ccba60c52a7a8a8faa6a23
react-native-restart: 7595693413fe3ca15893702f2c8306c62a708162
react-native-safe-area-context: 52342d2d80ea8faadd0ffa76d83b6051f20c5329
Expand Down Expand Up @@ -842,4 +848,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 643f83a7955aa123651bac4a54204e22598914df

COCOAPODS: 1.12.1
COCOAPODS: 1.11.3
6 changes: 6 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@
"views.Receive.lspZeroAmt": "The LSP is incompatible with zero amounts. An unwrapped invoice has been generated. Your node's public key will be exposed.",
"views.Receive.createLightningAddress": "Create lightning address",
"views.Send.title": "Send",
"views.Send.rPreimage": "R Preimage",
"views.Send.lnPayment": "Lightning payment request",
"views.Send.btcAddress": "Bitcoin address",
"views.Send.keysendAddress": "keysend address (if enabled)",
Expand Down Expand Up @@ -727,6 +728,7 @@
"views.Settings.POS.taxPercentage": "Tax percentage",
"views.Settings.POS.devMode": "Developer mode",
"views.Settings.POS.showKeypad": "Show keypad",
"views.Settings.POS.enablePrinter": "Enable printer",
"views.Settings.POS.recon": "Reconciliation",
"views.Settings.POS.reconExport": "Reconciliation Export",
"views.Settings.POS.Categories": "Categories",
Expand Down Expand Up @@ -934,9 +936,13 @@
"pos.views.Order.totalBitcoin": "Total (Bitcoin)",
"pos.views.Order.total": "Total",
"pos.views.Order.paymentType": "Payment type",
"pos.views.Order.printReceipt": "Print Receipt",
"pos.views.Order.printInvoice": "Print Invoice",
"pos.views.Settings.PointOfSale.authWarning": "Warning: no password or PIN set",
"pos.views.Settings.PointOfSale.backendWarning": "Warning: currently only LND nodes are able to mark orders as paid",
"pos.views.Settings.PointOfSale.currencyError": "Error: currency must be set first",
"pos.print.taxReceipt": "Receipt",
"pos.print.invoice": "Invoice",
"views.Settings.NodeConfiguration.createMainnetWallet": "Create mainnet wallet",
"views.Settings.NodeConfiguration.createTestnetWallet": "Create testnet wallet",
"views.Settings.NodeConfiguration.restoreMainnetWallet": "Restore mainnet wallet",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
"react-native-notifications": "5.1.0",
"react-native-os": "aprock/react-native-os#5/head",
"react-native-permissions": "3.8.0",
"react-native-print": "0.11.0",
"react-native-qrcode-svg": "6.2.0",
"react-native-randombytes": "3.5.3",
"react-native-reanimated": "3.5.4",
Expand Down
18 changes: 16 additions & 2 deletions stores/PosStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface orderPaymentInfo {
rate: number;
type: string; // ln OR onchain
tx: string; // txid OR payment request
preimage?: string;
}

const POS_HIDDEN_KEY = 'pos-hidden';
Expand Down Expand Up @@ -79,7 +80,8 @@ export default class PosStore {
exchangeRate,
rate,
type,
tx
tx,
preimage
}: orderPaymentInfo) =>
EncryptedStorage.setItem(
`pos-${orderId}`,
Expand All @@ -90,7 +92,8 @@ export default class PosStore {
exchangeRate,
rate,
type,
tx
tx,
preimage
})
);

Expand Down Expand Up @@ -543,6 +546,17 @@ export default class PosStore {
});
};

@action
public getOrderPaymentById = async (
orderId: string
): Promise<Order | undefined> => {
const payment = await EncryptedStorage.getItem(`pos-${orderId}`);

if (payment) {
return JSON.parse(payment);
}
};

resetOrders = () => {
this.openOrders = [];
this.paidOrders = [];
Expand Down
4 changes: 3 additions & 1 deletion stores/SettingsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ interface PosSettings {
squareDevMode?: boolean;
showKeypad?: boolean;
taxPercentage?: string;
enablePrinter?: boolean;
}

interface PaymentsSettings {
Expand Down Expand Up @@ -763,7 +764,8 @@ export default class SettingsStore {
disableTips: false,
squareDevMode: false,
showKeypad: true,
taxPercentage: '0'
taxPercentage: '0',
enablePrinter: false
},
payments: {
defaultFeeMethod: 'fixed', // deprecated
Expand Down
Loading