Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CreateSetupIntentRequest #200

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 47 additions & 3 deletions src/Message/SetupIntents/CreateSetupIntentRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,48 @@
*/
class CreateSetupIntentRequest extends AbstractRequest
{
/**
* @param bool $value
*
* @return AbstractRequest provides a fluent interface.
*/
public function setConfirm($value)
{
return $this->setParameter('confirm', $value);
}

/**
* @return mixed
*/
public function getConfirm()
{
if (is_null($this->getParameter('confirm'))) {
return 'false';
}
return $this->getParameter('confirm');
}

/**
* @param bool $value
*
* @return AbstractRequest provides a fluent interface.
*/
public function setUsage($value)
{
return $this->setParameter('usage', $value);
}

/**
* @return mixed
*/
public function getUsage()
{
if (is_null($this->getParameter('usage'))) {
return 'off_session';
}
return $this->getParameter('usage');
}

/**
* @inheritdoc
*/
Expand All @@ -37,13 +79,15 @@ public function getData()
}

if ($this->getMetadata()) {
$this['metadata'] = $this->getMetadata();
$data['metadata'] = $this->getMetadata();
}
if ($this->getPaymentMethod()) {
$this['payment_method'] = $this->getPaymentMethod();
$data['payment_method'] = $this->getPaymentMethod();
}

$data['usage'] = 'off_session';
$data['confirm'] = $this->getConfirm();

$data['usage'] = $this->getUsage();
$data['payment_method_types'][] = 'card';

return $data;
Expand Down