Download the PHP package advancelearn/manage-payment-and-orders without Composer
On this page you can find all versions of the php package advancelearn/manage-payment-and-orders. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download advancelearn/manage-payment-and-orders
More information about advancelearn/manage-payment-and-orders
Files in advancelearn/manage-payment-and-orders
Package manage-payment-and-orders
Short Description Orders and payments management system in Laravel and the feature of adding sales functionality for each model
License MIT
Informations about the package manage-payment-and-orders
Advancelearn manage-payment-order
- English documents
- داکیومنت فارسی
Introduction
This package was developed in collaboration with a Sadratech team member and AdvanceLearn. This package aims to create and manage various aspects related to user orders and payments. It includes tracking the number of products and tagging all steps of the user's purchase order." This package is currently under active development and there are plans to add a shopping voucher module in the future, pending support and feasibility.
By installing this package and during the next steps, tables of address, country, province, city, order items, order registration steps, order shipping cost, inventory and price, orders, payments will be created for you. And with the help of seder, you value some tables and you can easily have the country of Iran along with its provinces and cities in your database.
Installation
You can install the package with Composer.
Config
After installation, please add its provider to your config folder in the app file to complete and configure the package:
Then run this command to import and make the package tables public
Select the row number of this title from among the tags and enter it
By entering the tag number of the image above, these tables will be added to the tables folder of your program
Then enter the following command to add tables in your database
Now you need to follow these steps to initialize Audits in the program
Select the row number of this title from among the tags and enter it
Enter the commands in order according to the picture
Adding the value for the table of order stages in the database until we can use the ID of these records when updating according to each stage of the order we wanted.
Important
In the next step, you have to set the values of these three tables for your user and your product (the user's address, the amount of the model that will be known as the product, and the amount of costs due to the type of shipment)
this table adm_addresses
example:
this table _adm_inventories
_ example:
this table adm_shippings
example:
Create new Order By User Request
"In the initial step, it's important to note that we aim to store a user's order within the system. To achieve this, we need to send the required parameters to the 'store' method of the order service package. Upon successful validation of these parameters, we will receive a response containing the order details."
We receive and send the requested parameters from the user:
$shippingId , $addressId , $description , $items
__!!Pay attention to the type of parameters that they should be__
add this method for Relationship in your model with Inventory
After add RelationShip:
"After integrating your model with the inventory model, it is essential to implement this contract within your model. This allows you to execute various actions, such as sending emails or updating your model, during the successful payment phase. Additionally, you can seamlessly update the Inventory associated with the sold record in your model."
"Now you have created a new order in the order creation phase, so to redirect the user to the payment gateway, you need to send this order id to this method, you can check whether the order amount has already been paid or not. In case of non-payment, you can redirect the user to the payment gateway."
write this namespace in your class:
And finally, send the final order amount to send to the portal:
And in the same method that the user was sent to the payment portal, you can create a payment for the user with a pending status:
And for example, in your callback method that returns from the portal, let's assume that your callback method is called paymentConfirmation.
create call method verifyPayAndConfirm:: write this namespace in your class:
Payment status
You can monitor the status of orders that have been prepared by checking each step where the new status should be documented. You can add a record related to the current stage of the order and you can reference the stage IDs from the adm_audits table.
You can call this method to get all the information about your orders
Use this method to display individual information of an order
Pay attention to the type of parameters
You can use this method to update an order
You can create a new record in the adm_shippings table for the types of shipping steps and prices that must be calculated for shipping, and send its ID for calculation in the store or update method. Pay attention to this example.
Important
Remember that the address ID you enter for updating must be related to the user who made the purchase
, because we reach the user from the address in the codes.
You can use this method to cancel the order By User
You can use this method to cancel the order By Admin
You can display the list of orders and payments to the admin and to the user who is logged in with the help of these methods and passing the required parameters.
get Orders List Or SingleOrder
get Payments List Or SinglePayment
keep in mind
"When a user utilizes your User model and you have defined Address relationships for this user, upon creating a new user account in the system, with the assistance of AdmUserObserve in your package, a digital address is generated for the user within the system. In this manner, if the user intends to purchase non-physical products for which shipping costs are irrelevant, we create a digital delivery address in the system for them."
Conclusion
By utilizing this package, there is no need to create separate models for the order and payment processes. Moreover, it allows for the presentation of user information history and the management of these records. For instance, you can perform actions like updating the order status to various types and sections, organizing the order stages (e.g., sending the products, order cancellation, final registration, readiness for shipment), and more—all within a unified framework.