2017 © Pedro Peláez
 

library bonapiti-bonanza-php-sdk

PHP SDK for Bonanza Marketplace and its "Bonapitit" REST API.

image

shoplo/bonapiti-bonanza-php-sdk

PHP SDK for Bonanza Marketplace and its "Bonapitit" REST API.

  • Tuesday, July 10, 2018
  • by shoplo
  • Repository
  • 5 Watchers
  • 2 Stars
  • 4,646 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 6 Versions
  • 16 % Grown

The README.md

bonapiti-bonanza-php-sdk

PHP SDK for Bonanza Marketplace and its "Bonapitit" REST API., (*1)

Package currently has got support for calling Bonanza's methods:, (*2)

Method name Is secure
fetchToken no
getCategories no
getCategoryTraits no
getSingleItem no
getBoothItems yes
getUnlistedItem yes
getOrders yes
getUser yes
addFixedPriceItem yes
reviseFixedPriceItem yes
endFixedPriceItem yes
updateBooth yes
setNotificationPreferences yes
getNotificationPreferences yes

Please refer to the Bonanza's API docs here: https://api.bonanza.com/docs, (*3)

Basic usage

For every call you need devID and certID that you can obtain here: https://api.bonanza.com/accounts/new, (*4)

Unsecure calls

<?php

use Shoplo\BonanzaApi\Client\BonanzaClient;
use Shoplo\BonanzaApi\Credentials\Credentials;
use Shoplo\BonanzaApi\Request\GetBoothItemsRequest;

//Create credentials object using obtained data
$credentials = new Credentials('devID', 'certID');

//Create bonanza client
$client = new BonanzaClient($credentials);

//Create request
$request = new GetBoothItemsRequest();
$request->page = 1;
$request->itemsPerPage = 3;
$request->boothId = 'boothName';

//Make a call and receive GetBoothItemsResponse object
$response = $client->getBoothItems($request);

Secure calls

To make secure call, you need to obtain user auth token first. To receive it, you need to make fetchToken call:, (*5)

<?php

use Shoplo\BonanzaApi\Request\FetchTokenRequest;

//Create request, and provide the callback url
$request = new FetchTokenRequest();
$request->validationCompleteURL = 'http://return.to/url';

//Make a call and get the authorization URL
$response = $client->fetchToken($request);

//You have the auth token here, but it is inactive, so you can save it for example in the session
$authToken = $response->fetchTokenResponse->authToken;

//Then you redirect user to the page, where he need to log in and confirm the token.
// After confirmation the user is taken back to the validationCompleteURL.
header('Location: '.$response->fetchTokenResponse->authenticationURL);

When the access token is signed, you can make a secure call., (*6)

<?php

use Shoplo\BonanzaApi\Client\BonanzaClient;
use Shoplo\BonanzaApi\Credentials\Credentials;
use Shoplo\BonanzaApi\Request\GetBoothItemsRequest;
use Shoplo\BonanzaApi\Type\RequesterCredentialsType;

//Create credentials object using obtained data
$credentials = new Credentials('devID', 'certID');

//Create bonanza client
$client = new BonanzaClient($credentials);

//Create requester credentials containing the received token
$requesterCredentials = new RequesterCredentialsType();
$requesterCredentials->bonanzleAuthToken = 'authToken';

//Create request and pass the requesterCredentials to authorize the request
$request = new GetBoothItemsRequest();
$request->requesterCredentials = $requesterCredentials;
$request->page = 1;
$request->itemsPerPage = 3;
$request->boothId = 'boothName';

//Make a call and receive GetBoothItemsResponse object
$response = $client->getBoothItems($request);

The Versions

10/07 2018

dev-master

9999999-dev

PHP SDK for Bonanza Marketplace and its "Bonapitit" REST API.

  Sources   Download

MIT

The Requires

 

by marrek13

10/07 2018

v0.2.3

0.2.3.0

PHP SDK for Bonanza Marketplace and its "Bonapitit" REST API.

  Sources   Download

MIT

The Requires

 

by marrek13

10/07 2018

v0.2.2

0.2.2.0

PHP SDK for Bonanza Marketplace and its "Bonapitit" REST API.

  Sources   Download

MIT

The Requires

 

by marrek13

14/02 2018

v0.2.1

0.2.1.0

PHP SDK for Bonanza Marketplace and its "Bonapitit" REST API.

  Sources   Download

MIT

The Requires

 

by marrek13

01/02 2018

v0.2

0.2.0.0

PHP SDK for Bonanza Marketplace and its "Bonapitit" REST API.

  Sources   Download

MIT

The Requires

 

by marrek13

09/11 2017

0.1

0.1.0.0

PHP SDK for Bonanza Marketplace and its "Bonapitit" REST API.

  Sources   Download

MIT

The Requires

 

by marrek13