Skip to content

Commit

Permalink
Merge pull request #7 from stellar/release/1.0.0-rc2
Browse files Browse the repository at this point in the history
Release 1.0.0-rc2 into main (SDP-864)
  • Loading branch information
marcelosalloum authored Aug 31, 2023
2 parents 4970031 + e376690 commit 3576066
Show file tree
Hide file tree
Showing 33 changed files with 1,289 additions and 166 deletions.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Bug report
about: Tell us about a bug you found
title: ""
labels: bug
assignees: ""
---

<!-- Please answer these questions before submitting your issue. Thanks! -->

### What version are you using?

### What did you do?

### What happened?

### What did you expect to see instead?
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
blank_issues_enabled: true
contact_links:
- name: Backend Project
url: https://github.com/stellar/stellar-disbursement-platform-backend
about: The backend API where this repository's application integrates with.
- name: Stellar Laboratory
url: https://laboratory.stellar.org/#?network=test
about: The best place to experiment with the Stellar network.
- name: Docker Images
url: https://hub.docker.com/r/stellar/stellar-disbursement-platform-frontend
about: Where to check the available Docker images that have been published.
- name: Stellar Ecosystem Proposals (SEPs)
url: https://github.com/stellar/stellar-protocol
about: The SEPs implemented in this project are defined here.
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Feature request
about: Tell us what you'd like to see
title: "Feature Request: "
labels: ""
assignees: ""
---

<!-- Please answer these questions before submitting your issue. Thanks! -->

### What problem does your feature solve?

### What would you like to see?

### What alternatives are there?
57 changes: 57 additions & 0 deletions .github/ISSUE_TEMPLATE/release_a_new_version.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
name: Release a New Version!
about: Prepare a release to be launched
title: ""
labels: release
---

<!-- Please Follow this checklist before making your release. Thanks! -->

## Release Checklist

> Attention: the examples below use the version `x.y.z` but you should update
> them to use the version you're releasing.
### Git Preparation

- [ ] Decide on a version number based on the current version number and the
common rules defined in [Semantic Versioning](https://semver.org). E.g.
`x.y.z`.
- [ ] Update this ticket name to reflect the new version number, following the
pattern "Release `x.y.z`".
- [ ] Cut a branch for the new release out of the `develop` branch, following
the gitflow naming pattern `release/x.y.z`.

### Code Preparation

- [ ] Update the project's version in [package.json] accordingly.
- [ ] Update the [CHANGELOG.md] with the new version number and release notes.
- [ ] Run tests and linting, and make sure the version running in the default
branch is working end-to-end. At least the minimal end-to-end manual tests
is mandatory.
- [ ] 🚨 DO NOT RELEASE before holidays or weekends! Mondays and Tuesdays are
preferred.

### Merging the Branches

> 🚨 ATTENTION: in the following steps, do `merge commits` and NOT
> `squash-and-merge`!
- [ ] When the team is confident the release is stable, you'll need to create
two pull requests:
- [ ] `release/x.y.z -> main`: This PR should be merged with a merge commit.
- [ ] `release/x.y.z -> develop`: this should be merged after the `main`
branch is merged. This PR should be merged with a merge commit.

### Publishing the Release

- [ ] After the release branch is merged to `main`, create a new release on
GitHub with the name `x.y.z` and the use the same changes from the
[CHANGELOG.md] file.
- [ ] The release should automatically publish a new version of the docker
image to Docker Hub. Double check if that happened.

[package.json]:
https://github.com/stellar/stellar-disbursement-platform-frontend/blob/develop/package.json
[CHANGELOG.md]:
https://github.com/stellar/stellar-disbursement-platform-frontend/blob/develop/CHANGELOG.md
57 changes: 45 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,57 @@

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [1.0.0](https://github.com/stellar/stellar-relief-backoffice/tree/1.0.0)
## Unreleased

> Place unreleased changes here.
## [1.0.0.rc2](https://github.com/stellar/stellar-disbursement-platform-backend/compare/1.0.0-rc1...1.0.0-rc2)

### Added

- The payment detail to display the cash-out status per payment.
- The account status to be able to track the cash-out status per account.
- Support for a 2-step approval for the disbursement, where one user creates the
disbursement and another approves it.
[#1](https://github.com/stellar/stellar-disbursement-platform-frontend/pull/1),
[#3](https://github.com/stellar/stellar-disbursement-platform-frontend/pull/3)
- Support to edit receivers.
[#5](https://github.com/stellar/stellar-disbursement-platform-frontend/pull/5)
- Support for changing the password without resorting to the "fogot password"
flow.
[#6](https://github.com/stellar/stellar-disbursement-platform-frontend/pull/6)

### Updated
### Changed

- The account & disbursement detail pages to display the amount cashed-out per
account and per disbursement.
- Readme instructions.
[#2](https://github.com/stellar/stellar-disbursement-platform-frontend/pull/2)

## {version} < 1.0.0
## [1.0.0.rc1](https://github.com/stellar/stellar-disbursement-platform-frontend/releases/tag/1.0.0-rc1)

### Added:
### Added

- Disbursements list & detail.
- Beneficiaries (accounts) list & detail.
- Payments per disbursement detail and per account detail.
First Release Candidate of the Stellar Disbursement Platform, a tool used to
make bulk payments to a list of recipients based on their phone number and a
confirmation date. This repository is frontend-only, is a client to the backend
version available at [stellar/stellar-disbursement-platform-backend]. Their
version numbers are meant to be kept in sync.

The basic process of this product starts with an organization supplying a CSV
file which includes the recipients' phone number, transfer amount, and essential
customer validation data such as the date of birth.

The platform subsequently sends an SMS to the recipient, which includes a deep
link to the wallet. This link permits recipients with compatible wallets to
register their wallet on the SDP. During this step, they are required to verify
their phone number and additional customer data through the SEP-24 interactive
deposit flow, where this data is shared directly with the backend through a
webpage inside the wallet, but the wallet itself does not have access to this
data.

Upon successful verification, the SDP backend will transfer the funds directly
to the recipient's wallet. When the recipient's wallet has been successfully
associated with their phone number in the SDP, all subsequent payments will
occur automatically.

[stellar/stellar-disbursement-platform-backend]:
https://github.com/stellar/stellar-disbursement-platform-backend
50 changes: 23 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,30 @@
# stellar-relief-backoffice
# Stellar Disbursement Platform Frontend

## Add `/public/settings/env-config.js` file locally with the following keys:
## Introduction

### SSO
The Stellar Disbursement Platform (SDP) enables organizations to disburse bulk payments to recipients using Stellar.

- USE_SSO - variable for switch to current/old Login or to SSO Login;
- If you are going to use SSO - you need provide OIDC_REDIRECT_URI to specialist
who will configure OIDC Provider and get from them OIDC_AUTHORITY,
OIDC_CLIENT_ID, OIDC_SCOPE, OIDC_USERNAME_MAPPING;
- OIDC_USERNAME_MAPPING - is using for show in web page in "username" field;
- Options of OIDC_USERNAME_MAPPING you could find in ID Token body (in user
claims) or in OIDC Provider configure page;
- When you will switch to using SSO - it must be synchronously changed in
BackEnd side - as in current moment its possible to use only tokens from one
issuer;
This repo contains the SDP dashboard UI, which is to be used with the [Stellar Disbursement Platform Backend](https://github.com/stellar/stellar-disbursement-platform-backend). For more information on how to get started, see the Stellar [dev docs](https://developers.stellar.org/docs/category/use-the-stellar-disbursement-platform) and [API reference](https://developers.stellar.org/api/stellar-disbursement-platform).

The SDP's comprehensive dashboard includes the following pages:
* Dashboard Home (Overview): Summary of recent disbursement activities and key metrics, including successful payment rate, total successful/failed/remaining payments, total disbursed, individuals, and wallets.
* Disbursements Page (Management): Create, draft, search, filter, and export disbursements. Detailed disbursement page includes names, total payments, successes, failures, remaining, creation date, total amount, and disbursed amount.
* Receivers Page (Overview): List of individuals set to receive payments, with wallet information and payment history. May also search, filter, and export receiver data in CSV.
* Payments Page (Overview): Summary of all payments, including search by payment ID, filters, and export options. Payment detail includes Payment ID, wallet address, disbursement name, completion time, amount, and status information.
* Wallets Page (Management): View Distribution Account information including public key, balance, adding funds, and more, and manage which assets you want to use on the Stellar network.
* Analytics Page (Overview): Provides insights into financial transactions, including successful payment rate, total successful/failed/remaining payments, total disbursed, average amount, total amount per asset, and individuals and wallets involved.

Feedback and contributions are welcome!

### Config

Make sure to set the following for initial local testing:

```javascript
window._env_ = {
API_URL: "",
STELLAR_EXPERT_URL: "",
HORIZON_URL: "",
USDC_ASSET_ISSUER: "",
RECAPTCHA_SITE_KEY: "",

USE_SSO: false,
OIDC_AUTHORITY:
"https://<tenant_name>.b2clogin.com/<tenant_name>.onmicrosoft.com/<policy_name>",
OIDC_CLIENT_ID: "<client_id>",
OIDC_REDIRECT_URI: "http://localhost:3000/signin-oidc",
OIDC_SCOPE: "openid",
OIDC_USERNAME_MAPPING: "name",
};
API_URL: "https://localhost:8000",
STELLAR_EXPERT_URL: "https://stellar.expert/explorer/testnet",
HORIZON_URL: "https://horizon-testnet.stellar.org",
RECAPTCHA_SITE_KEY: "6Lego1wmAAAAAJNwh6RoOrsHuWnsciCTIL3NN-bn",
};
```
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stellar-relief-backoffice",
"version": "1.0.0",
"name": "stellar-disbursement-platform-frontend",
"version": "1.0.0-rc2",
"license": "Apache-2.0",
"engines": {
"node": ">=18.x"
Expand Down Expand Up @@ -77,7 +77,7 @@
"production": "yarn prod:build && yarn prod:serve",
"prepare": "husky install",
"pre-commit": "concurrently 'pretty-quick --staged' 'lint-staged' 'tsc --noEmit'",
"git-info": "rm -rf src/generated/ && mkdir src/generated/ && echo export default \"{\\\"commitHash\\\": \\\"$(git rev-parse --short HEAD)\\\"};\" > src/generated/gitInfo.ts"
"git-info": "rm -rf src/generated/ && mkdir src/generated/ && echo export default \"{\\\"commitHash\\\": \\\"$(git rev-parse --short HEAD)\\\", \\\"version\\\": \\\"$(git describe --tags --always)\\\"};\" > src/generated/gitInfo.ts"
},
"eslintConfig": {
"extends": [
Expand Down
22 changes: 22 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { SignIn } from "pages/SignIn";
import { MFAuth } from "pages/MFAuth";
import { ForgotPassword } from "pages/ForgotPassword";
import { ResetPassword } from "pages/ResetPassword";
import { SetNewPassword } from "pages/SetNewPassword";
import { Home } from "pages/Home";
import { Disbursements } from "pages/Disbursements";
import { DisbursementDetails } from "pages/DisbursementDetails";
Expand All @@ -22,6 +23,7 @@ import { DisbursementDraftDetails } from "pages/DisbursementDraftDetails";
import { DisbursementsDrafts } from "pages/DisbursementsDrafts";
import { Receivers } from "pages/Receivers";
import { ReceiverDetails } from "pages/ReceiverDetails";
import { ReceiverDetailsEdit } from "pages/ReceiverDetailsEdit";
import { PaymentDetails } from "pages/PaymentDetails";
import { Payments } from "pages/Payments";
import { Wallets } from "pages/Wallets";
Expand Down Expand Up @@ -49,6 +51,7 @@ export const App = () => {
useEffect(() => {
// Git commit hash
console.log("current commit hash: ", GitInfo.commitHash);
console.log("version: ", GitInfo.version);
}, []);

return (
Expand Down Expand Up @@ -84,6 +87,15 @@ export const App = () => {
</InnerPage>
}
/>
{/* Reset password (authenticated user) */}
<Route
path={Routes.SET_NEW_PASSWORD}
element={
<InnerPage isCardLayout>
<SetNewPassword />
</InnerPage>
}
/>
{/* 2FA Verification */}
<Route
path={Routes.MFA}
Expand Down Expand Up @@ -180,6 +192,16 @@ export const App = () => {
</PrivateRoute>
}
/>
<Route
path={`${Routes.RECEIVERS_EDIT}/:id`}
element={
<PrivateRoute acceptedRoles={["owner", "financial_controller"]}>
<InnerPage isNarrow>
<ReceiverDetailsEdit />
</InnerPage>
</PrivateRoute>
}
/>
{/* Payments */}
<Route
path={`${Routes.PAYMENTS}/:id`}
Expand Down
3 changes: 3 additions & 0 deletions src/api/patchOrgInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export const patchOrgInfo = async (
case "logo":
formData.append("logo", value as Blob);
break;
case "isApprovalRequired":
formData.append("data", `{"is_approval_required": ${value}}`);
break;
default:
throw Error(`Update organization does not accept ${key} field`);
}
Expand Down
32 changes: 32 additions & 0 deletions src/api/patchProfilePassword.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { handleApiResponse } from "api/handleApiResponse";
import { API_URL } from "constants/settings";
import { sanitizeObject } from "helpers/sanitizeObject";

export const patchProfilePassword = async (
token: string,
fields: {
currentPassword?: string;
newPassword?: string;
},
): Promise<{ message: string }> => {
const fieldsToSubmit = sanitizeObject({
current_password: fields.currentPassword,
new_password: fields.newPassword,
});

if (Object.keys(fieldsToSubmit).length < 2) {
throw Error(
"Update profile password requires current password and new password.",
);
}

const response = await fetch(`${API_URL}/profile/reset-password`, {
method: "PATCH",
headers: {
Authorization: `Bearer ${token}`,
},
body: JSON.stringify(fieldsToSubmit),
});

return handleApiResponse(response);
};
31 changes: 31 additions & 0 deletions src/api/patchReceiver.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { handleApiResponse } from "api/handleApiResponse";
import { API_URL } from "constants/settings";
import { sanitizeObject } from "helpers/sanitizeObject";

export const patchReceiverInfo = async (
token: string,
receiverId: string,
fields: {
email: string;
externalId: string;
},
): Promise<{ message: string }> => {
const fieldsToSubmit = sanitizeObject({
email: fields.email,
external_id: fields.externalId,
});

if (Object.keys(fieldsToSubmit).length === 0) {
throw Error("Update receiver info requires at least one field to submit");
}

const response = await fetch(`${API_URL}/receivers/${receiverId}`, {
method: "PATCH",
headers: {
Authorization: `Bearer ${token}`,
},
body: JSON.stringify(fieldsToSubmit),
});

return handleApiResponse(response);
};
Loading

0 comments on commit 3576066

Please sign in to comment.