@@ -101,7 +101,7 @@ protected function syncBanks($banks)
101101 }
102102 }
103103
104- public function initiatePayment ($ amount , $ customerName , $ bankType , $ bankId , $ referenceId , $ coordinate , $ ipAddress )
104+ public function initiatePayment ($ amount , $ customerName , $ bankType , $ bankId , $ recipientReference , $ coordinate , $ ipAddress, $ paymentDescription = null , $ referenceId = null , $ referenceType = null )
105105 {
106106 $ this ->coordinate = $ coordinate ;
107107 $ this ->ipAddress = $ ipAddress ;
@@ -132,8 +132,8 @@ public function initiatePayment($amount, $customerName, $bankType, $bankId, $ref
132132 'accountType ' => config ('duitnow.account_type ' ),
133133 ],
134134 'sourceOfFunds ' => config ('duitnow.source_of_funds ' ),
135- 'recipientReference ' => $ referenceId ,
136- 'paymentDescription ' => $ referenceId ,
135+ 'recipientReference ' => $ recipientReference ,
136+ 'paymentDescription ' => $ paymentDescription ?? $ recipientReference ,
137137 ];
138138
139139 $ url = config ('duitnow.url.base ' ) . '/merchants/v1/payments/redirect ' ;
@@ -149,7 +149,7 @@ public function initiatePayment($amount, $customerName, $bankType, $bankId, $ref
149149 'Content-Type ' => 'application/json ' ,
150150 ])->post ($ url , $ body );
151151
152- $ this ->saveTransaction ($ this ->transactionId , $ referenceId , $ body , $ this ->messageId );
152+ $ this ->saveTransaction ($ this ->transactionId , $ referenceId , $ referenceType , $ body , $ this ->messageId );
153153
154154 if ($ response ->status () == 200 ) {
155155 $ redirectUrl = $ this ->getUrl ($ bankId , $ bankType , $ this ->messageId , $ response ->object ()->endToEndIdSignature );
@@ -181,11 +181,12 @@ protected function getUrl($bankId, $bankType, $messageId, $endToEndIdSignature)
181181 );
182182 }
183183
184- protected function saveTransaction ($ transactionId , $ referenceId , $ requestPayload , $ endToEndId ): DuitNowTransaction
184+ protected function saveTransaction ($ transactionId , $ referenceId , $ referenceType , $ requestPayload , $ endToEndId ): DuitNowTransaction
185185 {
186186 return DuitNowTransaction::create ([
187187 'transaction_id ' => $ transactionId ,
188188 'reference_id ' => $ referenceId ,
189+ 'reference_type ' => $ referenceType ,
189190 'request_payload ' => $ requestPayload ,
190191 'end_to_end_id ' => $ endToEndId ,
191192 ]);
0 commit comments