| @@ 9-53 (lines=45) @@ | ||
| 6 | use zaporylie\Vipps\Resource\HttpMethod; |
|
| 7 | use zaporylie\Vipps\VippsInterface; |
|
| 8 | ||
| 9 | class GetOrderStatus extends PaymentResourceBase |
|
| 10 | { |
|
| 11 | ||
| 12 | /** |
|
| 13 | * @var \zaporylie\Vipps\Resource\HttpMethod |
|
| 14 | */ |
|
| 15 | protected $method = HttpMethod::GET; |
|
| 16 | ||
| 17 | /** |
|
| 18 | * @var string |
|
| 19 | */ |
|
| 20 | protected $path = '/ecomm/v2/payments/{id}/status'; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * InitiatePayment constructor. |
|
| 24 | * |
|
| 25 | * @param \zaporylie\Vipps\VippsInterface $vipps |
|
| 26 | * @param string $subscription_key |
|
| 27 | * @param string $order_id |
|
| 28 | */ |
|
| 29 | public function __construct(VippsInterface $vipps, $subscription_key, $order_id) |
|
| 30 | { |
|
| 31 | parent::__construct($vipps, $subscription_key); |
|
| 32 | $this->id = $order_id; |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| 36 | * @return \zaporylie\Vipps\Model\Payment\ResponseGetOrderStatus |
|
| 37 | */ |
|
| 38 | public function call() |
|
| 39 | { |
|
| 40 | $response = $this->makeCall(); |
|
| 41 | $body = $response->getBody()->getContents(); |
|
| 42 | /** @var \zaporylie\Vipps\Model\Payment\ResponseGetOrderStatus $responseObject */ |
|
| 43 | $responseObject = $this |
|
| 44 | ->getSerializer() |
|
| 45 | ->deserialize( |
|
| 46 | $body, |
|
| 47 | ResponseGetOrderStatus::class, |
|
| 48 | 'json' |
|
| 49 | ); |
|
| 50 | ||
| 51 | return $responseObject; |
|
| 52 | } |
|
| 53 | } |
|
| 54 | ||
| @@ 9-53 (lines=45) @@ | ||
| 6 | use zaporylie\Vipps\Resource\HttpMethod; |
|
| 7 | use zaporylie\Vipps\VippsInterface; |
|
| 8 | ||
| 9 | class GetPaymentDetails extends PaymentResourceBase |
|
| 10 | { |
|
| 11 | ||
| 12 | /** |
|
| 13 | * @var \zaporylie\Vipps\Resource\HttpMethod |
|
| 14 | */ |
|
| 15 | protected $method = HttpMethod::GET; |
|
| 16 | ||
| 17 | /** |
|
| 18 | * @var string |
|
| 19 | */ |
|
| 20 | protected $path = '/ecomm/v2/payments/{id}/details'; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * InitiatePayment constructor. |
|
| 24 | * |
|
| 25 | * @param \zaporylie\Vipps\VippsInterface $vipps |
|
| 26 | * @param string $subscription_key |
|
| 27 | * @param string $order_id |
|
| 28 | */ |
|
| 29 | public function __construct(VippsInterface $vipps, $subscription_key, $order_id) |
|
| 30 | { |
|
| 31 | parent::__construct($vipps, $subscription_key); |
|
| 32 | $this->id = $order_id; |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| 36 | * @return \zaporylie\Vipps\Model\Payment\ResponseGetPaymentDetails |
|
| 37 | */ |
|
| 38 | public function call() |
|
| 39 | { |
|
| 40 | $response = $this->makeCall(); |
|
| 41 | $body = $response->getBody()->getContents(); |
|
| 42 | /** @var \zaporylie\Vipps\Model\Payment\ResponseGetPaymentDetails $responseObject */ |
|
| 43 | $responseObject = $this |
|
| 44 | ->getSerializer() |
|
| 45 | ->deserialize( |
|
| 46 | $body, |
|
| 47 | ResponseGetPaymentDetails::class, |
|
| 48 | 'json' |
|
| 49 | ); |
|
| 50 | ||
| 51 | return $responseObject; |
|
| 52 | } |
|
| 53 | } |
|
| 54 | ||
| @@ 15-64 (lines=50) @@ | ||
| 12 | * |
|
| 13 | * @package Vipps\Resource\Payment |
|
| 14 | */ |
|
| 15 | class InitiatePayment extends PaymentResourceBase |
|
| 16 | { |
|
| 17 | ||
| 18 | /** |
|
| 19 | * @var \zaporylie\Vipps\Resource\HttpMethod |
|
| 20 | */ |
|
| 21 | protected $method = HttpMethod::POST; |
|
| 22 | ||
| 23 | /** |
|
| 24 | * @var string |
|
| 25 | */ |
|
| 26 | protected $path = '/ecomm/v2/payments'; |
|
| 27 | ||
| 28 | /** |
|
| 29 | * InitiatePayment constructor. |
|
| 30 | * |
|
| 31 | * @param \zaporylie\Vipps\VippsInterface $vipps |
|
| 32 | * @param string $subscription_key |
|
| 33 | * @param \zaporylie\Vipps\Model\Payment\RequestInitiatePayment $requestObject |
|
| 34 | */ |
|
| 35 | public function __construct(VippsInterface $vipps, $subscription_key, RequestInitiatePayment $requestObject) |
|
| 36 | { |
|
| 37 | parent::__construct($vipps, $subscription_key); |
|
| 38 | $this->body = $this |
|
| 39 | ->getSerializer() |
|
| 40 | ->serialize( |
|
| 41 | $requestObject, |
|
| 42 | 'json' |
|
| 43 | ); |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * @return \zaporylie\Vipps\Model\Payment\ResponseInitiatePayment |
|
| 48 | */ |
|
| 49 | public function call() |
|
| 50 | { |
|
| 51 | $response = $this->makeCall(); |
|
| 52 | $body = $response->getBody()->getContents(); |
|
| 53 | /** @var \zaporylie\Vipps\Model\Payment\ResponseInitiatePayment $responseObject */ |
|
| 54 | $responseObject = $this |
|
| 55 | ->getSerializer() |
|
| 56 | ->deserialize( |
|
| 57 | $body, |
|
| 58 | ResponseInitiatePayment::class, |
|
| 59 | 'json' |
|
| 60 | ); |
|
| 61 | ||
| 62 | return $responseObject; |
|
| 63 | } |
|
| 64 | } |
|
| 65 | ||