1 <?php
2
3 namespace PayPal\Api;
4
5 use PayPal\Common\PayPalModel;
6 use PayPal\Validation\UrlValidator;
7
8 /**
9 * Class MerchantPreferences
10 *
11 * Resource representing merchant preferences like max failed attempts, set up fee and others for a plan.
12 *
13 * @package PayPal\Api
14 *
15 * @property string id
16 * @property \PayPal\Api\Currency setup_fee
17 * @property string cancel_url
18 * @property string return_url
19 * @property string notify_url
20 * @property string max_fail_attempts
21 * @property string auto_bill_amount
22 * @property string initial_fail_amount_action
23 * @property string accepted_payment_type
24 * @property string char_set
25 */
26 class MerchantPreferences extends PayPalModel
27 {
28 /**
29 * Identifier of the merchant_preferences. 128 characters max.
30 *
31 * @param string $id
32 *
33 * @return $this
34 */
35 public function setId($id)
36 {
37 $this->id = $id;
38 return $this;
39 }
40
41 /**
42 * Identifier of the merchant_preferences. 128 characters max.
43 *
44 * @return string
45 */
46 public function getId()
47 {
48 return $this->id;
49 }
50
51 /**
52 * Setup fee amount. Default is 0.
53 *
54 * @param \PayPal\Api\Currency $setup_fee
55 *
56 * @return $this
57 */
58 public function setSetupFee($setup_fee)
59 {
60 $this->setup_fee = $setup_fee;
61 return $this;
62 }
63
64 /**
65 * Setup fee amount. Default is 0.
66 *
67 * @return \PayPal\Api\Currency
68 */
69 public function getSetupFee()
70 {
71 return $this->setup_fee;
72 }
73
74 /**
75 * Redirect URL on cancellation of agreement request. 1000 characters max.
76 *
77 * @param string $cancel_url
78 * @throws \InvalidArgumentException
79 * @return $this
80 */
81 public function setCancelUrl($cancel_url)
82 {
83 UrlValidator::validate($cancel_url, "CancelUrl");
84 $this->cancel_url = $cancel_url;
85 return $this;
86 }
87
88 /**
89 * Redirect URL on cancellation of agreement request. 1000 characters max.
90 *
91 * @return string
92 */
93 public function getCancelUrl()
94 {
95 return $this->cancel_url;
96 }
97
98 /**
99 * Redirect URL on creation of agreement request. 1000 characters max.
100 *
101 * @param string $return_url
102 * @throws \InvalidArgumentException
103 * @return $this
104 */
105 public function setReturnUrl($return_url)
106 {
107 UrlValidator::validate($return_url, "ReturnUrl");
108 $this->return_url = $return_url;
109 return $this;
110 }
111
112 /**
113 * Redirect URL on creation of agreement request. 1000 characters max.
114 *
115 * @return string
116 */
117 public function getReturnUrl()
118 {
119 return $this->return_url;
120 }
121
122 /**
123 * Notify URL on agreement creation. 1000 characters max.
124 *
125 * @param string $notify_url
126 * @throws \InvalidArgumentException
127 * @return $this
128 */
129 public function setNotifyUrl($notify_url)
130 {
131 UrlValidator::validate($notify_url, "NotifyUrl");
132 $this->notify_url = $notify_url;
133 return $this;
134 }
135
136 /**
137 * Notify URL on agreement creation. 1000 characters max.
138 *
139 * @return string
140 */
141 public function getNotifyUrl()
142 {
143 return $this->notify_url;
144 }
145
146 /**
147 * Total number of failed attempts allowed. Default is 0, representing an infinite number of failed attempts.
148 *
149 * @param string $max_fail_attempts
150 *
151 * @return $this
152 */
153 public function setMaxFailAttempts($max_fail_attempts)
154 {
155 $this->max_fail_attempts = $max_fail_attempts;
156 return $this;
157 }
158
159 /**
160 * Total number of failed attempts allowed. Default is 0, representing an infinite number of failed attempts.
161 *
162 * @return string
163 */
164 public function getMaxFailAttempts()
165 {
166 return $this->max_fail_attempts;
167 }
168
169 /**
170 * Allow auto billing for the outstanding amount of the agreement in the next cycle. Allowed values: `YES`, `NO`. Default is `NO`.
171 *
172 * @param string $auto_bill_amount
173 *
174 * @return $this
175 */
176 public function setAutoBillAmount($auto_bill_amount)
177 {
178 $this->auto_bill_amount = $auto_bill_amount;
179 return $this;
180 }
181
182 /**
183 * Allow auto billing for the outstanding amount of the agreement in the next cycle. Allowed values: `YES`, `NO`. Default is `NO`.
184 *
185 * @return string
186 */
187 public function getAutoBillAmount()
188 {
189 return $this->auto_bill_amount;
190 }
191
192 /**
193 * Action to take if a failure occurs during initial payment. Allowed values: `CONTINUE`, `CANCEL`. Default is continue.
194 *
195 * @param string $initial_fail_amount_action
196 *
197 * @return $this
198 */
199 public function setInitialFailAmountAction($initial_fail_amount_action)
200 {
201 $this->initial_fail_amount_action = $initial_fail_amount_action;
202 return $this;
203 }
204
205 /**
206 * Action to take if a failure occurs during initial payment. Allowed values: `CONTINUE`, `CANCEL`. Default is continue.
207 *
208 * @return string
209 */
210 public function getInitialFailAmountAction()
211 {
212 return $this->initial_fail_amount_action;
213 }
214
215 /**
216 * Payment types that are accepted for this plan.
217 *
218 * @param string $accepted_payment_type
219 *
220 * @return $this
221 */
222 public function setAcceptedPaymentType($accepted_payment_type)
223 {
224 $this->accepted_payment_type = $accepted_payment_type;
225 return $this;
226 }
227
228 /**
229 * Payment types that are accepted for this plan.
230 *
231 * @return string
232 */
233 public function getAcceptedPaymentType()
234 {
235 return $this->accepted_payment_type;
236 }
237
238 /**
239 * char_set for this plan.
240 *
241 * @param string $char_set
242 *
243 * @return $this
244 */
245 public function setCharSet($char_set)
246 {
247 $this->char_set = $char_set;
248 return $this;
249 }
250
251 /**
252 * char_set for this plan.
253 *
254 * @return string
255 */
256 public function getCharSet()
257 {
258 return $this->char_set;
259 }
260
261 }
262