2017 © Pedro Peláez
 

yii2-extension yii2-adm-oplata

Yii2: Adm Oplata

image

pavlinter/yii2-adm-oplata

Yii2: Adm Oplata

  • Friday, February 13, 2015
  • by pavlinter
  • Repository
  • 1 Watchers
  • 1 Stars
  • 37 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

https://www.oplata.com, (*1)

Установка

Удобнее всего установить это расширение через composer., (*2)

   "pavlinter/yii2-adm-oplata": "*",

Настройка

'modules' => [
    ...
    'adm' => [
        ...
        'modules' => [
            'admoplata'
        ],
        ...
    ],
    'admoplata' => [
       'class' => 'pavlinter\admoplata\Module',
       'modules' => [],
    ],
    ...
],
'components' => [
    ...
    'oplata' => [
        'class' => 'pavlinter\admoplata\components\Oplata',
        'merchantId' => 'xxxx', //own merchant id
        'password' => 'xxxx', //own password
        'invoiceLayout' => '/main';
        'layout' => '@vendor/pavlinter/yii2-adm/adm/views/layouts/main';
        'userSelect' => [
            'viewCallback' => null, //function ($row) {return Adm::t('oplata','{email}:select2 template', $row);}
            'querySearch' => null, // function ($query, $userTable, $search) {/* @var \yii\db\Query $query */return $query->from($userTable)->where(['like', 'email', $search])->limit(20)->all();}
            'queryLoad' => null, //function ($query, $userTable, $id) {/* @var \yii\db\Query $query */return $query->from($userTable)->where(['id' => $id])->one();}
        ];
        'sendFunc' => null; //function ($model, $module, $user, $username) {}
        'sendFrom' => null; // default Yii::$app->params['adminEmail']
        'mailTemplate' => '@vendor/pavlinter/yii2-adm-oplata/admoplata/views/transaction/email-template';
        'remindTemplate' => '@vendor/pavlinter/yii2-adm-oplata/admoplata/views/transaction/remind-template',
        'remindDays' => 1, //Высылать напоминание о платиже за 1 день до окончания счета /en/admoplata/transaction/cron
        'pdf' => [
            'image' => [ //logo htmlOptions
                //'src' => '',
            ],
            'imageLink' => [ //logo link htmlOptions
                //'href' => '',
            ],
        ];
    ],
    'response' => [
        'formatters' => [
            'adm-pdf' => [
                'class' => 'pavlinter\admoplata\PdfResponseFormatter',
            ],
        ]
    ],
    ...
],

Ссылка для крона

/en/admoplata/transaction/cron

Запустить миграцию

yii migrate --migrationPath=@vendor/pavlinter/yii2-adm-oplata/admoplata/migrations

Как использовать

echo Html::a('My-Page',['/admoplata/default/invoice', 'alias' => 'My-hash']);

Контроллер

public function actionOrder() {
    $item1 = new OplataItem();
    $item1->title = 'Item 1';
    $item1->description = 'Item 1Item 1Item 1Item 1Item 1';
    $item1->price = '20';
    $item1->amount = 1;

    $item2 = new OplataItem();
    $item2->title = 'Item 2';
    $item2->description = 'Item 2Item 2Item 2Item 2Item 2';
    $item2->price = '0.9';
    $item2->amount = 2;

    Yii::$app->oplata->clearItems();
    Yii::$app->oplata->addItem($item1);
    Yii::$app->oplata->addItem($item2);
    $order = Yii::$app->oplata->createOrder([
        'user_id' => null,
        'language_id' => Yii::$app->getI18n()->getId(),
        'email' => 'bob@bob.com',
        'title' => 'Тестовый заказ',
        'currency' => OplataTransaction::CURRENCY_USD,
        'shipping' => '0.89',
        'data' => [], //or string or object
    ]);
    if ($order !== false) {
        return $this->redirect(['invoice', 'alias' => $order->alias]);
    }
    echo '<pre>';
    echo print_r(Yii::$app->oplata->getErrors());
    echo '</pre>';
}

The Versions

13/02 2015

dev-oplata+paypal

dev-oplata+paypal

Yii2: Adm Oplata

  Sources   Download

BSD 3-Clause

The Requires

 

by Pavels Radajevs

yii2 cms adm adm-oplata oplata

10/02 2015

dev-master

9999999-dev

Yii2: Adm Oplata

  Sources   Download

BSD 3-Clause

The Requires

 

by Pavels Radajevs

yii2 cms adm adm-oplata oplata

20/01 2015

v1.0.0-beta

1.0.0.0-beta

Yii2: Adm Oplata

  Sources   Download

BSD 3-Clause

The Requires

 

by Pavels Radajevs

yii2 cms adm adm-oplata oplata