-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from coralsio/create-stripe-payment-intent
#support create payment intent
- Loading branch information
Showing
8 changed files
with
277 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
|
||
/** | ||
* Stripe Payment Intent Create Request. | ||
*/ | ||
|
||
namespace Corals\Modules\Payment\Stripe\Message; | ||
|
||
|
||
/** | ||
* Class CreatePaymentIntentRequest | ||
* @package Corals\Modules\Payment\Stripe\Message | ||
*/ | ||
class CreatePaymentIntentRequest extends AbstractRequest | ||
{ | ||
/** | ||
* @param $value | ||
* @return CreatePaymentIntentRequest | ||
*/ | ||
public function getIntentRequestData() | ||
{ | ||
return $this->getParameter('intentRequestData'); | ||
} | ||
|
||
/** | ||
* @param $value | ||
* @return CreatePaymentIntentRequest | ||
*/ | ||
public function setIntentRequestData($value) | ||
{ | ||
return $this->setParameter('intentRequestData', $value); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getData() | ||
{ | ||
$this->validate('amount'); | ||
|
||
$data = $this->getIntentRequestData(); | ||
|
||
$data['amount'] = $this->getAmountInteger(); | ||
|
||
return $data; | ||
} | ||
|
||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getHttpMethod() | ||
{ | ||
return 'POST'; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getEndpoint() | ||
{ | ||
return $this->endpoint . '/payment_intents'; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function createResponse($data, $headers = []) | ||
{ | ||
return $this->response = new Response($this, $data, $headers); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
/** | ||
* Stripe Payment Method Fetch Request. | ||
*/ | ||
|
||
namespace Corals\Modules\Payment\Stripe\Message; | ||
|
||
|
||
/** | ||
* Class FetchPaymentIntentRequest | ||
* @package Corals\Modules\Payment\Stripe\Message | ||
*/ | ||
class FetchPaymentMethodRequest extends AbstractRequest | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getData() | ||
{ | ||
$this->validate('paymentMethodId'); | ||
} | ||
|
||
public function setPaymentMethodId($value) | ||
{ | ||
return $this->setParameter('paymentMethodId', $value); | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getPaymentMethodId() | ||
{ | ||
return $this->getParameter('paymentMethodId'); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getHttpMethod() | ||
{ | ||
return 'GET'; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getEndpoint() | ||
{ | ||
return $this->endpoint . '/payment_methods/' . $this->getPaymentMethodId(); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function createResponse($data, $headers = []) | ||
{ | ||
return $this->response = new Response($this, $data, $headers); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
|
||
/** | ||
* Stripe Payment Intent Fetch Request. | ||
*/ | ||
|
||
namespace Corals\Modules\Payment\Stripe\Message; | ||
|
||
|
||
/** | ||
* Class CreatePaymentIntentRequest | ||
* @package Corals\Modules\Payment\Stripe\Message | ||
*/ | ||
class UpdatePaymentIntentRequest extends AbstractRequest | ||
{ | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getData() | ||
{ | ||
$this->validate('amount'); | ||
|
||
return [ | ||
'amount' => $this->getAmountInteger(), | ||
]; | ||
} | ||
|
||
public function setPaymentIntentId($value) | ||
{ | ||
return $this->setParameter('paymentIntentId', $value); | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getPaymentIntentId() | ||
{ | ||
return $this->getParameter('paymentIntentId'); | ||
} | ||
|
||
|
||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getHttpMethod() | ||
{ | ||
return 'POST'; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getEndpoint() | ||
{ | ||
return $this->endpoint . '/payment_intents/' . $this->getPaymentIntentId(); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function createResponse($data, $headers = []) | ||
{ | ||
return $this->response = new Response($this, $data, $headers); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters