Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit 5582a60

Browse files
committed
Remove transaction dependency from payment action
1 parent 5d9f646 commit 5582a60

File tree

5 files changed

+6
-16
lines changed

5 files changed

+6
-16
lines changed

src/action/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const info = new InfoAction(store, grpc, nav, notify);
3939
export const transaction = new TransactionAction(store, grpc, nav);
4040
export const channel = new ChannelAction(store, grpc, nav, notify);
4141
export const invoice = new InvoiceAction(store, grpc, nav, notify, Clipboard);
42-
export const payment = new PaymentAction(store, grpc, transaction, nav, notify);
42+
export const payment = new PaymentAction(store, grpc, nav, notify);
4343
export const setting = new SettingAction(store, wallet, db, ipc);
4444

4545
payment.listenForUrl(ipc); // enable incoming url handler

src/action/payment.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ import {
1515
import * as log from './log';
1616

1717
class PaymentAction {
18-
constructor(store, grpc, transaction, nav, notification) {
18+
constructor(store, grpc, nav, notification) {
1919
this._store = store;
2020
this._grpc = grpc;
21-
this._transaction = transaction;
2221
this._nav = nav;
2322
this._notification = notification;
2423
}
@@ -161,7 +160,6 @@ class PaymentAction {
161160
} catch (err) {
162161
this._notification.display({ msg: 'Sending transaction failed!', err });
163162
}
164-
await this._transaction.update();
165163
}
166164

167165
/**
@@ -192,7 +190,6 @@ class PaymentAction {
192190
this._nav.goPayLightningConfirm();
193191
this._notification.display({ msg: 'Lightning payment failed!', err });
194192
}
195-
await this._transaction.update();
196193
}
197194
}
198195

stories/screen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const transaction = new TransactionAction(store, grpc, nav);
6969
sinon.stub(transaction, 'update');
7070
const invoice = new InvoiceAction(store, grpc, nav, notify, Clipboard);
7171
sinon.stub(invoice, 'generateUri');
72-
const payment = new PaymentAction(store, grpc, transaction, nav, notify);
72+
const payment = new PaymentAction(store, grpc, nav, notify);
7373
sinon.stub(payment, 'checkType');
7474
sinon.stub(payment, 'payBitcoin');
7575
sinon.stub(payment, 'payLightning');

test/integration/action/action-integration.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ describe('Action Integration Tests', function() {
152152
transactions1 = new TransactionAction(store1, grpc1, nav1);
153153
channels1 = new ChannelAction(store1, grpc1, nav1, notify1);
154154
invoice1 = new InvoiceAction(store1, grpc1, nav1, notify1);
155-
payments1 = new PaymentAction(store1, grpc1, transactions1, nav1, notify1);
155+
payments1 = new PaymentAction(store1, grpc1, nav1, notify1);
156156

157157
db2 = sinon.createStubInstance(AppStorage);
158158
nav2 = sinon.createStubInstance(NavAction);
@@ -164,7 +164,7 @@ describe('Action Integration Tests', function() {
164164
transactions2 = new TransactionAction(store2, grpc2, nav2);
165165
channels2 = new ChannelAction(store2, grpc2, nav2, notify2);
166166
invoice2 = new InvoiceAction(store2, grpc2, nav2, notify2);
167-
payments2 = new PaymentAction(store2, grpc2, transactions2, nav2, notify2);
167+
payments2 = new PaymentAction(store2, grpc2, nav2, notify2);
168168
});
169169

170170
after(async () => {

test/unit/action/payment.spec.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { Store } from '../../../src/store';
33
import IpcAction from '../../../src/action/ipc';
44
import GrpcAction from '../../../src/action/grpc';
55
import PaymentAction from '../../../src/action/payment';
6-
import TransactionAction from '../../../src/action/transaction';
76
import NotificationAction from '../../../src/action/notification';
87
import NavAction from '../../../src/action/nav';
98
import * as logger from '../../../src/action/log';
@@ -13,7 +12,6 @@ describe('Action Payments Unit Tests', () => {
1312
let store;
1413
let sandbox;
1514
let grpc;
16-
let transaction;
1715
let payment;
1816
let nav;
1917
let notification;
@@ -27,8 +25,7 @@ describe('Action Payments Unit Tests', () => {
2725
grpc = sinon.createStubInstance(GrpcAction);
2826
notification = sinon.createStubInstance(NotificationAction);
2927
nav = sinon.createStubInstance(NavAction);
30-
transaction = sinon.createStubInstance(TransactionAction);
31-
payment = new PaymentAction(store, grpc, transaction, nav, notification);
28+
payment = new PaymentAction(store, grpc, nav, notification);
3229
});
3330

3431
afterEach(() => {
@@ -199,14 +196,12 @@ describe('Action Payments Unit Tests', () => {
199196
});
200197
expect(nav.goPayBitcoinDone, 'was called once');
201198
expect(notification.display, 'was not called');
202-
expect(transaction.update, 'was called once');
203199
});
204200

205201
it('should display notification on error', async () => {
206202
grpc.sendCommand.withArgs('sendCoins').rejects();
207203
await payment.payBitcoin();
208204
expect(notification.display, 'was called once');
209-
expect(transaction.update, 'was called once');
210205
});
211206
});
212207

@@ -237,15 +232,13 @@ describe('Action Payments Unit Tests', () => {
237232
expect(nav.goWait, 'was called once');
238233
expect(nav.goPayLightningDone, 'was called once');
239234
expect(notification.display, 'was not called');
240-
expect(transaction.update, 'was called once');
241235
});
242236

243237
it('should display notification on error', async () => {
244238
paymentsOnStub.withArgs('data').yields({ payment_error: 'Boom!' });
245239
await payment.payLightning({ invoice: 'some-payment' });
246240
expect(nav.goPayLightningConfirm, 'was called once');
247241
expect(notification.display, 'was called once');
248-
expect(transaction.update, 'was called once');
249242
});
250243
});
251244
});

0 commit comments

Comments
 (0)