Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SecureToken.php
Go to the documentation of this file.
1 <?php
7 
14 
19 {
23  private $url;
24 
28  private $mathRandom;
29 
33  private $transparent;
34 
40  public function __construct(
41  UrlInterface $url,
42  Random $mathRandom,
43  Transparent $transparent
44  ) {
45 
46  $this->url = $url;
47  $this->mathRandom = $mathRandom;
48  $this->transparent = $transparent;
49  }
50 
59  public function requestToken(Quote $quote)
60  {
61  $this->transparent->setStore($quote->getStoreId());
62  $request = $this->transparent->buildBasicRequest();
63 
65  $request->setVerbosity('HIGH');
66  $request->setAmt(0);
67  $request->setCreatesecuretoken('Y');
68  $request->setSecuretokenid($this->mathRandom->getUniqueHash());
69  $request->setReturnurl($this->url->getUrl('paypal/transparent/response'));
70  $request->setErrorurl($this->url->getUrl('paypal/transparent/response'));
71  $request->setCancelurl($this->url->getUrl('paypal/transparent/cancel'));
72  $request->setDisablereceipt('TRUE');
73  $request->setSilenttran('TRUE');
74 
75  $this->transparent->fillCustomerContacts($quote, $request);
76 
77  $result = $this->transparent->postRequest($request, $this->transparent->getConfig());
78 
79  return $result;
80  }
81 }
$quote
__construct(UrlInterface $url, Random $mathRandom, Transparent $transparent)
Definition: SecureToken.php:40