2.18.29 • Published 9 months ago

@oluko/oluko-services v2.18.29

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

oluko-services

npm package module for Oluko general services

Publish package

  1. Upgrade version in package.json

  2. npm run publish-pkg

or if you want to run all by hand:

    • npm run build
    • cd pkg
    • npm publish

Link locally

To link this package in a target project locally:

  • npm run link

or if you want to run all by hand:

  • npm run build
  • cd pkg
  • npm link

in target project:

  • npm link @olukomaster/oluko-services

    you need to run npm link @olukomaster/oluko-services in the target project every time you change something in the package if you have an issue with this package, you should first do npm i in the target project and then npm link @olukomaster/oluko-services remove @olukomaster/oluko-services from the package.json in the target project since link will use the local version

CLI use

$ oluko-services <command>

Command:
    seed-create [description] [cant]              create seed file history in /history, for start data
    seed-generate [seed-file.ts]                  generate the seeds in /history to documents in firebase

Examples

    $ oluko-services seed-create user 2
    create file /history/seed_yyyy_mm_dd_hhMMms_user.ts  with two docs for add in firebase.

    $ oluko-services seed-generate
    Load files in /history/ to push in firebase if not pushed before.

    $ oluko-services seed-generate seed_yyyy_mm_dd_hhMMms_user.ts
    Load files in /history/seed_yyyy_mm_dd_hhMMms_user.ts to update in firebase.

IMAGES

  1. they are being resized in: storage-resized-images/index.ts, every time an image is uploaded it kicks that process in firebase.

CLI command create

  1. implement the command Class in /cli/factory/command-example.command.ts and extends CLIFactory.BaseFactoryCommand or implements CLIFactory.IFactoryCommand
  2. add the command is in /cli/factory/commands.ts config
  3. add command --help to /cli/factory/commands.ts helpDescription

stripe:

to create products,plans and prices in stripe:

// await this.copyProducts(); // await this.copyPrices(); //await this.copyCoupons(); //https://stripe.com/docs/billing/subscriptions/coupons

update solution webhooks to listen for stripe changes: go to https://dashboard.stripe.com/webhooks click in connect search in the search bar for webhooks click on +add endpoint http://us-central-peppermint-development.cloudfunctions.net/payment/hookSubscriptions customer.subscription.created customer.subscription.deleted customer.subscription.updated

before saving this endpoint and the events remember to save as connected account. repeat previous steps with this other data https://us-central-peppermint-development.cloudfunctions.net/payment/hookPlans plan.created plan.updated price.updated product.updated

Create user plans: create the plan in stripe and then just hit payment controller: /create-plan-firebase/:id with id= productId, this should be automatic but if webhook does not work run this method

how we should handle subscription payment is failing: https://benfoster.io/blog/stripe-failed-payments-how-to/

emulate strip cli windows to use webhooks or whatever:

instructions for install https://github.com/stripe/stripe-cli

CLI DOCS:
https://stripe.com/docs/cli

if you want to listen localhost events in the cli installed u'll need to do this: https://dashboard.stripe.com/webhooks/create?endpoint_location=local

steps windows:
open powershell:
> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser # Optional: Needed to run a remote script the first time
> irm get.scoop.sh | iex
close open new powershell
> scoop bucket add stripe https://github.com/stripe/scoop-stripe-cli.git
> scoop install stripe

close open new powershell
stripe login  -> will ask you to copy a url and paste it in the browser to log in
stripe listen --forward-to localhost:3001/payment/hookSubscriptions will hear any event in that endpoint in the port you are running the project
with that running in a powershell instance you'll see in https://dashboard.stripe.com/test/webhooks a local listener with status listen
open a new powershell to send an event: for example: stripe trigger invoice.payment_action_required