PluginProbe
PayPlug for WooCommerce (Official) / 1.0.18
PayPlug for WooCommerce (Official) v1.0.18
3.1.0 3.0.0 2.18.0 1.0.17 1.0.18 1.0.19 1.0.20 1.0.21 1.0.22 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.1.0 1.10.0 1.10.1 1.2.1 1.2.10 1.2.11 1.2.2 1.2.3 1.2.4 1.2.5 All 102 releases
payplug / vendor / payplug / payplug-php / lib / Payplug / Resource / Card.php

Card.php in PayPlug for WooCommerce (Official) 1.0.18, at vendor/payplug/payplug-php/lib/Payplug/Resource/Card.php

62 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Payplug\Resource;
3 use Payplug;
4
5 /**
6 * A Card
7 */
8 class Card extends APIResource
9 {
10 /**
11 * The factory method that constructs the API resource.
12 *
13 * @param array $attributes the default attributes.
14 *
15 * @return Card The new resource.
16 */
17 public static function fromAttributes(array $attributes)
18 {
19 $object = new Card();
20 $object->initialize($attributes);
21 return $object;
22 }
23
24 /**
25 * Delete the card.
26 *
27 * @param Payplug\Card $card the card or card id
28 * @param Payplug\Payplug $payplug the client configuration
29 *
30 * @return Card the deleted card or null on error
31 *
32 * @throws Payplug\Exception\ConfigurationNotSetException
33 */
34 public static function deleteCard($card, Payplug\Payplug $payplug = null)
35 {
36 if ($payplug === null) {
37 $payplug = Payplug\Payplug::getDefaultConfiguration();
38 }
39
40 if ($card instanceof Card) {
41 $card = $card->id;
42 }
43
44 $httpClient = new Payplug\Core\HttpClient($payplug);
45 $response = $httpClient->delete(Payplug\Core\APIRoutes::getRoute(Payplug\Core\APIRoutes::CARD_RESOURCE, $card));
46
47 return $response;
48 }
49
50 /**
51 * Delete the card.
52 *
53 * @param Payplug\Payplug $payplug the client configuration
54 *
55 * @throws Payplug\Exception\ConfigurationNotSetException
56 */
57 public function delete(Payplug\Payplug $payplug = null)
58 {
59 self::deleteCard($this->id, $payplug);
60 }
61 }
62