Repository: brave/browser-laptop (JavaScript)

Issue:
contribution notification displays again after toggle payments off/on
<!--
Have you searched for similar issues? We have received a lot of feedback and bug reports that we have closed as duplicates. Before submitting this issue, please visit our community site for common ones: https://community.brave.com/c/common-issues
-->

### Description
If you toggle payments off/on after a contribution is made, you get the contribution notification again.


### Steps to Reproduce
<!--
Please add a series of steps to reproduce the problem. See https://stackoverflow.com/help/mcve for in depth information on how to create a minimal, complete, and verifiable example.
-->

1. Launch 0.21.12 using LEDGER_ENVIRONMENT=staging 
2. visit about:preferences#payments and enable payments
3. sites/YT videos
4. close brave and fund the staging wallet.
5. change reconcileStamp under ledger-state.json so Next Contribution is Overdue
6. launch 0.21.12 using LEDGER_NO_DELAY=true LEDGER_NO_FUZZING=true LEDGER_VERBOSE=true LEDGER_ENVIRONMENT=staging 
7. wait till the contribution is made and you get a notification letting you know that X amount of BAT has been processed
8. select OK on the banner notification 
9. Toggle Payments off/on 


**Actual result:**
You get the contribution notification again.

![contrib](https://user-images.githubusercontent.com/28145373/36620935-7d905900-18c3-11e8-8242-f61cf4573fe2.gif)


**Expected result:**
No contribution notification.

**Reproduces how often:**
Easily


### Brave Version

**about:brave info:**
0.21.12


**Reproducible on current live release:**
Yes


### Additional Information
Unsure if this should have been resolved by https://github.com/brave/browser-laptop/issues/12817 - that scenario has you turning notifications off, but here you are leaving them on.
cc @NejcZdovc 


Discussion:
Verified on Windows x64 
* 0.22.6  e6ff4ea
* libchromiumcontent: 65.0.3325.162
* muon: 5.1.0

Verified on macOS 10.12.6 x64 using the following build:
* 0.22.6 https://github.com/brave/browser-laptop/commit/e6ff4ea43ed740d1449a4c72005e22ce5235447e
* libchromiumcontent: 65.0.3325.162
* muon: 5.1.0

Went through verification using Ubuntu 17.10.1 x64 with the following build:
* `0.22.7` 8bb7e77
* libchromiumcontent: `65.0.3325.181`
* muon: `5.1.1`



Patch:
diff --git a/app/common/state/ledgerState.js b/app/common/state/ledgerState.js
index 2392ff24b37..58b176d8f4e 100644
--- a/app/common/state/ledgerState.js
+++ b/app/common/state/ledgerState.js
@@ -288,6 +288,11 @@ const ledgerState = {
       if (paymentId) {
         newData = newData.set('paymentId', paymentId)
       }
+
+      const transactions = ledgerState.getInfoProp(state, 'transactions')
+      if (transactions) {
+        newData = newData.set('transactions', transactions)
+      }
     }
 
     return state.setIn(['ledger', 'info'], newData)


Test patch:
diff --git a/test/unit/app/common/state/ledgerStateTest.js b/test/unit/app/common/state/ledgerStateTest.js
index 0c3bad692df..eaa666e4b3d 100644
--- a/test/unit/app/common/state/ledgerStateTest.js
+++ b/test/unit/app/common/state/ledgerStateTest.js
@@ -506,7 +506,7 @@ describe('ledgerState unit test', function () {
       assert.deepEqual(result.toJS(), expectedState.toJS())
     })
 
-    it('keep is on, but paymentId is not there', function () {
+    it('keep is on, but paymentId and transactions are not there', function () {
       const state = defaultState.setIn(['ledger', 'info'], Immutable.fromJS({
         balance: 10.00
       }))
@@ -518,11 +518,21 @@ describe('ledgerState unit test', function () {
     it('keep it', function () {
       const state = defaultState.setIn(['ledger', 'info'], Immutable.fromJS({
         paymentId: 'a-1-a',
+        transactions: [
+          {
+            votes: 15
+          }
+        ],
         balance: 10.00
       }))
       const result = ledgerState.resetInfo(state, true)
       const expectedState = defaultState.setIn(['ledger', 'info'], Immutable.fromJS({
-        paymentId: 'a-1-a'
+        paymentId: 'a-1-a',
+        transactions: [
+          {
+            votes: 15
+          }
+        ]
       }))
       assert.deepEqual(result.toJS(), expectedState.toJS())
     })