| @@ 15-70 (lines=56) @@ | ||
| 12 | * |
|
| 13 | * @package Vipps\Resource\Payment |
|
| 14 | */ |
|
| 15 | class CancelPayment extends PaymentResourceBase |
|
| 16 | { |
|
| 17 | ||
| 18 | /** |
|
| 19 | * @var \zaporylie\Vipps\Resource\HttpMethod |
|
| 20 | */ |
|
| 21 | protected $method = HttpMethod::PUT; |
|
| 22 | ||
| 23 | /** |
|
| 24 | * @var string |
|
| 25 | */ |
|
| 26 | protected $path = '/Ecomm/v1/payments/{id}/cancel'; |
|
| 27 | ||
| 28 | /** |
|
| 29 | * InitiatePayment constructor. |
|
| 30 | * |
|
| 31 | * @param \zaporylie\Vipps\VippsInterface $vipps |
|
| 32 | * @param string $subscription_key |
|
| 33 | * @param string $order_id |
|
| 34 | * @param \zaporylie\Vipps\Model\Payment\RequestCancelPayment $requestObject |
|
| 35 | */ |
|
| 36 | public function __construct( |
|
| 37 | VippsInterface $vipps, |
|
| 38 | $subscription_key, |
|
| 39 | $order_id, |
|
| 40 | RequestCancelPayment $requestObject |
|
| 41 | ) { |
|
| 42 | parent::__construct($vipps, $subscription_key); |
|
| 43 | $this->body = $this |
|
| 44 | ->getSerializer() |
|
| 45 | ->serialize( |
|
| 46 | $requestObject, |
|
| 47 | 'json' |
|
| 48 | ); |
|
| 49 | $this->id = $order_id; |
|
| 50 | } |
|
| 51 | ||
| 52 | /** |
|
| 53 | * @return \zaporylie\Vipps\Model\Payment\ResponseCancelPayment |
|
| 54 | */ |
|
| 55 | public function call() |
|
| 56 | { |
|
| 57 | $response = $this->makeCall(); |
|
| 58 | $body = $response->getBody()->getContents(); |
|
| 59 | /** @var \zaporylie\Vipps\Model\Payment\ResponseCancelPayment $responseObject */ |
|
| 60 | $responseObject = $this |
|
| 61 | ->getSerializer() |
|
| 62 | ->deserialize( |
|
| 63 | $body, |
|
| 64 | ResponseCancelPayment::class, |
|
| 65 | 'json' |
|
| 66 | ); |
|
| 67 | ||
| 68 | return $responseObject; |
|
| 69 | } |
|
| 70 | } |
|
| 71 | ||
| @@ 15-70 (lines=56) @@ | ||
| 12 | * |
|
| 13 | * @package Vipps\Resource\Payment |
|
| 14 | */ |
|
| 15 | class CapturePayment 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/v1/payments/{id}/capture'; |
|
| 27 | ||
| 28 | /** |
|
| 29 | * InitiatePayment constructor. |
|
| 30 | * |
|
| 31 | * @param \zaporylie\Vipps\VippsInterface $vipps |
|
| 32 | * @param string $subscription_key |
|
| 33 | * @param string $order_id |
|
| 34 | * @param \zaporylie\Vipps\Model\Payment\RequestCapturePayment $requestObject |
|
| 35 | */ |
|
| 36 | public function __construct( |
|
| 37 | VippsInterface $vipps, |
|
| 38 | $subscription_key, |
|
| 39 | $order_id, |
|
| 40 | RequestCapturePayment $requestObject |
|
| 41 | ) { |
|
| 42 | parent::__construct($vipps, $subscription_key); |
|
| 43 | $this->body = $this |
|
| 44 | ->getSerializer() |
|
| 45 | ->serialize( |
|
| 46 | $requestObject, |
|
| 47 | 'json' |
|
| 48 | ); |
|
| 49 | $this->id = $order_id; |
|
| 50 | } |
|
| 51 | ||
| 52 | /** |
|
| 53 | * @return \zaporylie\Vipps\Model\Payment\ResponseCapturePayment |
|
| 54 | */ |
|
| 55 | public function call() |
|
| 56 | { |
|
| 57 | $response = $this->makeCall(); |
|
| 58 | $body = $response->getBody()->getContents(); |
|
| 59 | /** @var \zaporylie\Vipps\Model\Payment\ResponseCapturePayment $responseObject */ |
|
| 60 | $responseObject = $this |
|
| 61 | ->getSerializer() |
|
| 62 | ->deserialize( |
|
| 63 | $body, |
|
| 64 | ResponseCapturePayment::class, |
|
| 65 | 'json' |
|
| 66 | ); |
|
| 67 | ||
| 68 | return $responseObject; |
|
| 69 | } |
|
| 70 | } |
|
| 71 | ||
| @@ 9-55 (lines=47) @@ | ||
| 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/v1/payments/{id}/serialNumber/{merchantSerialNumber}/status'; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * InitiatePayment constructor. |
|
| 24 | * |
|
| 25 | * @param \zaporylie\Vipps\VippsInterface $vipps |
|
| 26 | * @param string $subscription_key |
|
| 27 | * @param string $merchant_serial_number |
|
| 28 | * @param string $order_id |
|
| 29 | */ |
|
| 30 | public function __construct(VippsInterface $vipps, $subscription_key, $merchant_serial_number, $order_id) |
|
| 31 | { |
|
| 32 | parent::__construct($vipps, $subscription_key); |
|
| 33 | $this->id = $order_id; |
|
| 34 | $this->path = str_replace('{merchantSerialNumber}', $merchant_serial_number, $this->path); |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * @return \zaporylie\Vipps\Model\Payment\ResponseGetOrderStatus |
|
| 39 | */ |
|
| 40 | public function call() |
|
| 41 | { |
|
| 42 | $response = $this->makeCall(); |
|
| 43 | $body = $response->getBody()->getContents(); |
|
| 44 | /** @var \zaporylie\Vipps\Model\Payment\ResponseGetOrderStatus $responseObject */ |
|
| 45 | $responseObject = $this |
|
| 46 | ->getSerializer() |
|
| 47 | ->deserialize( |
|
| 48 | $body, |
|
| 49 | ResponseGetOrderStatus::class, |
|
| 50 | 'json' |
|
| 51 | ); |
|
| 52 | ||
| 53 | return $responseObject; |
|
| 54 | } |
|
| 55 | } |
|
| 56 | ||
| @@ 9-55 (lines=47) @@ | ||
| 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/v1/payments/{id}/serialNumber/{merchantSerialNumber}/details'; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * InitiatePayment constructor. |
|
| 24 | * |
|
| 25 | * @param \zaporylie\Vipps\VippsInterface $vipps |
|
| 26 | * @param string $subscription_key |
|
| 27 | * @param string $merchant_serial_number |
|
| 28 | * @param string $order_id |
|
| 29 | */ |
|
| 30 | public function __construct(VippsInterface $vipps, $subscription_key, $merchant_serial_number, $order_id) |
|
| 31 | { |
|
| 32 | parent::__construct($vipps, $subscription_key); |
|
| 33 | $this->id = $order_id; |
|
| 34 | $this->path = str_replace('{merchantSerialNumber}', $merchant_serial_number, $this->path); |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * @return \zaporylie\Vipps\Model\Payment\ResponseGetPaymentDetails |
|
| 39 | */ |
|
| 40 | public function call() |
|
| 41 | { |
|
| 42 | $response = $this->makeCall(); |
|
| 43 | $body = $response->getBody()->getContents(); |
|
| 44 | /** @var \zaporylie\Vipps\Model\Payment\ResponseGetPaymentDetails $responseObject */ |
|
| 45 | $responseObject = $this |
|
| 46 | ->getSerializer() |
|
| 47 | ->deserialize( |
|
| 48 | $body, |
|
| 49 | ResponseGetPaymentDetails::class, |
|
| 50 | 'json' |
|
| 51 | ); |
|
| 52 | ||
| 53 | return $responseObject; |
|
| 54 | } |
|
| 55 | } |
|
| 56 | ||
| @@ 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/v1/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 | ||
| @@ 15-70 (lines=56) @@ | ||
| 12 | * |
|
| 13 | * @package Vipps\Resource\Payment |
|
| 14 | */ |
|
| 15 | class RefundPayment 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/v1/payments/{id}/refund'; |
|
| 27 | ||
| 28 | /** |
|
| 29 | * InitiatePayment constructor. |
|
| 30 | * |
|
| 31 | * @param \zaporylie\Vipps\VippsInterface $vipps |
|
| 32 | * @param string $subscription_key |
|
| 33 | * @param string $order_id |
|
| 34 | * @param \zaporylie\Vipps\Model\Payment\RequestRefundPayment $requestObject |
|
| 35 | */ |
|
| 36 | public function __construct( |
|
| 37 | VippsInterface $vipps, |
|
| 38 | $subscription_key, |
|
| 39 | $order_id, |
|
| 40 | RequestRefundPayment $requestObject |
|
| 41 | ) { |
|
| 42 | parent::__construct($vipps, $subscription_key); |
|
| 43 | $this->body = $this |
|
| 44 | ->getSerializer() |
|
| 45 | ->serialize( |
|
| 46 | $requestObject, |
|
| 47 | 'json' |
|
| 48 | ); |
|
| 49 | $this->id = $order_id; |
|
| 50 | } |
|
| 51 | ||
| 52 | /** |
|
| 53 | * @return \zaporylie\Vipps\Model\Payment\ResponseRefundPayment |
|
| 54 | */ |
|
| 55 | public function call() |
|
| 56 | { |
|
| 57 | $response = $this->makeCall(); |
|
| 58 | $body = $response->getBody()->getContents(); |
|
| 59 | /** @var \zaporylie\Vipps\Model\Payment\ResponseRefundPayment $responseObject */ |
|
| 60 | $responseObject = $this |
|
| 61 | ->getSerializer() |
|
| 62 | ->deserialize( |
|
| 63 | $body, |
|
| 64 | ResponseRefundPayment::class, |
|
| 65 | 'json' |
|
| 66 | ); |
|
| 67 | ||
| 68 | return $responseObject; |
|
| 69 | } |
|
| 70 | } |
|
| 71 | ||