private function registerBillplz($app) { $app->singleton('billplz', function ($app) { $apiKey = $app['config']->get('billplz.api_key'); $collectionId = $app['config']->get('billplz.collection_id'); $callbackUrl = $app['config']->get('billplz.callback_url'); $transport = $app->make('Cyvelnet\\Billplz\\Transporters\\Transport'); $bill = new BillBody(); // set default bill collection and callback url $bill->collection($collectionId)->callback($callbackUrl); return new Billplz($transport, $bill); }); }
/** * @param $body * @return bool|object */ public function sendCreateBillRequest(BillBody $body) { //unpack create request input $requestBody = ['collection_id' => $body->getCollection(), 'email' => $body->getEmail(), 'name' => $body->getName(), 'amount' => $body->getAmount(), 'callback_url' => $body->getCallback(), 'due_at' => $body->getDueAt(), 'mobile' => $body->getMobile(), 'metadata' => $body->getMeta(), 'deliver' => $body->getDeliver(), 'redirect_url' => $body->getRedirect()]; $this->validator->validateCreate($requestBody); return $this->sendPost(self::CREATE_BILL_URL, $requestBody); }