# Group savings and loans
### Terms and conditions
[Zeplin link](https://app.zeplin.io/project/5e721967b64f570177436f96/screen/601820c0a6293624286f6c2a)
**To check:**
De onde vem a informação? é static ou tem de se fazer um pedido à API?
--> *ALINE* In USSD there are no T&C. To confirm with market if those are needed here. If so, I believe they can be static, but Burcu to confirm
### Help
[Zeplin link](https://app.zeplin.io/project/5e721967b64f570177436f96/screen/60337de5c7763f1716d0897d)
**To check:**
De onde vem a informação? é static ou tem de se fazer um pedido à API?
--> *ALINE* In USSD there are no Help/FAQ. To confirm with market if those are needed here. If so, I believe they can be static, but Burcu to confirm
### Groups list
[Zeplin](https://app.zeplin.io/project/5e721967b64f570177436f96/screen/6018248e1489310548db0120)
**Backend API name (TBD)** - View groups list API operation
**G2 API STATUS (SearchMyGroups)** - A funcionar mas faltam alguns campos
**To check:**
- O que é o Opt-Out?
--> *ALINE* We don't need opt-out for this feature as in USSD users cannot opt-out
- A API do G2 está a devolver a lista muito básica. Não tem as informações necessárias para popular a lista.
**Request**:
```
{
msidn: string,
pin: string
}
```
**Response**:
```
{
id: string,
name: string,
members: number,
userRole: UserRole,
currentBalance: number,
targetBalance?: number,
image?: url
}
```
### Group details
#### As a leader
[Zeplin link](https://app.zeplin.io/project/5e721967b64f570177436f96/screen/6018263dee5eb42d08ddc5e2)
**Backend API name (TBD)** - Get group details
**G2 API STATUS (QueryGroupBalance)** - balance do grupo (OK)
**G2 API STATUS (QueryGroupTransactions)** - statements do grupo (OK)
**G2 API STATUS (QueryGroupInfo)** - API disabled mas que devia devolver a info do grupo (NOT OK) - a confirmar com Garima
**Assumptions:**
- Pode ver a listagem de membros
- Operações: Save money, pay merchant, cashout
- Opções do grupo: editar a foto, editar targetBalance e set target quando não há target balance atualmente
**To check**
- A API do G2 está muito básica. Não tem as informações necessárias (imagem, descricao, role, o criador etc...) --> *ALINE* Image and Target don't exist in USSD, they are just available for app users
- A API do G2 não parece ter em conta o target balance
- Quem tem direito a fazer **Exit group**? --> *ALINE* No one can leave a group using the app. They should call an SP operator or contact the group leader to remove him
**Response**:
```
{
id: string,
name: string,
creator: string,
members: number,
description: string,
userRole: UserRole,
currentBalance: number,
targetBalance?: number,
image?: url,
operations: {
date: string,
type: TypeOfOperationEnum,
status: OperationStatusEnum,
amount: number,
}[] // To check: vamos ser nós a agrupar as operações ou o backend?
}
```
#### As an approver
**Backend API name (TBD)** - Get group details
[Zeplin link](https://app.zeplin.io/project/5e721967b64f570177436f96/screen/6018263d11f3a32d0b42248d)
**Assumptions:**
- Não pode ver a listagem de membros --> *ALINE* If there is an API to allow approvers to see the full list of members, that would be ideal. If there isn't, then ok, only leaders will have that capability
- Operações: Send money, pay merchant
- Exit group ? --> *ALINE* Users cannot exit a group using the app
**Response**:
```
{
id: string,
name: string,
creator: string,
members: number,
description: string,
userRole: UserRoleEnum,
currentBalance: number,
targetBalance?: number,
image?: url,
operations:
{
date: string,
type: TypeOfOperationEnum,
status: OperationStatusEnum,
amount: number,
}[] // TODO: vamos ser nós a agrupar as operações ou o backend?
}
```
#### As a member
**Backend API name (TBD)** - Get group details
[Zeplin link](https://app.zeplin.io/project/5e721967b64f570177436f96/screen/60191e2224761228ef61d6c1)
**Assumptions:**
- Operações: Save money, pay merchant
**Response**:
```
{
id: string,
name: string,
creator: string,
members: number,
description: string,
userRole: UserRoleEnum,
currentBalance: number,
targetBalance?: number,
image?: url,
operations:
{
date: string,
type: TypeOfOperationEnum,
status: OperationStatusEnum,
amount: number,
}[] // TODO: vamos ser nós a agrupar as operações ou o backend?
}
```
### Edit group - as a leader
[Zeplin link](https://app.zeplin.io/project/5e721967b64f570177436f96/screen/6019123fce376229d1a226f2)
**Backend API name (TBD)** - Edit group
**G2 API STATUS** - Não existe API do lado do G2 que suporte isto pois parecem nem suportar upload de fotos nem o set/edit do target balance.
**Assumptions:**
- Pode editar ou fazer o set do target balance
- Pode editar a foto - [Zeplin](https://app.zeplin.io/project/5e721967b64f570177436f96/screen/60191240bea647a29f733ae3)
**To check:**
- G2 não dispõe de target balance information (onde ficam guardados estes dados?) --> *ALINE* Yes, picture and target are only available for app users
**Request**:
```
{
id: string,
targetBalance: number,
}
```
### List group members
[Zeplin link](https://app.zeplin.io/project/5e721967b64f570177436f96/screen/60191244fa074a01c3ff9ec3)
**Backend API name (TBD)** - Get group members
**G2 API STATUS (ListGroupMembers)** - falta devolver o nome dos users, se não vamos ter de fazer um pedido para cada user.
**To check:**
- G2 devolve apenas msisdn e o role. Para cada user no grupo é necessário fazer um pedido de know your customer --> *ALINE* As a shortcut, could we use the contact list name if there is a match?
- Paginação? Temos infinite scroll? --> *ALINE* A group can have up to 1000 participants
- Search dos utilizadores é feito localmente ou através requests on type? --> *ALINE* Locally. Search by MSISDN and name
**Response**:
```
{
msisdn: string,
username: string,
userRole: UserRoleEnum,
}
```
### Add members to group
[Zeplin link](https://app.zeplin.io/project/5e721967b64f570177436f96/screen/6019124e79f88d418ddc303d)
**Backend API name (TBD)** - Add member to group
**G2 API STATUS (AddGroupMember)** - OK
>Validar se as restrições de numeros de approvers e leaders está a ser tida em conta neste tipo de operações bem como o user role que as está a executar.
**Assumptions:**
- Ter em conta as restrições de máximos e minimos de roles suportadas pelo grupo
- Precisa de aprovação
- --> *ALINE* Only leaders can initiate this operation
**Request**:
```
{
groupId: string,
msisdn: string,
userRoleId: UserRoleId, // usar o role id em vez de role name
}
```
### Change group member role
[Zeplin link](https://app.zeplin.io/project/5e721967b64f570177436f96/screen/60191248bfe178087f9c96cb)
**Backend API name (TBD)** - Change role of a group member
**G2 API STATUS (ChangeGroupMemberRoles)** - API com um footprint estranho pois tem uma listagem de roles a remover e uma listagem de roles a adicionar. Validar esta API!
**Assumptions:**
- Ter em conta as restrições de máximos e minimos de roles suportadas pelo grupo
- Precisa de aprovação
- --> *ALINE* Only leaders can initiate this operation
-
**Request**:
```
{
msisdn: string,
groupId: string,
userRoleId: UserRoleID, // nas edições é preciso enviar role id em vez do role name
}
```
### Remove group member
[Zeplin link](https://app.zeplin.io/project/5e721967b64f570177436f96/screen/60191248bfe178087f9c96cb)
**Backend API name (TBD)** - Remove group member
**G2 API STATUS (RemoveGroupMember)** - OK
**Assumptions:**
- Ter em conta as restrições de máximos e minimos de roles suportadas pelo grupo
- Precisa de aprovação
- --> *ALINE* Only leaders can initiate this operation
**Request**:
```
{
msisdn: string,
groupId: string,
}
```
### Save money
[Zeplin link](https://app.zeplin.io/project/5e721967b64f570177436f96/screen/6019165c1bb23c24cede77f1)
**Backend API name (TBD)** - Save money
**G2 API STATUS (SendMoneyToGroup)** - OK
**Assumptions:**
- Get current balance (SDK?) Traz a currency
- Default transaction values
**To check:**
- Como sabemos as fees que vão ser aplicadas? [Zeplin](https://app.zeplin.io/project/5e721967b64f570177436f96/screen/6019165cf3a4159a7fc28ed0) --> *ALINE* I have a list of fees but they may be outdated. Shouldn't the info come from G2?
**Request**:
```
{
amount: number,
groupId: string,
currency: string // SDK?
}
```
### Pay merchant
[Zeplin link](https://app.zeplin.io/project/5e721967b64f570177436f96/screen/6019165c1bb23c24cede77f1)
**Backend API name (TBD)** - Pay merchant
**G2 API STATUS (RequestGroupPayMerchantVoucher)** - NOT OK. À espera de confirmação da Garima.
**Assumptions:**
- Get do balance atual do grupo
- Default transaction values
- Precisa de aprovação
**To check:**
- Vai ter aprovação? --> *ALINE* Anyone can initiate a pay merchant request but it needs to be approved by 2 approvers before the initiator receives an SMS with the voucher
**Request**:
```
{
amount: number,
groupId: string,
}
```
### Cashout - leader only
[Zeplin link](https://app.zeplin.io/project/5e721967b64f570177436f96/screen/60191f957135fcbd153578d4)
**Backend API name (TBD)** - cashout
**G2 API STATUS (GroupToMemberTransfer)** - NOT OK. À espera de confirmação da Garima.
**Assumptions:**
- Enviar dinheiro para mim proprio ou para outro member (get dos membros do grupo)
- Get do balance atual do grupo
- Default transaction values
- Precisa de aprovação
**Request**:
```
{
amount: number,
groupId: string,
}
```
### Notifications
[Zeplin link](https://app.zeplin.io/project/5e721967b64f570177436f96/screen/601924d809d3c42a2d8d1d63)
**Backend API name (TBD)** - notifications list
**Assumptions:**
- Notification counter
- Notificações globais para todos os grupos
**To check:**
- Vamos ter um endpoint só para ir buscar o counter de notifications? --> *ALINE* No counter, just a circle for unread notifications
- Onde vão ficar guardadas as operações de approve que vão ter de ser mostradas aos approvers?
**Response**:
```
{
counter: number,
list:[
{
id: string,
title: string,
description: string,
timestamp: string,
amount?: number,
status: NoticationStatusEnum //read or unread,
operation: APPROVE_CASHOUT | APPROVE_PAY_MERCHANT | APPROVE_ROLE_CHANGE | APPROVE_REMOVE_USER | SAVE_MONEY | INVITATIONS // alguns destes tipos de operação vão despultar onClick na row que depois permitirá ir aprovar ou rejeitar a operação (i.e. APPROVE_XXX) type OperationEnum
operationId: string,
}
]
}
```
### Delete notification
[Zeplin link](https://app.zeplin.io/project/5e721967b64f570177436f96/screen/601924d809d3c42a2d8d1d63)
**Backend API name (TBD)** - delete notification
**Request**:
```
{
id: string
}
```
### Group invitation
[Zeplin link](https://app.zeplin.io/project/5e721967b64f570177436f96/screen/601924d934184d02c307540a)
**Backend API name (TBD)** - group invitation accept
**Assumptions:**
- Buscar info do grupo
- Buscar a data de expiração
- Role que o user vai ter
**To check:**
- O que acontece quando rejeitamos uma invitation? --> *ALINE* User is sent back to the GSL homescreen
- Tem de passar pelos approvers primeiro antes da pessoa receber o convite? --> *ALINE* Yes
**Response**:
```
{
group: ...,
expiryDate: number,
userRole: UserRoleEnum
}
```
**Request**:
```
{
msisdn: string,
groupId: string
}
```
### Operation details and approve/reject
[Zeplin link](https://app.zeplin.io/project/5e721967b64f570177436f96/screen/601926c3ee6a584f80002a6c)
[Zeplin link](https://app.zeplin.io/project/5e721967b64f570177436f96/screen/60337dd7073dbe15b6af842e)
**Backend API name (TBD)** - operation details
**Backend API name (TBD)** - operation approve/reject
**Assumptions:**
- Buscar os dados da operation id (vão existir campos em comum entre todas as operações de modo a conseguirmos re-utilizar a UI e endpoints)
**To check:**
- O que acontece com as aprovações dos pay merchant? Segue a mesma UI do cashout? -->*ALINE* Yes
**Response**:
```
{
groupName: string,
to: {username: string, msisdn: string},
from: {username: string, msisdn: string},
operation: OperationEnum,
expireDate: string,
role?: UserRoleEnum,
amount?: number,
groupBalance?: number,
fees?: number,
operationStatus: APPROVED | REJECTED | PENDING;
}
```
**G2 API STATUS (ConfirmGroupMembership)** - OK
>Validar outras API do G2 que necessitem de ter aprovação previamente antes de serem executadas
**Request to approve/reject operation**:
```
{
accept: boolean
}
```