NASA-Tournament-Lab / CoECI-OPM-Service-Credit-Redeposit-Deposit-Application

This repository houses code for the United States Office of Personnel Management Service Credit Re-deposit/Deposit (SCRD) Application.
Apache License 2.0
6 stars 9 forks source link

Account Details - Account Summary #75

Open psisrael opened 10 years ago

psisrael commented 10 years ago
  1. Go to View Account > Account Summary
  2. Near the top of the page under "Payments" there are two values: Total & Balance
  3. The "Total" value needs to be the total amount of payments in the DB with a status of "approved".
  4. The "Balance" value needs to be the last calculated balance value on the account.
joelc commented 10 years ago

To clarify: (4) means "the value of account.balance in the DB for the given claim_number"?

The /account/{id}/payments payload returns some JSON that has an "accountBalance" which is DIFFERENT to the value in account.balance.

Help please!!

joelc commented 10 years ago

I'm confused here - sorry.

Here's where I'm confused:

There appears to be a disconnect here. Admittedly I'm finger-in-the-airing most of this - however, this does seem a bit odd, no? What am I missing?!

pizza-and-dog commented 10 years ago

No worries! It is confusing. I'm going to quickly rope in an architect on this one. Please hold tight.

stashuk commented 10 years ago

To clarify: (4) means "the value of account.balance in the DB for the given claim_number"? -> yes

The /account/{id}/payments payload returns some JSON that has an "accountBalance" which is DIFFERENT to the value in account.balance -> Afaik, the accountBalance is the balance of the account at the moment of this payment. So what we are actually interested is that account.balance is correct for displaying in front. This is what rsial2 said: please fix the balance to be the sum of all payments with 'approved' status.

When I ask the DB for all payments for this account using select * from opm.account a left outer join opm.payment p on a.claim_number = p.claim_number where a.id=2, I get 7 rows returned

This looks proper.

When I ask for the resource containing this account's Payments (I think that's what this resource is) http://localhost:8080/scrd/account/2/payments, I get a single record returned with id 390

I do not have hands on with latest code, but this should be a mistake here, we need to consider all payments.

joelc commented 10 years ago

Ah - I think I was seeing data anomalies because the VM DB has generated data loaded into it.

Case in hand - I am going on the assumption in the real world that the account_id and claim_number in opm.payment should have some parity (i.e. the account_id in question has that claim_number and the account for that claim_number has that id).

In the VM db, this rule does not hold...

joelc commented 10 years ago

I am also assuming that:

The "Total" value needs to be the total amount of payments in the DB with a status of "approved".

Means: "...DB with an approval_status of APPROVED" because there is also a payment_status column which is separate from approval_status, and it does not contain any candidate values named "approved".

The closest I could find in the payment_status name list was "Posted - Pending".

pizza-and-dog commented 10 years ago

@stashuk, can you confirm please?

stashuk commented 10 years ago

Case in hand - I am going on the assumption in the real world that the account_id and claim_number in opm.payment should have some parity (i.e. the account_id in question has that claim_number and the account for that claim_number has that id).

Not sure whether I understand the formulation completely, but yes, every account has required id/claim number and it is 1 to 1 dependency.

Means: "...DB with an approval_status of APPROVED"

Yes