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 generated code for beta #1477

Merged
merged 4 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v294
v296
1 change: 1 addition & 0 deletions lib/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ class Event extends ApiResource
const TAX_RATE_UPDATED = 'tax_rate.updated';
const TERMINAL_READER_ACTION_FAILED = 'terminal.reader.action_failed';
const TERMINAL_READER_ACTION_SUCCEEDED = 'terminal.reader.action_succeeded';
const TERMINAL_READER_ACTION_UPDATED = 'terminal.reader.action_updated';
const TEST_HELPERS_TEST_CLOCK_ADVANCING = 'test_helpers.test_clock.advancing';
const TEST_HELPERS_TEST_CLOCK_CREATED = 'test_helpers.test_clock.created';
const TEST_HELPERS_TEST_CLOCK_DELETED = 'test_helpers.test_clock.deleted';
Expand Down
33 changes: 33 additions & 0 deletions lib/Service/Terminal/ReaderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,39 @@ public function collectInputs($id, $params = null, $opts = null)
return $this->request('post', $this->buildPath('/v1/terminal/readers/%s/collect_inputs', $id), $params, $opts);
}

/**
* Initiates a payment flow on a Reader and updates the PaymentIntent with card
* details before manual confirmation.
*
* @param string $id
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Terminal\Reader
*/
public function collectPaymentMethod($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/terminal/readers/%s/collect_payment_method', $id), $params, $opts);
}

/**
* Finializes a payment on a Reader.
*
* @param string $id
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Terminal\Reader
*/
public function confirmPaymentIntent($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/terminal/readers/%s/confirm_payment_intent', $id), $params, $opts);
}

/**
* Creates a new <code>Reader</code> object.
*
Expand Down
34 changes: 34 additions & 0 deletions lib/Terminal/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,40 @@ public function collectInputs($params = null, $opts = null)
return $this;
}

/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Terminal\Reader the collected reader
*/
public function collectPaymentMethod($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/collect_payment_method';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);

return $this;
}

/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Terminal\Reader the confirmed reader
*/
public function confirmPaymentIntent($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/confirm_payment_intent';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);

return $this;
}

/**
* @param null|array $params
* @param null|array|string $opts
Expand Down
13 changes: 13 additions & 0 deletions tests/Stripe/GeneratedExamplesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4045,4 +4045,17 @@ public function testPreviewInvoiceLinesQuote()
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\InvoiceLineItem::class, $result->data[0]);
}

public function testCreatePaymentIntent3()
{
$this->expectsRequest('post', '/v1/payment_intents');
$result = $this->client->paymentIntents->create(
[
'amount' => 200,
'currency' => 'usd',
'payment_method_data' => ['type' => 'p24', 'p24' => ['bank' => 'blik']],
]
);
static::assertInstanceOf(\Stripe\PaymentIntent::class, $result);
}
}