PHP code example of vahidkaargar / bamboo-card-portal

1. Go to this page and download the library: Download vahidkaargar/bamboo-card-portal library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vahidkaargar / bamboo-card-portal example snippets


$bamboo = bamboo();
$bamboo = bamboo('username', 'password', false);

use vahidkaargar\BambooCardPortal\Bamboo;
$bamboo = new Bamboo();
$bamboo = new Bamboo('username', 'password', true);

use vahidkaargar\BambooCardPortal\Bamboo;

$bamboo = new Bamboo();

// Version 1
$catalogs = $bamboo->catalogs()->get();

// Version 2
$catalogs = $bamboo->catalogs()
    ->setVersion(2)
    ->setName('playstation germany')
    ->setProductId(114111)
    ->setBrandId(100)
    ->setCountryCode('US')
    ->setCurrencyCode('USD')
    ->setModifiedDate('2022-08-21')
    ->setPageIndex(default: 0)
    ->setPageSize(default: 150)
    ->get();

use vahidkaargar\BambooCardPortal\Bamboo;

$bamboo = new Bamboo();
$account = $bamboo->accounts()->get();

use vahidkaargar\BambooCardPortal\Bamboo;

$bamboo = (new Bamboo())->orders();
 
/*
 * checkout and create an order
 * you can add multiple products
 */
$requestedId = Str::uuid();
$checkout = $bamboo->setRequestId($requestedId)
    ->setAccountId($accountId)
    ->setProducts([
        ["ProductId" => $productId, "Quantity" => $quantity, "Value" => $value],
        ["ProductId" => $productId2, "Quantity" => $quantity2, "Value" => $value2],
        ["ProductId" => $productId3, "Quantity" => $quantity3, "Value" => $value3],
    ])
    ->setProduct($productId4, $quantity4, $value4)
    ->checkout();
 
/*
 * get orders between to date e.g. 2022-05-02
 */
$orders = $bamboo->setStartDate('2022-05-02')
    ->setEndDate('2022-05-20')
    ->get();

/*
 * get orders base on $requestedId, its string
 */
$order = $bamboo->get($requestedId);

use vahidkaargar\BambooCardPortal\Bamboo;

$bamboo = new Bamboo();
$exchange = $bamboo->exchange()
    ->setBaseCurrency('USD')
    ->setCurrency('EUR')
    ->rate();

use vahidkaargar\BambooCardPortal\Bamboo;

$bamboo = new Bamboo();
/*
 * get orders between to date e.g. 2022-05-02
 */
$transactions = $bamboo->transactions()
    ->setStartDate('2022-05-02')
    ->setEndDate('2022-05-20')
    ->get();

use vahidkaargar\BambooCardPortal\Bamboo;

$bamboo = new Bamboo();

/*
 * get notification that you created
 */
$notification = $bamboo->notifications()->get();

/*
 * create notification listener
 */
$notification = $bamboo->notifications()
    ->setNotificationUrl('https://your-website.com/notification-listener')
    ->setSecretKey('your-secret-key')
    ->create();
bash
php artisan vendor:publish --tag=bamboo-config