0.1.1 • Published 11 months ago

unchainedshop-bobzero-plugin v0.1.1

Weekly downloads
-
License
EUPL-1.2
Repository
github
Last release
11 months ago

unchainedshop-bobzero-plugin

Plugin for unchained engine to support payments with the bob zero ecommerce product of bob Finance AG.

Setup

Environment configuration

The following values need be set as ENV variables in your unchained engine.

Env VariableDescription
BOB_ZERO_API_ENDPOINTbob Zero endpoint to connect. The correct URLs can be found in the bob partner dashboard once you have a login. Usually the url looks something like this https://api.bob.ch for production and https://api.stage.bob.ch for the sandbox test environment
 BOB_ZERO_API_KEYThe api key that has will be passed as bob zero specific header bobFinanceSuiteApiKey when calling the endpoints. Our specific key can be found in the bob partner dashboard
BOB_ZERO_WEBHOOK_KEYThe authorization header that is set for all incoming webhooks from bob zero. The plugin checks for a correct authorization header before processing the webhook call. Our specific key can be found in the bob partner dashboard.

Add webhook handler

Add the marked code to the boot.ts file of your engine.

...

// ### BOB ZERO PLUGIN - START ### --> REQUIRED IMPORTS
import { BobZeroWebhookHandler } from 'unchainedshop-bobzero-plugin'
import { useMiddlewareWithCurrentContext } from '@unchainedshop/api/express/index.js'
// ### BOB ZERO PLUGIN - END ###


// ### BOB ZERO PLUGIIN - START ### --> WEBHOOK PATH
const BOB_ZERO_WEBHOOK_PATH = '/payment/bobzero/webhook'
// ### BOB ZERO PLUGIIN - END ###


const start = async () => {
  const app = express()

  ...

  // Start the GraphQL Server
  await engine.apolloGraphQLServer.start()

  connectPlatformToExpress4(app, engine)

  // ### BOB ZERO PLUGIIN - START ### --> WEBHOOK HANDLER CODE

  // Connect bob zero webhook handler
  useMiddlewareWithCurrentContext(
    app,
    BOB_ZERO_WEBHOOK_PATH,
    express.json(),
    BobZeroWebhookHandler,
  )

  // ### BOB ZERO PLUGIIN - END ###

  connectDefaultPluginsToExpress4(app, engine)

That's it. You are good to go! 🚀

0.0.20

12 months ago

0.0.21

12 months ago

0.0.22

12 months ago

0.0.23

12 months ago

0.0.24

12 months ago

0.0.25

12 months ago

0.0.15

12 months ago

0.0.16

12 months ago

0.0.17

12 months ago

0.0.18

12 months ago

0.0.19

12 months ago

0.0.30

12 months ago

0.0.31

12 months ago

0.0.32

12 months ago

0.0.10

12 months ago

0.0.33

12 months ago

0.0.11

12 months ago

0.0.34

12 months ago

0.0.12

12 months ago

0.0.35

12 months ago

0.0.13

12 months ago

0.0.14

12 months ago

0.1.0

12 months ago

0.1.1

11 months ago

0.0.26

12 months ago

0.0.27

12 months ago

0.0.29

12 months ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago