@@ -47,7 +47,84 @@ public function getMerchantReference()
4747 return $ this ->getParameter ('merchantReference ' );
4848 }
4949
50- // Store Card Options
50+ public function setType ($ value )
51+ {
52+ return $ this ->setParameter ('type ' , $ value );
53+ }
54+
55+ public function getType ()
56+ {
57+ return $ this ->getParameter ('type ' ) ?? 'purchase ' ;
58+ }
59+
60+ public function setLanguage ($ value )
61+ {
62+ return $ this ->setParameter ('language ' , $ value );
63+ }
64+
65+ public function getLanguage ()
66+ {
67+ return $ this ->getParameter ('language ' ) ?? 'en ' ;
68+ }
69+
70+ /**
71+ * @param $list
72+ * Possible methods: ['card', 'account2account', 'alipay', 'applepay', 'googlepay', 'paypal', 'interac', 'unionpay', 'oxipay', 'visacheckout', 'wechat']
73+ *
74+ * @return PurchaseRequest
75+ */
76+ public function setPaymentMethods ($ list )
77+ {
78+ $ options = [
79+ 'card ' , 'account2account ' , 'alipay ' , 'applepay ' ,
80+ 'googlepay ' , 'paypal ' , 'interac ' , 'unionpay ' ,
81+ 'oxipay ' , 'visacheckout ' , 'wechat '
82+ ];
83+
84+ foreach ( $ list as $ method ) {
85+ if ( !in_array ($ method , $ options ) ) {
86+ throw new InvalidRequestException ("Unknown payment method: {$ method }" );
87+ }
88+ }
89+
90+ return $ this ->setParameter ('paymentMethods ' , $ list );
91+ }
92+
93+ public function getPaymentMethods ()
94+ {
95+ return $ this ->getParameter ('paymentMethods ' );
96+ }
97+
98+ public function setCardTypes ($ list )
99+ {
100+ return $ this ->setParameter ('cardTypes ' , $ list );
101+ }
102+
103+ public function getCardTypes ()
104+ {
105+ return $ this ->getParameter ('cardTypes ' );
106+ }
107+
108+ public function setExpiresAt ($ value )
109+ {
110+ return $ this ->setParameter ('expiresAt ' , $ value );
111+ }
112+
113+ public function getExpiresAt ()
114+ {
115+ return $ this ->getParameter ('expiresAt ' );
116+ }
117+
118+ public function setDeclineUrl ($ url )
119+ {
120+ return $ this ->setParameter ('declineUrl ' , $ url );
121+ }
122+
123+ public function getDeclineUrl ()
124+ {
125+ return $ this ->getParameter ('declineUrl ' );
126+ }
127+
51128 public function setStoreCard ($ value )
52129 {
53130 return $ this ->setParameter ('storeCard ' , $ value );
@@ -63,23 +140,22 @@ public function setStoredCardIndicator($value)
63140 $ options = [
64141 'single ' , 'recurringfixed ' , 'recurringvariable ' , 'installment ' ,
65142 'recurringnoexpiry ' , 'recurringinitial ' , 'installmentinitial ' , 'credentialonfileinitial ' ,
66- 'unscheduledcredentialonfileinitial ' , 'credentialonfile ' , 'unscheduledcredentialonfile ' ,
67- 'incremental ' , ' resubmission ' , 'reauthorisation ' , 'delayedcharges ' , 'noshow '
143+ 'unscheduledcredentialonfileinitial ' , 'credentialonfile ' , 'unscheduledcredentialonfile ' , ' incremental ' ,
144+ 'resubmission ' , 'reauthorisation ' , 'delayedcharges ' , 'noshow '
68145 ];
69146
70- if (! in_array ($ value , $ options )) {
147+ if ( ! in_array ($ value , $ options ) ) {
71148 throw new InvalidRequestException ("Invalid option ' {$ value }' set for StoredCardIndicator. " );
72149 }
73150
74- return $ this ->setParameter ('storeCardIndicator ' , $ value );
151+ return $ this ->setParameter ('storedCardIndicator ' , $ value );
75152 }
76153
77154 public function getStoredCardIndicator ()
78155 {
79- return $ this ->getParameter ('storeCardIndicator ' );
156+ return $ this ->getParameter ('storedCardIndicator ' );
80157 }
81158
82- // Metadata
83159 public function setMetadata ($ data )
84160 {
85161 return $ this ->setParameter ('metaData ' , $ data );
@@ -90,7 +166,7 @@ public function getMetadata()
90166 return $ this ->getParameter ('metaData ' );
91167 }
92168
93- // Recurring Frequency
169+
94170 public function setRecurringFrequency ($ value )
95171 {
96172 $ options = [
@@ -100,7 +176,7 @@ public function setRecurringFrequency($value)
100176 'twomonthly ' , 'threemonthly ' , 'fourmonthly ' , 'sixmonthly ' , 'annually '
101177 ];
102178
103- if (! in_array ($ value , $ options )) {
179+ if ( ! in_array ($ value , $ options ) ) {
104180 throw new InvalidRequestException ("Invalid option ' {$ value }' set for RecurringFrequency. " );
105181 }
106182
@@ -112,6 +188,19 @@ public function getRecurringFrequency()
112188 return $ this ->getParameter ('recurringFrequency ' );
113189 }
114190
191+ public function setRecurringExpiry ($ value )
192+ {
193+ // For scenarios where no expiry/end date is established i.e.,
194+ // subscription payments, the merchant web application should use "9999-12-31" as the value.
195+
196+ return $ this ->setParameter ('recurringExpiry ' , $ value );
197+ }
198+
199+ public function getRecurringExpiry ()
200+ {
201+ return $ this ->getParameter ('recurringExpiry ' );
202+ }
203+
115204 // Endpoint selection based on test mode
116205 protected function getEndpoint ($ path = '' )
117206 {
0 commit comments