1: <?php
2:
3: /**
4: * A payment method object (this gives displayable information about a payment method used for a payment)
5: */
6: class Syspay_Merchant_Entity_PaymentMethod extends Syspay_Merchant_Entity implements
7: Syspay_Merchant_Entity_ReturnedEntityInterface
8: {
9: const TYPE = 'payment_method';
10:
11: const TYPE_CREDITCARD = 'CREDITCARD';
12: const TYPE_PAYSAFECARD = 'PAYSAFECARD';
13: const TYPE_CLICKANDBUY = 'CLICKANDBUY';
14: const TYPE_POSTFINANCE = 'POSTFINANCE';
15: const TYPE_IDEAL = 'IDEAL';
16:
17: /**
18: * @var string
19: */
20: private $type;
21:
22: /**
23: * @var string
24: */
25: private $display;
26:
27: /**
28: * Build a paymentMethod entity based on a json-decoded payment_method stdClass
29: *
30: * @param stdClass $response The payment method data
31: * @return Syspay_Merchant_Entity_PaymentMethod The payment method object
32: */
33: public static function buildFromResponse(stdClass $response)
34: {
35: $paymentMethod = new self();
36: $paymentMethod->setType(isset($response->type)?$response->type:null);
37: $paymentMethod->setDisplay(isset($response->display)?$response->display:null);
38:
39: $paymentMethod->raw = $response;
40:
41: return $paymentMethod;
42: }
43:
44: /**
45: * Gets the value of type.
46: *
47: * @return string
48: */
49: public function getType()
50: {
51: return $this->type;
52: }
53:
54: /**
55: * Sets the value of type.
56: *
57: * @param string $type the type
58: *
59: * @return self
60: */
61: public function setType($type)
62: {
63: $this->type = $type;
64:
65: return $this;
66: }
67:
68: /**
69: * Gets the value of display.
70: *
71: * @return string
72: */
73: public function getDisplay()
74: {
75: return $this->display;
76: }
77:
78: /**
79: * Sets the value of display.
80: *
81: * @param string $display the display
82: *
83: * @return self
84: */
85: public function setDisplay($display)
86: {
87: $this->display = $display;
88:
89: return $this;
90: }
91: }
92: