generated from finos-labs/project-blueprint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from finos-labs/update-dataformat
updated data formats. restored accidentally overwritten changes to apps
- Loading branch information
Showing
7 changed files
with
166 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,12 +36,35 @@ Purchase ('fdc3.purchase') | |
```ts | ||
interface Purchase { | ||
type: string; //'fdc3.purchase' | ||
amount: number; | ||
vendor: string; | ||
timestamp: number; | ||
purchaser: string; //is there a common identifier for the purchaser? do we even want to include this (or is this too much PII)? | ||
merchant: string; //identifier for the merchant/point of purchase - is there a common identifier | ||
category?: string; | ||
data: { | ||
amount: number; | ||
vendor: string; | ||
date: string; | ||
time: string; | ||
userID: string; //is there a common identifier for the purchaser? do we even want to include this (or is this too much PII)? | ||
pointOfSale: string; //identifier for the merchant/point of purchase - is there a common identifier | ||
category?: 'Groceries' | ||
| 'Dining' | ||
| 'Home' | ||
| 'Shopping' | ||
| 'Travel' | ||
| 'Fuel'; | ||
} | ||
|
||
|
||
//example | ||
{ | ||
type: 'fdc3.purchase', | ||
data: { | ||
amount: 30, | ||
vendor: 'My Favorite Vendor', | ||
date: '9/29/2024', | ||
time: '3:28:10 PM', | ||
userId: '[email protected]', | ||
pointOfSale: 'POS_ID', | ||
category: 'Groceries' | ||
} | ||
} | ||
} | ||
|
||
//example | ||
|
@@ -71,29 +94,30 @@ Terms ('fdc3.Terms') | |
```ts | ||
interface Terms { | ||
type: string; //'fdc3.terms | ||
points: number; | ||
rate: number; | ||
provider: Provider; //identifiers and display information of bank providing terms | ||
} | ||
|
||
interface Provider { | ||
id: string; | ||
name: string; | ||
logo?: string; | ||
data: { | ||
points: number; | ||
rate: number; | ||
provider: string; //display name of bank providing terms | ||
providerId: string; //identifier of bank providing terms | ||
} | ||
} | ||
|
||
//example | ||
{ | ||
type: 'fdc3.terms', | ||
points: 13, | ||
rate: 1, | ||
provider: { | ||
name: 'E*TRADE', | ||
id: 'testApp1', | ||
logo: './images/etrade.png' | ||
} | ||
data: { | ||
points: 13, | ||
rate: 1, | ||
provider: { | ||
name: 'E*TRADE', | ||
id: 'testApp1', | ||
logo: './images/etrade.png' | ||
} | ||
} | ||
} | ||
|
||
|
||
``` | ||
|
||
intent: MakePurchase (result) | ||
|
@@ -113,7 +137,33 @@ intent: MakePurchase (result) | |
logo: './images/etrade.png' | ||
} | ||
|
||
``` | ||
|
||
```ts | ||
intent: MakePurchase (result) | ||
```ts | ||
interface PurchaseConfirmation { | ||
type: string; //fdc3.purchaseConfirmation | ||
data: { | ||
provider: Provider; | ||
} | ||
} | ||
|
||
//example | ||
{ | ||
type: 'fdc3.purchaseConfirmation', | ||
data: { | ||
provider: { | ||
name: 'E*TRADE', | ||
id: 'testApp1', | ||
logo: './images/etrade.png' | ||
} | ||
} | ||
} | ||
|
||
``` | ||
## Roadmap | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
let selected = null; | ||
const purchase = { | ||
type: 'fdc3.purchase', | ||
amount: 30, | ||
vendor: 'My Favorite Vendor', | ||
timestamp: new Date().getDate(), | ||
purchaser: 'me', | ||
merchant: 'you', | ||
category: 'stuff' | ||
data: { | ||
amount: 30, | ||
vendor: 'My Favorite Vendor', | ||
time: new Date().toLocaleTimeString(), | ||
date: new Date().toLocaleDateString(), | ||
userID: '[email protected]', | ||
pointOfSale: 'POS1', | ||
category: 'Groceries' | ||
} | ||
}; | ||
|
||
|
||
const selectCard = (id) => { | ||
const modal = document.getElementById('modal'); | ||
const cards = modal.querySelectorAll('.card'); | ||
|
@@ -29,23 +33,24 @@ const launchBankApp = (index) => { | |
}; | ||
|
||
const showSuccessModal = (message, purchaseResult) => { | ||
const modal = document.getElementById('successModal'); | ||
const modalCTA = document.getElementById('successCTA'); | ||
modalCTA.addEventListener('click', () => { hideModal('successModal');}); | ||
if (purchaseResult.provider.logo){ | ||
const logoContainer = modal.querySelector('.logo'); | ||
if (logoContainer){ | ||
let target = logoContainer.querySelector('img'); | ||
if (!target){ | ||
target = document.createElement('img'); | ||
logoContainer.appendChild(target); | ||
} | ||
target.src = purchaseResult.provider.logo; | ||
|
||
const modal = document.getElementById('successModal'); | ||
const modalCTA = document.getElementById('successCTA'); | ||
modalCTA.addEventListener('click', () => { hideModal('successModal');}); | ||
if (purchaseResult.provider.logo){ | ||
const logoContainer = modal.querySelector('.logo'); | ||
if (logoContainer){ | ||
let target = logoContainer.querySelector('img'); | ||
if (!target){ | ||
target = document.createElement('img'); | ||
logoContainer.appendChild(target); | ||
} | ||
target.src = purchaseResult.provider.logo; | ||
} | ||
} | ||
} | ||
const modalText = modal.querySelector('.textContainer .text'); | ||
modalText.textContent = message; | ||
showModal('successModal'); | ||
const modalText = modal.querySelector('.textContainer .text'); | ||
modalText.textContent = message; | ||
showModal('successModal'); | ||
} | ||
|
||
const initializeModal = () => { | ||
|
@@ -86,7 +91,7 @@ const initializeModal = () => { | |
const purchaseResponse = await fdc3?.raiseIntent('MakePurchase', purchase, selected); | ||
const purchaseResult = await purchaseResponse.getResult(); | ||
hideModal(); | ||
showSuccessModal('Purchase Successful', purchaseResult); | ||
showSuccessModal('Purchase Successful', purchaseResult.data); | ||
}); | ||
actionRow.appendChild(purchaseButton); | ||
modal.appendChild(actionRow); | ||
|
@@ -164,8 +169,8 @@ const getTerms = async () => { | |
initializeModal(); | ||
appIntents.apps.forEach(async (app) => { | ||
const result = await fdc3.raiseIntent('GetTerms', purchase, {appId: app.appId}); | ||
const data = await result.getResult(); | ||
renderBankResult(data); | ||
const contextData = await result.getResult(); | ||
renderBankResult(contextData.data); | ||
}); | ||
showModal(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters