Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docs/api/scripts): adding a How To run the refunds transaction o…
…n heroku
- Loading branch information
1 parent
4281ca9
commit 04f6565
Showing
1 changed file
with
46 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Script | ||
|
||
The script opencollective-api [refund script](https://github.com/opencollective/opencollective-api/blob/master/scripts/add_refund_transactions_from_collective.js) tries to find transactions to refund given a **List/Array** of **FromCollectiveId** . | ||
|
||
It looks through all transactions in the opencollective database and returns the transactions(that were still not refunded yet) that match the field **FromCollectiveId** with the Input List(as said above). | ||
|
||
## Running the Script | ||
|
||
### Set the HEROKU Environment variable | ||
|
||
You can log into heroku and go to the main dashboard(link: https://dashboard.heroku.com/apps/opencollective-prod-api) | ||
You'll see something like this | ||
|
||
|
||
### Go to the setting tabs | ||
|
||
Through the picture above you'll see multiple tabs, then look for the setting ones and click on the button `Reveal config vars`. | ||
|
||
You'll see a list with some variables and its respective values beside. | ||
|
||
|
||
### Edit the Environment Variable FROM_COLLECTIVE_IDS | ||
|
||
You look for the variable named `FROM_COLLECTIVE_IDS` and change it to the value you want. In case you don't find it on the list you can just add it. | ||
|
||
Example: | ||
|
||
- if you want to refund all transactions that a collective with id X has done you'll set this `FROM_COLLECTIVE_IDS` to `X`: | ||
- `FROM_COLLECTIVE_IDS`: X | ||
|
||
- if you want to refund all transactions that a collective with id X **AND** another collective with id Y has done you'll set this `FROM_COLLECTIVE_IDS` to `X,Y`: | ||
- `FROM_COLLECTIVE_IDS`: X,Y | ||
|
||
- if you want to refund all transactions that a collective with id X **AND** another collective with id Y **AND** another collective with id W has done you'll set this `FROM_COLLECTIVE_IDS` to `X,Y,W`: | ||
- `FROM_COLLECTIVE_IDS`: X,Y,W | ||
|
||
- And so On... | ||
|
||
### Running heroku | ||
|
||
We have more than one option here(using the heroku interface or using the terminal). I'll go with the terminal version: | ||
|
||
1. Make sure you have heroku installed in your machine | ||
2. Make sure you are logged in to the opencollective heroku account | ||
3. run in staging: `heroku run npm run refund-transactions --app opencollective-staging-api` | ||
4. run in production: `heroku run npm run refund-transactions --app opencollective-prod-api` |