tripklik/blue-ribbon-bags
最新稳定版本:v2.2.1
Composer 安装命令:
composer require tripklik/blue-ribbon-bags
包简介
Laravel package for Blue Ribbon Bags API integration, powered by Tripklik
README 文档
README
A Laravel package for integrating with the Blue Ribbon Bags API. This package provides a clean and type-safe way to interact with the Blue Ribbon Bags service for baggage tracking and protection services.
Powered by Tripklik - BY INFOTEK TECHNOLOGY FZCO
Installation
You can install the package via composer:
composer require tripklik/blue-ribbon-bags
Configuration
Publish the configuration file:
php artisan vendor:publish --provider="Tripklik\BlueRibbonBags\BlueRibbonBagsServiceProvider"
Add your Blue Ribbon Bags credentials to your .env file:
BLUE_RIBBON_BAGS_BASE_URL=https://validation-api.blueribbonbags.com/api/ BLUE_RIBBON_BAGS_AUTH_TOKEN=your-auth-token
Usage
Getting Available Products
use Tripklik\BlueRibbonBags\BlueRibbonBagsClient; public function getProducts(BlueRibbonBagsClient $client) { $products = $client->getProducts('USD'); foreach ($products as $product) { echo "Product: {$product->productName}\n"; echo "Price: {$product->productPrice} {$product->currencyCode}\n"; echo "Coverage: {$product->bagCoverage}\n"; } }
Getting Available Currencies
use Tripklik\BlueRibbonBags\BlueRibbonBagsClient; public function getCurrencies(BlueRibbonBagsClient $client) { $currencies = $client->getCurrencies(); foreach ($currencies as $currency) { echo "Currency: {$currency->currencyName} ({$currency->currencyCode})\n"; } }
Purchasing a Service
use Tripklik\BlueRibbonBags\Purchase\Request\PurchaseRequest; use Tripklik\BlueRibbonBags\Purchase\Request\Passenger; use Tripklik\BlueRibbonBags\Purchase\Request\PassengersCollection; public function purchaseService(BlueRibbonBagsClient $client) { $passengers = new PassengersCollection([ new Passenger( orderSequence: 1, lastName: 'Smith', firstName: 'John', email: 'john@example.com', airlineCode: 'AA', airlineCodeType: 'IATA', airlineConfirmationNumber: 'ABC123', phone: '', sendSMS: true ), new Passenger( orderSequence: 2, lastName: 'Smith', firstName: 'Jane', email: 'jane@example.com', airlineCode: 'AA', airlineCodeType: 'IATA', airlineConfirmationNumber: 'ABC456', phone: '', sendSMS: true ) ]); $request = new PurchaseRequest( productCode: 'GOLD', isInternational: true, promoCode: '', userLogin: '', userPassword: '', customerReferenceNumber: '', replaceServiceNumberWithCRN: false, flightDetails: 'Flight details here', departureDt: new DateTime('2024-02-01 10:00:00'), lastArrivalDt: new DateTime('2024-02-02 15:00:00'), currencyCode: 'USD', agentEmailSend: 'agent@example.com', passengerList: $passengers ); $response = $client->purchaseService($request); echo "Service Number: {$response->serviceNumber}\n"; echo "Total Price: {$response->totalPrice}\n"; echo "Status: {$response->statusCode}\n"; }
Error Handling
The package provides detailed error information in the response objects. Always check the status and errors properties of the response:
$response = $client->purchaseService($request); if (!$response->status) { foreach ($response->errors as $error) { // Handle errors echo "Error: {$error}\n"; } }
Available Methods
BlueRibbonBagsClient
getProducts(string $currencyCode): Get available products for a specific currencygetCurrencies(): Get list of available currenciespurchaseService(PurchaseRequest $request): Purchase a baggage protection service
Contributing
Please see CONTRIBUTING.md for details.
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 704
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2025-01-29