useRest === FALSE) { $this->client = new SoapClient(); } else { $this->client = new RestClient(); } } /** * Force to use Rest client. * */ public function setRest() { if (!$this->client instanceof RestClient) { $this->client = null; $this->client = new RestClient(); $this->useRest = TRUE; } } /** * Create order information * * @param array $order * @param string $order_type */ public function set_order($order, $order_type) { $this->client->setOrder($order, $order_type); $this->order = $this->client->getOrder(); } /** * Function to create order lines * * @param string $product_id * @param string $description * @param int $quantity * @param int $unit_price * @param int $vat_category * @param int $vat_amount * @param int $googleProductCategoryId * @param string $googleProductCategory * @param string $productUrl * @param string $imageUrl */ public function create_order_line( $product_id, $description, $quantity, $unit_price, $vat_category = null, $vat_amount = null, $googleProductCategoryId = null, $googleProductCategory = null, $productUrl = null, $imageUrl = null ) { $this->client->createOrderLine( $product_id, $description, $quantity, $unit_price, $vat_category, $vat_amount, $googleProductCategoryId, $googleProductCategory, $productUrl, $imageUrl ); } /** * Process request to SOAP/REST webservice * * @param array $authorization * @param string $mode * */ public function do_request($authorization, $mode) { $this->client->doRequest($authorization, $mode); $this->authorization = $this->client->getAuthorization(); $this->modus = $this->client->getMode(); $this->order_result = $this->client->getOrderResult(); } /** * If order management is used set action to true; * * @param string $action */ public function set_ordermanagement($action) { $this->client->setOrderManagement($action); } /** * Check validation error and give back readable error message * * @param string $failureCode * @return array|string */ public function check_validation_error($failureCode) { return \Afterpay\check_validation_error($failureCode); } /** * Check rejection error and give back readable error message * * @param int $rejectionCode * @return array|string */ public function check_rejection_error($rejectionCode) { return \Afterpay\check_rejection_error($rejectionCode); } /** * Expose client method to manually set order country * @param $country */ public function setOrderCountry($country) { $this->client->setCountry($country); } }