Skip to content

Commit

Permalink
Populate links boleto
Browse files Browse the repository at this point in the history
  • Loading branch information
edson-nascimento committed Oct 5, 2018
1 parent 714b4b4 commit d2cf931
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
15 changes: 13 additions & 2 deletions src/Getnet/API/BoletoRespose.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,31 @@ public function setBaseUrl($base_url) {
return $this;
}

/**
*
* @param mixed $base_url
*/
public function generateLinks() {
if ($this->getPaymentId()) {
$this->boleto_pdf = $this->base_url."/v1/payments/boleto/".$this->getPaymentId()."/pdf";
$this->boleto_html = $this->base_url."/v1/payments/boleto/".$this->getPaymentId()."/html";
}
}

/**
*
* @return mixed
*/
public function getBoletoPdf() {
return $this->boleto_pdf = $this->base_url."/v1/payments/boleto/".$this->getPaymentId()."/pdf";
return $this->boleto_pdf;
}

/**
*
* @return mixed
*/
public function getBoletoHtml() {
return $this->boleto_html = $this->base_url."/v1/payments/boleto/".$this->getPaymentId()."/html";
return $this->boleto_html;
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/Getnet/API/Getnet.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ public function boleto(Transaction $transaction) {
$boletoresponse = new BoletoRespose();
$boletoresponse->mapperJson($response);
$boletoresponse->setBaseUrl($request->getBaseUrl());
$boletoresponse->generateLinks();

return $boletoresponse;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Getnet/API/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public function addShippingByCustomer(Customer $customer) {
* @param $brand
* @return Credit
*/
public function credit($brand) {
public function credit($brand = null) {
$credit = new Credit($brand);
$this->setCredit($credit);

Expand Down

0 comments on commit d2cf931

Please sign in to comment.