1 <?php
2
3 namespace PayPal\Api;
4
5 use PayPal\Common\PayPalResourceModel;
6 use PayPal\Rest\ApiContext;
7 use PayPal\Validation\ArgumentValidator;
8
9 /**
10 * Class PaymentInstruction
11 *
12 * Contain details of how and when the payment should be made to PayPal in cases of manual bank transfer.
13 *
14 * @package PayPal\Api
15 *
16 * @property string reference_number
17 * @property string instruction_type
18 * @property \PayPal\Api\RecipientBankingInstruction recipient_banking_instruction
19 * @property \PayPal\Api\Currency amount
20 * @property string payment_due_date
21 * @property string note
22 * @property \PayPal\Api\Links[] links
23 */
24 class PaymentInstruction extends PayPalResourceModel
25 {
26 /**
27 * ID of payment instruction
28 *
29 * @param string $reference_number
30 *
31 * @return $this
32 */
33 public function setReferenceNumber($reference_number)
34 {
35 $this->reference_number = $reference_number;
36 return $this;
37 }
38
39 /**
40 * ID of payment instruction
41 *
42 * @return string
43 */
44 public function getReferenceNumber()
45 {
46 return $this->reference_number;
47 }
48
49 /**
50 * Type of payment instruction
51 * Valid Values: ["MANUAL_BANK_TRANSFER", "PAY_UPON_INVOICE"]
52 *
53 * @param string $instruction_type
54 *
55 * @return $this
56 */
57 public function setInstructionType($instruction_type)
58 {
59 $this->instruction_type = $instruction_type;
60 return $this;
61 }
62
63 /**
64 * Type of payment instruction
65 *
66 * @return string
67 */
68 public function getInstructionType()
69 {
70 return $this->instruction_type;
71 }
72
73 /**
74 * Recipient bank Details.
75 *
76 * @param \PayPal\Api\RecipientBankingInstruction $recipient_banking_instruction
77 *
78 * @return $this
79 */
80 public function setRecipientBankingInstruction($recipient_banking_instruction)
81 {
82 $this->recipient_banking_instruction = $recipient_banking_instruction;
83 return $this;
84 }
85
86 /**
87 * Recipient bank Details.
88 *
89 * @return \PayPal\Api\RecipientBankingInstruction
90 */
91 public function getRecipientBankingInstruction()
92 {
93 return $this->recipient_banking_instruction;
94 }
95
96 /**
97 * Amount to be transferred
98 *
99 * @param \PayPal\Api\Currency $amount
100 *
101 * @return $this
102 */
103 public function setAmount($amount)
104 {
105 $this->amount = $amount;
106 return $this;
107 }
108
109 /**
110 * Amount to be transferred
111 *
112 * @return \PayPal\Api\Currency
113 */
114 public function getAmount()
115 {
116 return $this->amount;
117 }
118
119 /**
120 * Date by which payment should be received
121 *
122 * @param string $payment_due_date
123 *
124 * @return $this
125 */
126 public function setPaymentDueDate($payment_due_date)
127 {
128 $this->payment_due_date = $payment_due_date;
129 return $this;
130 }
131
132 /**
133 * Date by which payment should be received
134 *
135 * @return string
136 */
137 public function getPaymentDueDate()
138 {
139 return $this->payment_due_date;
140 }
141
142 /**
143 * Additional text regarding payment handling
144 *
145 * @param string $note
146 *
147 * @return $this
148 */
149 public function setNote($note)
150 {
151 $this->note = $note;
152 return $this;
153 }
154
155 /**
156 * Additional text regarding payment handling
157 *
158 * @return string
159 */
160 public function getNote()
161 {
162 return $this->note;
163 }
164
165 /**
166 * Retrieve a payment instruction by passing the payment_id in the request URI. Use this request if you are implementing a solution that includes delayed payment like Pay Upon Invoice (PUI).
167 *
168 * @param string $paymentId
169 * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
170 * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
171 * @return PaymentInstruction
172 */
173 public static function get($paymentId, $apiContext = null, $restCall = null)
174 {
175 ArgumentValidator::validate($paymentId, 'paymentId');
176 $payLoad = "";
177 $json = self::executeCall(
178 "/v1/payments/payment/$paymentId/payment-instruction",
179 "GET",
180 $payLoad,
181 null,
182 $apiContext,
183 $restCall
184 );
185 $ret = new PaymentInstruction();
186 $ret->fromJson($json);
187 return $ret;
188 }
189
190 }
191