Skip to content

Commit

Permalink
Update PurchaseRequest.php
Browse files Browse the repository at this point in the history
  • Loading branch information
zek committed Oct 28, 2018
1 parent cc5347e commit d929b95
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/Message/PurchaseRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,20 @@ public function getName()

public function getData()
{
$this->validate('name', 'description', 'amount', 'currency', 'redirect_url', 'metadata');
$this->validate('name', 'description', 'amount', 'currency', 'redirect_url', 'metadata', 'pricing_type');
$data = [];
$data['amount'] = $this->getAmount();
$data['name'] = $this->getName();
$data['description'] = $this->getDescription();
$data['pricing_type'] = 'fixed_price';
$data['pricing_type'] = $this->getParameter('pricing_type');
$data['redirect_url'] = $this->getRedirectUrl();
$data['metadata'] = $this->getMetaData();
$data['local_price'] = [
'amount' => $this->getAmount(),
'currency' => $this->getCurrency(),
];
if ($this->getParameter('pricing_type') == 'fixed_price') {
$data['local_price'] = [
'amount' => $this->getAmount(),
'currency' => $this->getCurrency(),
];
}
return $data;
}

Expand All @@ -61,4 +63,4 @@ public function sendData($data)
$response = $this->sendRequest('POST', '/charges', $data);
return $this->response = new PurchaseResponse($this, $response);
}
}
}

0 comments on commit d929b95

Please sign in to comment.