Skip to content

Commit

Permalink
updated code
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrax committed Apr 8, 2024
1 parent 15fb743 commit 1338e35
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/Dpo.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,23 @@ public function createToken()
{
$xmlData = "<?xml version=\"1.0\" encoding=\"utf-8\"?><API3G><CompanyToken>" . config("dpo.company_token") . "</CompanyToken><Request>createToken</Request><Transaction><PaymentAmount>" . $this->amount . "</PaymentAmount><PaymentCurrency>" . $this->currency . "</PaymentCurrency><CompanyRef>" . $this->reference . "</CompanyRef><RedirectURL>" . config("dpo.redirect_url") . "</RedirectURL><BackURL>" . config("dpo.back_url") . " </BackURL><CompanyRefUnique>" . $this->company_ref_unique . "</CompanyRefCompanyRefUnique><PTL>5</PTL></Transaction><Services><Service><ServiceType>" . $this->service_type . "</ServiceType><ServiceDescription>" . $this->service_description . "</ServiceDescription><ServiceDate>" . now() . "</ServiceDate></Service></Services></API3G>";

return $xmlData;

$ch = curl_init();

if (!$ch) {
die("Couldn't initialize a cURL handle");
}
curl_setopt($ch, CURLOPT_URL, config("dpo.endpoint"));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/xml'));
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlData);

$result = curl_exec($ch);

curl_close($ch);
return $result;
}

public function verify_token()
Expand Down

0 comments on commit 1338e35

Please sign in to comment.