Mellat-Payment Yii Extension
Mellat-Payment is a Online Payment Component used for online shoping or donate.
Requirements ¶
requirements of using this extension (e.g. Yii 1.1 or above)...
Installation ¶
- Extract the release file under protected/extensions
- After place this code within your configuration file (main.php) inside the 'components' section
'Payment' => array(
'class'=> 'ext.RezvanPayment.RezvanPayment',
'terminalId' => 'portal_terminal_number',
'userName' => 'portal_username',
'userPassword' => 'portal_password',
),
Usage ¶
See the following code example:
On your controller action:
$order_Id = rand(); // This variables must be uniquely
$result = Yii::app()->Payment->PayRequest( 'your_amount', $order_Id, 'callback_page');
if(!is_array($result)){
/*
* Save Result And Redirect to bank
* if set return variable in component you can directly redirect to bank site
*/
$this->render('_redirect',array('ReferenceId'=>$result));
}
And redirect page: ~~~ [html]
function postRefId (refIdValue) {
var form = document.createElement("form");
form.setAttribute("method", "POST");
form.setAttribute("action", "https://bpm.shaparak.ir/pgwchannel/startpay.mellat");
form.setAttribute("target", "_self");
var hiddenField = document.createElement("input");
hiddenField.setAttribute("name", "RefId");
hiddenField.setAttribute("value", refIdValue);
form.appendChild(hiddenField);
document.body.appendChild(form);
form.submit();
document.body.removeChild(form);
}
postRefId('<?php echo $ReferenceId; ?>');
~~~
Users are directed to the website of the bank for payment. After payment by user, bank returns the user to the previously announced CallBack Address. return address, which is an action in the controller.
In this action you can with parameters that come from the bank, send verifying deposit to bank.
CallBack action:
$model=$this->loadModelByReference($_POST['RefId']);
if($_POST['ResCode'] == 0){
$result = Yii::app()->Payment->VerifyRequest( $model->orderId, $_POST['SaleOrderId'], $_POST['SaleReferenceId']);
}
if($result != NULL){
$RecourceCode = (!is_array($result) ? $result : $result[0]);
}
else
$RecourceCode = $_POST['ResCode'];
$model->resCode=($model->resCode == NULL ? $RecourceCode : $model->resCode);
$model->saleReferenceId=$_POST['SaleReferenceId'];
$model->save();
$this->render('_notif',array(
'model'=>$model,
));
And other function:
- Settle Request:
Using this method, the operation will be paid, in fact, the final method of payment operations Is used. Bank transactions approved by this method, the contract will be credited to the recipient's account. The return value of "0" means receiving a payment request is successful.
# **Settle Request:**
Yii::app()->Payment->SettleRequest( $order_Id, $SaleOrderId, $SaleReferenceId);
- Inquiry Request:
This method is applicable when the recipient for any reason, the result is returned VerifyRequest not know at the time of transaction. The uncertain status confirming the purchase, by this method of inquiry is. After calling this method, the payment transaction will be clear to the recipient.
# **Inquiry Request:**
Yii::app()->Payment->InquiryRequest( $order_Id, $SaleOrderId, $SaleReferenceId);
Resources ¶
Donate ¶
Want to say thanks for the time and efforts put on this project?
Donate
Thank you!
سلام میشه بیشتر توضیح بدین.ممنون
اللحساب:
شناسه پرداخت : 865110635
Complete description
Hi Morteza, thank you for Donation.
More complete description is provided in the text above.
This component gives you the ability to use it, you can manage user pay practices.
Thank you for answer
.سلام،من هنوز پروژه فروشگاه رو کلید نزدم
.می خواستم بدونم این اکستنشن کی آماده می شه و چه جوری می تونم دانلودش کنم
مطمئنن ارزش کار شما از نظر ما دور نیست ودر اسرع وقت کمک مالی برابر با کار شما برای شما ارسال خواهد شد
با تشکر
Is ready
Extension is now available!
Hello everybody
Who knows how can i download the script?
Actually i didn't see any link to download.
Anyway, I should say many thanks from Mr.Amini for sharing his experience.
Inserted download link.
Hi dear friends,
To celebrate the birth of Hazrat Fatemeh Zahra, inserted download link.
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.