@@ -67,6 +67,49 @@ protected function generateForm(): string
6767 ));
6868 }
6969
70+ /**
71+ * @return array
72+ * @throws Exception
73+ */
74+ public function formParams (): array
75+ {
76+ $ this ->checkRequiredParameters ([
77+ 'amount ' ,
78+ 'order_id ' ,
79+ 'redirect_url '
80+ ]);
81+
82+ $ processor = new RSAProcessor (config ('larapay.pasargad.certificate_path ' ), RSAKeyType::XMLFile);
83+
84+ $ url = $ this ->getEndPoint ();
85+ $ redirectUrl = $ this ->redirect_url ;
86+ $ invoiceNumber = $ this ->order_id ;
87+ $ amount = $ this ->amount ;
88+ $ terminalCode = config ('larapay.pasargad.terminalId ' );
89+ $ merchantCode = config ('larapay.pasargad.merchantId ' );
90+ $ timeStamp = date ("Y/m/d H:i:s " );
91+ $ invoiceDate = date ("Y/m/d H:i:s " );
92+ $ action = 1003 ; // sell code
93+
94+ $ data = "# " . $ merchantCode . "# " . $ terminalCode . "# " . $ invoiceNumber . "# " . $ invoiceDate . "# " . $ amount . "# " . $ redirectUrl . "# " . $ action . "# " . $ timeStamp . "# " ;
95+ $ data = sha1 ($ data , true );
96+ $ data = $ processor ->sign ($ data ); // امضاي ديجيتال
97+ $ sign = base64_encode ($ data ); // base64_encode
98+
99+ return [
100+ 'url ' => $ url ,
101+ 'redirectUrl ' => $ redirectUrl ,
102+ 'invoiceNumber ' => $ invoiceNumber ,
103+ 'invoiceDate ' => $ invoiceDate ,
104+ 'amount ' => $ amount ,
105+ 'terminalCode ' => $ terminalCode ,
106+ 'merchantCode ' => $ merchantCode ,
107+ 'timeStamp ' => $ timeStamp ,
108+ 'action ' => $ action ,
109+ 'sign ' => $ sign ,
110+ ];
111+ }
112+
70113// public function inquiryTransaction ()
71114// {
72115//
0 commit comments