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.
updated data formats. restored accidentally overwritten changes to apps
- Loading branch information
Showing
10 changed files
with
188 additions
and
57 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' | ||
} | ||
} | ||
} | ||
``` | ||
|
||
|
@@ -59,15 +82,58 @@ Terms ('fdc3.Terms') | |
```ts | ||
interface Terms { | ||
type: string; //'fdc3.terms | ||
points: number; | ||
rate: number; | ||
provider: string; //display name of bank providing terms | ||
providerId: string; //identifier of bank providing terms | ||
data: { | ||
points: number; | ||
rate: number; | ||
provider: string; //display name of bank providing terms | ||
providerId: string; //identifier of bank providing terms | ||
} | ||
} | ||
|
||
//example | ||
{ | ||
type: 'fdc3.terms', | ||
data: { | ||
points: 13, | ||
rate: 1, | ||
provider: { | ||
name: 'E*TRADE', | ||
id: 'testApp1', | ||
logo: './images/etrade.png' | ||
} | ||
} | ||
} | ||
|
||
``` | ||
|
||
intent: MakePurchase | ||
|
||
```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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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'); | ||
|
@@ -28,13 +32,24 @@ const launchBankApp = (index) => { | |
window.open(`./bank-app${index}.html`, '_blank'); | ||
}; | ||
|
||
const showSuccessModal = (message) => { | ||
const modal = document.getElementById('successModal'); | ||
const modalCTA = document.getElementById('successCTA'); | ||
modalCTA.addEventListener('click', () => { hideModal('successModal');}); | ||
const modalText = modal.querySelector('.textContainer .text'); | ||
modalText.textContent = message; | ||
showModal('successModal'); | ||
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 modalText = modal.querySelector('.textContainer .text'); | ||
modalText.textContent = message; | ||
showModal('successModal'); | ||
} | ||
|
||
const initializeModal = () => { | ||
|
@@ -75,7 +90,7 @@ const initializeModal = () => { | |
const purchaseResponse = await fdc3?.raiseIntent('MakePurchase', purchase, selected); | ||
const purchaseResult = await purchaseResponse.getResult(); | ||
hideModal(); | ||
showSuccessModal('Purchase Successful'); | ||
showSuccessModal('Purchase Successful', purchaseResult.data); | ||
}); | ||
actionRow.appendChild(purchaseButton); | ||
modal.appendChild(actionRow); | ||
|
@@ -104,14 +119,22 @@ const renderBankResult = (data) => { | |
return; | ||
} | ||
const bankCard = document.createElement('div'); | ||
bankCard.id = data.providerId; | ||
bankCard.addEventListener('click', () => { selectCard(data.providerId)}); | ||
bankCard.id = data.provider.id; | ||
bankCard.addEventListener('click', () => { selectCard(data.provider.id)}); | ||
bankCard.classList.add('card'); | ||
const cardHeader = document.createElement('div'); | ||
cardHeader.classList.add('header'); | ||
const headerText = document.createElement('div'); | ||
headerText.classList.add('text'); | ||
headerText.textContent = data.provider; | ||
if (data.provider.logo) { | ||
headerText.classList.add('logo'); | ||
const logo = document.createElement('img'); | ||
logo.src = data.provider.logo; | ||
logo.title = data.provider.name; | ||
headerText.appendChild(logo); | ||
} else { | ||
headerText.classList.add('text'); | ||
headerText.textContent = data.provider; | ||
} | ||
cardHeader.appendChild(headerText); | ||
bankCard.appendChild(cardHeader); | ||
|
||
|
@@ -145,8 +168,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