{"id":19615188,"url":"https://github.com/fruitware/gabrielapi","last_synced_at":"2025-07-19T16:02:24.324Z","repository":{"id":33235414,"uuid":"36879714","full_name":"Fruitware/GabrielApi","owner":"Fruitware","description":"JSON Protocol B2B Portal project is created to organize ticket sales online on the websites of Agencies","archived":false,"fork":false,"pushed_at":"2023-12-15T05:44:10.000Z","size":4120,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-07-01T12:03:13.836Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Fruitware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-06-04T15:42:01.000Z","updated_at":"2016-02-23T10:48:17.000Z","dependencies_parsed_at":"2025-02-26T17:44:24.833Z","dependency_job_id":null,"html_url":"https://github.com/Fruitware/GabrielApi","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/Fruitware/GabrielApi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fruitware%2FGabrielApi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fruitware%2FGabrielApi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fruitware%2FGabrielApi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fruitware%2FGabrielApi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Fruitware","download_url":"https://codeload.github.com/Fruitware/GabrielApi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fruitware%2FGabrielApi/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262959563,"owners_count":23391057,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T10:55:43.652Z","updated_at":"2025-07-01T12:03:46.970Z","avatar_url":"https://github.com/Fruitware.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Gabriel Api\n=======================\n\nJSON Protocol B2B Portal project is created to organize ticket sales online on the websites of Agencies\n\n## Installing\n\n```bash\ncomposer require fruitware/gabriel-api\n```\n\n## Help and docs\n\n- [Reservation documentation](https://github.com/Fruitware/GabrielApi/blob/master/docs/Protocol_JSON_B2B_Portal.pdf)\n- [Invoice documentation](https://github.com/Fruitware/GabrielApi/blob/master/docs/Invoice_API.pdf)\n\n## Usage of ticket reservation\n\n```php\nnamespace MyProject;\n\nuse Fruitware\\GabrielApi\\Gabriel\\Client;\nuse Fruitware\\GabrielApi\\Gabriel\\Session;\nuse Fruitware\\GabrielApi\\Model\\Customer;\nuse Fruitware\\GabrielApi\\Model\\CustomerInterface;\nuse Fruitware\\GabrielApi\\Model\\Passenger;\nuse Fruitware\\GabrielApi\\Model\\PassengerInterface;\nuse Fruitware\\GabrielApi\\Model\\PassengerIterator;\nuse Fruitware\\GabrielApi\\Model\\Search;\nuse Fruitware\\GabrielApi\\Model\\SearchInterface;\nuse GuzzleHttp\\Client as GuzzleClient;\nuse GuzzleHttp\\Subscriber\\Log\\Formatter;\nuse GuzzleHttp\\Subscriber\\Log\\LogSubscriber;\nuse Monolog\\Formatter\\LineFormatter;\nuse Monolog\\Handler\\StreamHandler;\nuse Monolog\\Logger;\n\nclass Example \n{\n    // init Client\n    Session::setCredentials('YOUR_GABRIEL_LOGIN', 'YOUR_GABRIEL_PASSWORD');\n    $guzzleClient = new GuzzleClient(['base_url' =\u003e 'https://b2b.airmoldova.md/']);\n    $client = new Client($guzzleClient);\n\n    // set cache, if you want (your class must implement Fruitware\\GabrielApi\\CacheInterface)\n    $client-\u003esetCache(new Cache());\n\n    // create a log channel for guzzle requests, if you want\n    $log = new Logger('gabriel_guzzle_request');\n    $log-\u003epushHandler(new StreamHandler(__DIR__.'/logs/gabriel_guzzle_request.log', Logger::DEBUG));\n    $subscriber = new LogSubscriber($log, Formatter::SHORT);\n    $client-\u003egetHttpClient()-\u003egetEmitter()-\u003eattach($subscriber);\n\n    // create a log for client class, if you want (monolog/monolog required)\n    $logger = new Logger('gabriel_api');\n    $stream = new StreamHandler(__DIR__.'/logs/gabriel_api.log', Logger::DEBUG);\n    $output = \"%extra.token%: [%datetime%] %channel%.%level_name%: %message% %context% %extra%\\n\";\n    $stream-\u003esetFormatter(new LineFormatter($output, 'Y-m-d H:i:s'));\n    $logger-\u003epushHandler($stream);\n    $client-\u003esetLogger($logger);\n\n    // 1. if you already have a session token, you can set it, otherwise a new session token generated automatically\n    $client-\u003egetSession()-\u003esetToken('6215de8e576345808664376876ec9be4');\n    \n    // 2. search segments (Will generate a session token, if it was not existed)\n    $search = new Search();\n    $search\n        -\u003esetLang(SearchInterface::LANG_EN)\n        -\u003esetDepartureAirport('KIV')\n        -\u003esetArrivalAirport('MOW')\n        -\u003esetDepartureDate((new \\DateTime())-\u003emodify('+7 days'))\n        -\u003esetReturnDate((new \\DateTime())-\u003emodify('+14 days'))\n        -\u003esetAdults(1) // default 1\n        -\u003esetChildren(0) // default 0\n        -\u003esetInfants(0) // default 0\n        -\u003esetSearchOption(1) // default 1\n        -\u003esetDirectSearch(false)// default false\n    ;\n    $segments = $client-\u003esearch($search);\n    var_dump($segments);\n    \n    // 3. get current session token\n    var_dump($client-\u003egetSession()-\u003egetToken());\n    \n    // 4. set segments (option_id, option_id_back)\n    $client-\u003esetSegment(20, 36);\n    var_dump($client-\u003egetCurrentBooking());\n    \n    // 5. set passengers\n    $passengersIterator = new PassengerIterator();\n    $passenger = new Passenger();\n    $passenger\n        -\u003esetPassengerId(0)\n        -\u003esetFirstName('firstName')\n        -\u003esetLastName('lastName')\n        -\u003esetTitle(PassengerInterface::TITLE_MR)\n        -\u003esetGender(PassengerInterface::GENDER_MALE)\n        -\u003esetBirthDate(new \\DateTime('1977-01-01'))\n        -\u003esetPassport('A0000001')\n        -\u003esetPassportCountry('MD')\n        -\u003esetPassportIssued(new \\DateTime('2014-01-10'))\n        -\u003esetPassportExpire(new \\DateTime('2017-01-10'))\n        -\u003esetMobilePhone('+37322123456')\n        -\u003esetEmail('example@example.com')\n    ;\n    $passengersIterator-\u003eadd($passenger);\n    $client-\u003esetPassengers($passengersIterator);\n\n    // 6. set customer\n    // 6.1 one of the passengers can be the customer, if you already call setPassengers method\n    $client-\u003esetCustomer($passenger);\n\n    // 6.2 or you can create a customer object\n    $customer = new Customer();\n    $customer\n        -\u003esetFirstName('firstName')\n        -\u003esetLastName('lastName')\n        -\u003esetTitle(CustomerInterface::TITLE_MR)\n        -\u003esetGender(CustomerInterface::GENDER_MALE)\n        -\u003esetBirthDate(new \\DateTime('1977-01-01'))\n        -\u003esetPassport('A0000001')\n        -\u003esetPassportCountry('MD')\n        -\u003esetPassportIssued(new \\DateTime('2014-01-10'))\n        -\u003esetPassportExpire(new \\DateTime('2017-01-10'))\n        -\u003esetMobilePhone('+37322123456')\n        -\u003esetEmail('example@example.com')\n    ;\n    $client-\u003esetCustomer($customer);\n    var_dump($client-\u003egetCurrentBooking());\n    \n    // 6. set payment type\n    $client-\u003esetPayment(PaymentInterface::TYPE_INVOICE);\n    var_dump($client-\u003egetCurrentBooking());\n    \n    // 7. Confirm reservation\n    $client-\u003efinalizeBooking();\n    var_dump($client-\u003egetCurrentBooking());\n    \n    // 8. If you want cancel reservation\n    $newSessionToken = $client-\u003ereset();\n    var_dump($newSessionToken); // or var_dump($client-\u003egetSession()-\u003egetToken());\n}\n```\n\n## Usage of invoice api\n\n```php\nnamespace MyProject;\n\nuse Fruitware\\GabrielApi\\Invoice\\Client;\nuse Fruitware\\GabrielApi\\Invoice\\Session;\nuse GuzzleHttp\\Client as GuzzleClient;\nuse GuzzleHttp\\Subscriber\\Log\\Formatter;\nuse GuzzleHttp\\Subscriber\\Log\\LogSubscriber;\nuse Monolog\\Formatter\\LineFormatter;\nuse Monolog\\Handler\\StreamHandler;\nuse Monolog\\Logger;\n\nclass Example \n{\n    // init Client\n    Session::setCredentials('YOUR_INVOICE_LOGIN', 'YOUR_INVOICE_PASSWORD');\n    $guzzleClient = new GuzzleClient(['base_url' =\u003e 'https://b2b.airmoldova.md/']);\n    $client = new Client($guzzleClient);\n\n    // create a log channel for guzzle requests, if you want\n    $log = new Logger('gabriel_guzzle_request');\n    $log-\u003epushHandler(new StreamHandler(__DIR__.'/logs/gabriel_guzzle_request.log', Logger::DEBUG));\n    $subscriber = new LogSubscriber($log, Formatter::SHORT);\n    $client-\u003egetHttpClient()-\u003egetEmitter()-\u003eattach($subscriber);\n\n    // create a log for client class, if you want (monolog/monolog required)\n    $logger = new Logger('gabriel_api');\n    $stream = new StreamHandler(__DIR__.'/logs/gabriel_api.log', Logger::DEBUG);\n    $output = \"%extra.token%: [%datetime%] %channel%.%level_name%: %message% %context% %extra%\\n\";\n    $stream-\u003esetFormatter(new LineFormatter($output, 'Y-m-d H:i:s'));\n    $logger-\u003epushHandler($stream);\n    $client-\u003esetLogger($logger);\n\n    // 1. Get invoice by number\n    $invoiceNumber = '123456';\n    $invoice = $client-\u003eget($invoiceNumber);\n    var_dump($invoice);\n\n    // 2. Pay invoice - REAL invoice. \n    // if you want to cancel the invoice, then you should be in the administrator role on the site https://b2b.airmoldova.md/ by the user YOUR_INVOICE_LOGIN\n    $paymentTypeCode = 0; // 0 - cash, 1 - card, 2+ - reserved\n    $transactionNumber = '67567'; // receipt number for cash type or card number for card type\n    $invoice = $client-\u003epay($invoiceNumber);\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffruitware%2Fgabrielapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffruitware%2Fgabrielapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffruitware%2Fgabrielapi/lists"}