bluesnap-golang-sdk

module
v0.0.0-...-2e24adf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2021 License: MIT

README

Bluesnap Golang SDK

This was written for the Revel Framework This is not actively maintained, but can be updated if sponsered to do so

Setup

  • Edit bluesnap/api.go lines 6 and 61. Change myApp to your app name
  • Add OS Environment Variables for the following:
    • TEST_BS_API_USER
    • TEST_BS_PASS
    • TEST_BS_STORE_ID
    • TEST_BS_ENDPOINT
    • TEST_BS_PRODUCT_ID
    • BS_API_USER
    • BS_PASS
    • BS_STORE_ID
    • BS_ENDPOINT
    • BS_PRODUCT_ID

Instructions

Include it where needed

import(
  "myApp/bluesnap"
)

Example Code

Example for getting a users cards

if len(account.BSShopperId) == 0 {
		return c.RenderJson(Cards{Message: getSuccessMessage("No cards on file."), Cards: &bluesnap.CardList{
			Values: make([]*bluesnap.Card, 0),
		}})

} else {
		b := &bluesnap.BlueSnap{}
		b.Init()
		b.Test = !isProd
		cList, err := b.GetCards(account.BSShopperId)
		if err != nil {
			return c.RenderJson(Cards{Message: getSuccessMessage("Error getting cards on file."), Cards: &bluesnap.CardList{
				Values: make([]*bluesnap.Card, 0),
			}})
		}
		return c.RenderJson(Cards{Message: getSuccessMessage("Cards on file"), Cards: cList})
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL