sadi01/yii2-post-ecommerce Electronic Commerce Service of National Iranian Post Company For Yii2 Framework

post.png

Electronic Commerce Service of National Iranian Post Company for Yii 2

  1. Installation
  2. Configuration
  3. How To Use

This extension provides the Post E-Commerce Service integration for the Yii framework 2.0.

For license information check the LICENSE-file.

Installation

The preferred way to install this extension is through composer:

composer require --prefer-dist sadi01/yii2-post-ecommerce:"*"

Configuration

To use this extension, you have to configure the PostService class in your application configuration:

return [
    //....
    'components' => [
        'PostEcommerce' => [
            'class' => 'sadi01\postecommerce\components\PostService',
            'username' => 'your username',
            'password' => 'your password',
            'secretKey' => 'your secretKey',
        ],
    ]
];

To use this extension by Rest Api version, you have to configure the PostService class in your application configuration as below:

return [
    //....
    'components' => [
        'PostEcommerce' => [
            'class' => 'sadi01\postecommerce\components\PostServiceRest',
            'oauth_client' => 'Your oauth2 client ID',
            'oauth_user' => 123 // User ID
        ],
    ]
];

How To Use

Create shop: `php use sadi01\postecommerce\components\PostService; use sadi01\postecommerce\components\Shop;

$shop = new Shop([ 'city_id' => 752, 'username' => 'test', 'name' => 'test', 'phone' => '0213410002', 'mobile' => '09379373737', 'email' => 'test@test.test', 'postal_code' => '7612458965', 'website_url' => 'https://test.test', 'manager_name' => 'test', 'manager_family' => 'test', 'manager_birth_date' => '1368/01/01', 'manager_national_id' => '2982561020', 'manager_national_id_serial' => '12G526713', 'start_date' => '1401/03/16', 'end_date' => '1402/03/16', 'need_to_collect' => 1, ]);

/* @var $postService PostService / $postService = Yii::$app->PostEcommerce; $postService->createShop($shop); `

Create barcode: `php use sadi01\postecommerce\components\PostService; use sadi01\postecommerce\components\Shop;

$price = new Price([

'shop_id' => 565656,
'weight' => 1000,
'service_type' => 1,
'destination_city_id' => 1,
'value' => 2000000,
'payment_type' => 88,
'non_standard_package' => 0,
'sms_service' => 0,

]); $packet = new Packet([

'price' => $price,
'order_id' => '1234',
'customer_nid' => '1233456789',
'customer_name' => 'test',
'customer_family' => 'test',
'customer_mobile' => '09379373737',
'customer_email' => 'test@test.test',
'customer_postal_code' => '7894561230',
'customer_address' => 'test',
'content' => 'test',

]);

/* @var $postService PostService / $postService = Yii::$app->PostEcommerce; $postService->createPacket($packet); `

Tracking barcode: `php use sadi01\postecommerce\components\PostService;

/* @var $postService PostService / $postService = Yii::$app->PostEcommerce; $postService->barcodeInfo("683690107800039750895121"); `

0 0
1 follower
102 downloads
Yii Version: 2.0
License: BSD-3-Clause
Category: Others
Tags:
Developed by: Sadegh Shafii
Created on: Jun 8, 2022
Last updated: (not set)
Packagist Profile
Github Repository