| @@ 13-48 (lines=36) @@ | ||
| 10 | /** |
|
| 11 | * @method Response send() |
|
| 12 | */ |
|
| 13 | class AuthorizeRequest extends AbstractRequest |
|
| 14 | {
|
|
| 15 | use HasGateway, HasPaymentMethodData, HasGatewaySpecificFields, HasOwnerData; |
|
| 16 | ||
| 17 | /** |
|
| 18 | * @return array |
|
| 19 | * @throws \Omnipay\Common\Exception\InvalidCreditCardException |
|
| 20 | * @throws \Omnipay\Common\Exception\InvalidRequestException |
|
| 21 | * @throws \Omnipay\Spreedly\Exception\InvalidPaymentMethodException |
|
| 22 | */ |
|
| 23 | public function getData() |
|
| 24 | {
|
|
| 25 | $this->validate('amount', 'currency');
|
|
| 26 | ||
| 27 | $data = $this->validateAndGetPaymentMethodData(); |
|
| 28 | ||
| 29 | $data = $this->fillGatewaySpecificFields($data); |
|
| 30 | ||
| 31 | $data = $this->fillExistingParameters($data, array( |
|
| 32 | 'amount' => 'amount_integer', |
|
| 33 | 'currency_code' => 'currency', |
|
| 34 | 'email' => 'email', |
|
| 35 | )); |
|
| 36 | ||
| 37 | return array('transaction' => $data);
|
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * @return string |
|
| 42 | * @throws \Omnipay\Common\Exception\InvalidRequestException |
|
| 43 | */ |
|
| 44 | public function getEndpoint() |
|
| 45 | {
|
|
| 46 | return $this->getGatewayEndpoint() . 'authorize'; |
|
| 47 | } |
|
| 48 | } |
|
| 49 | ||
| @@ 13-48 (lines=36) @@ | ||
| 10 | /** |
|
| 11 | * @method Response send() |
|
| 12 | */ |
|
| 13 | class PurchaseRequest extends AbstractRequest |
|
| 14 | {
|
|
| 15 | use HasGateway, HasPaymentMethodData, HasGatewaySpecificFields, HasOwnerData; |
|
| 16 | ||
| 17 | /** |
|
| 18 | * @return array |
|
| 19 | * @throws \Omnipay\Common\Exception\InvalidCreditCardException |
|
| 20 | * @throws \Omnipay\Common\Exception\InvalidRequestException |
|
| 21 | * @throws \Omnipay\Spreedly\Exception\InvalidPaymentMethodException |
|
| 22 | */ |
|
| 23 | public function getData() |
|
| 24 | {
|
|
| 25 | $this->validate('amount', 'currency');
|
|
| 26 | ||
| 27 | $data = $this->validateAndGetPaymentMethodData(); |
|
| 28 | ||
| 29 | $data = $this->fillGatewaySpecificFields($data); |
|
| 30 | ||
| 31 | $data = $this->fillExistingParameters($data, array( |
|
| 32 | 'amount' => 'amount_integer', |
|
| 33 | 'currency_code' => 'currency', |
|
| 34 | 'email' => 'email', |
|
| 35 | )); |
|
| 36 | ||
| 37 | return array('transaction' => $data);
|
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * @return string |
|
| 42 | * @throws \Omnipay\Common\Exception\InvalidRequestException |
|
| 43 | */ |
|
| 44 | public function getEndpoint() |
|
| 45 | {
|
|
| 46 | return $this->getGatewayEndpoint() . 'purchase'; |
|
| 47 | } |
|
| 48 | } |
|
| 49 | ||