@@ -97,7 +97,39 @@ public function getCryptData()
9797 $ data = $ this ->getTokenData ($ data );
9898 }
9999
100- // TODO: lots more fields in here.
100+ // Some parameers specific to Sage Pay Form..
101+
102+ if ($ this ->getCustomerName () !== null ) {
103+ $ data ['CustomerName ' ] = $ this ->getCustomerName ();
104+ }
105+
106+ if ($ this ->getVendorEmail () !== null ) {
107+ $ data ['VendorEmail ' ] = $ this ->getVendorEmail ();
108+ }
109+
110+ if ($ this ->getEmailMessage () !== null ) {
111+ $ data ['EmailMessage ' ] = $ this ->getEmailMessage ();
112+ }
113+
114+ if ($ this ->getAllowGiftAid () !== null ) {
115+ $ data ['AllowGiftAid ' ] = (bool )$ this ->getAllowGiftAid ()
116+ ? static ::ALLOW_GIFT_AID_YES : static ::ALLOW_GIFT_AID_NO ;
117+ }
118+
119+ if ($ this ->getWebsite () !== null ) {
120+ $ data ['Website ' ] = $ this ->getWebsite ();
121+ }
122+
123+ if ($ sendEmail = $ this ->getSendEmail () !== null ) {
124+ if ($ sendEmail != static ::SEND_EMAIL_NONE
125+ && $ sendEmail != static ::SEND_EMAIL_BOTH
126+ && $ sendEmail != static ::SEND_EMAIL_VENDOR
127+ ) {
128+ $ sendEmail = static ::SEND_EMAIL_BOTH ;
129+ }
130+
131+ $ data ['SendEmail ' ] = $ this ->getSendEmail ();
132+ }
101133
102134 // TxType: only PAYMENT, DEFERRED or AUTHENTICATE
103135
@@ -125,6 +157,8 @@ public function getCryptData()
125157
126158 // Two conditional checks on the "state" fields.
127159 // We don't check if it is a valid two-character state code.
160+ // Maybe this can be moved to the construction of the addresses
161+ // in AbstractRequest.
128162
129163 if ($ data ['BillingCountry ' ] === 'US ' && empty ($ data ['BillingState ' ])
130164 || $ data ['DeliveryCountry ' ] === 'US ' && empty ($ data ['DeliveryState ' ])
@@ -218,4 +252,91 @@ public function getFailureUrl()
218252 {
219253 return $ this ->getParameter ('failureUrl ' );
220254 }
255+
256+ /**
257+ * @param string|null $value Customer's name will be included in the confirmation emails
258+ * @return $this
259+ */
260+ public function setCustomerName ($ value )
261+ {
262+ return $ this ->setParameter ('customerName ' , $ value );
263+ }
264+
265+ /**
266+ * @return string|null
267+ */
268+ public function getCustomerName ()
269+ {
270+ return $ this ->getParameter ('customerName ' );
271+ }
272+
273+ /**
274+ * @param string|null $value An email will be sent to this address when each transaction completes
275+ * @return $this
276+ */
277+ public function setVendorEmail ($ value )
278+ {
279+ return $ this ->setParameter ('vendorEmail ' , $ value );
280+ }
281+
282+ /**
283+ * @return string|null
284+ */
285+ public function getVendorEmail ()
286+ {
287+ return $ this ->getParameter ('vendorEmail ' );
288+ }
289+
290+ /**
291+ * @param string|null $value 0, 1, or 2, see
292+ * @return $this
293+ */
294+ public function setSendEmail ($ value )
295+ {
296+ return $ this ->setParameter ('sendEmail ' , $ value );
297+ }
298+
299+ /**
300+ * @return string|null
301+ */
302+ public function getSendEmail ()
303+ {
304+ return $ this ->getParameter ('sendEmail ' );
305+ }
306+
307+ /**
308+ * This message can be formatted using HTML, up to 1000 bytes.
309+ *
310+ * @param string|null $value A message to the customer, inserted into successful emails
311+ * @return $this
312+ */
313+ public function setEmailMessage ($ value )
314+ {
315+ return $ this ->setParameter ('EmailMessage ' , $ value );
316+ }
317+
318+ /**
319+ * @return string|null
320+ */
321+ public function getEmailMessage ()
322+ {
323+ return $ this ->getParameter ('EmailMessage ' );
324+ }
325+
326+ /**
327+ * @param string|null $value
328+ * @return $this
329+ */
330+ public function setWebsite ($ value )
331+ {
332+ return $ this ->setParameter ('website ' , $ value );
333+ }
334+
335+ /**
336+ * @return string|null
337+ */
338+ public function getWebsite ()
339+ {
340+ return $ this ->getParameter ('website ' );
341+ }
221342}
0 commit comments