PHP code example of otnansirk / laravel-moota

1. Go to this page and download the library: Download otnansirk/laravel-moota library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

otnansirk / laravel-moota example snippets


'providers' => [
    // ...
    Otnansirk\Moota\MootaCoreServiceProvider::class,
];

php artisan vendor:publish --provider="Otnansirk\Moota\MootaCoreServiceProvider"



  $data = [
    "name" => "moota",
    "email" => "[email protected]",
    "password" => "your password",
    "password_confirmation" => "your password confirmation"
  ];

    MootaAuth::register($data);



  MootaAuth::login('moota_email', 'moota_password', ["api"]);



  MootaAuth::logout();



  MootaAuth::profile();



  MootaBank::available(1, 10);



  MootaBank::list(1, 10);



  $data = [
    "corporate_id" => "",
    "bank_type"    => "bca",
    "username"     => "user_ibanking",
    "password"     => "password_ibanking",
    "name_holder"  => "Jhone Dhoe",
    "is_active"    => true,
    "account_number"=> 16899030
  ];

  MootaBank::store($data);



  $id = "123";
  $data = [
    "corporate_id" => "",
    "bank_type"    => "bca",
    "username"     => "user_ibanking",
    "password"     => "password_ibanking",
    "name_holder"  => "Jhone Dhoe",
    "is_active"    => true,
    "account_number"=> 16899030
  ];

  MootaBank::update($data, $id);



  $id = "123";
  MootaBank::update($id);



  $id = "123";
  MootaBank::requestOtp($id);



  $id = "123";
  MootaBank::verifyOtp("1234", $id);



  MootaMutation::refresh("1234", $id);



  $params = [
      "type"       => "credit",
      "bank_id"    => "1234",
      "start_date" => "1997-01-10",
      "end_date"   => "1997-01-10",
      "tag"        => "muta",
      "page"       => 1,
      "par_page"   => 10
  ];

  MootaMutation::list($params);



  $data = [
      "date"   => "1997-01-10",
      "note"   => "muta",
      "amount" => 1,
      "type"   => 10
  ];

  MootaMutation::store($data, "123");



  $note = "Note 1";
  MootaMutation::note($data, "123");



  MootaMutation::destroy("mutation_id");



  $mutationIds = ["mutation_id", "mutation_id"];
  MootaMutation::destroy($mutationIds);



  MootaMutation::tags("tags_q", "123");



  $tags = ["tags_1", "tags_2"];
  MootaMutation::MootaMutation($tags, $mutationId);



  $params = [
    "bank_id"    => "123",
    "type"       => "credit",
    "start_date" => "1997-10-10",
    "end_date"   => "1997-10-10",
  ];

  MootaMutation::summary($params);



  MootaMutation::webhook("1234");



  MootaTag::store("Bayar Token");



  MootaTag::update("Bayar Pulsa", "1234");

 

  $data = [
    "invoice_number" => "inv-fattah-17"
    "amount" => 20000
    "payment_method_id" => "4D0LWdYkevQ"
    "type" => "payment"
    "callback_url" => "https://app.moota.co/debug/webhook"
    "expired_date" => "2022-08-02 20:00:00"
    "description" => "penjualan baju polos"
    "increase_total_from_unique_code" => 1
    "customer" => [
      "name" => "Terry Herman"
      "email" => "[email protected]"
      "phone" => "622513121190"
    ]
    "items" => [
      0 => array:5 [
        "name" => "t-shirt white"
        "qty" => 10
        "price" => 10000
        "sku" => "SKU-245-8411"
        "image_url" => "https://via.placeholder.com/150"
      ]
      1 => array:5 [
        "name" => "t-shirt white"
        "qty" => 10
        "price" => 10000
        "sku" => "SKU-188-0680"
        "image_url" => "https://via.placeholder.com/150"
      ]
    ]
    "with_unique_code" => 1
    "start_unique_code" => 10
    "end_unique_code" => 20
    "unique_code" => 0
  ];

  MootaPay::contract($data)->save();
 

 

  MootaPay::list();

  OR

  MootaPay::contract()->list();

 

 

  MootaPay::method();

 

 

  MootaPay::canceled("TRX-1234");

 

 

  MootaPay::pluginToken()

 

 

  $data = [
    "total" => "102351",
    "amount" => "69015",
    "status" => "success",
    "trx_id" => "trx-c91b6dd3-1bbc-5c3e-bf26-84d925a03a43",
    "created_at" => "2022-02-04 15:08:23",
    "invoice_number" => "INV-923-737-2218",
    "payment_at" => "2022-02-04 20:08:23",
    "unique_code" => "0",
    "expired_date" => "2022-02-05 15:08:23",
    "payment_method_id" => "pn3ykVZkNRD"
  ];

  MootaPay::callback($data)

 

  $data = [
    'amount' => 50000,
    'payment_method' => 'bcaGiro' // This value is bank_type from response MootaTopup::topup()->to()
  ];

  MootaTopup::topup($data)->save();
  

  $data = [
    "url"               => "https =>//app.moota.co/endpoint/webhooks",
    "bank_account_id"   => "hq10916...",
    "kinds"             => "credit",
    "secret_token"      => "generate_your_hash_secret_token",
    "start_unique_code" => 1,
    "end_unique_code"   => 999
  ];

  MootaWebhook::store($data);
  

    $data = [
      'logo' => 'image.png',
      'merchant_name' => '',
      'merchant_email' => '',
      'merchant_phone' => '',
      'address' => '',
      'business_type' => '',
      'website' => ''
    ];

    MootaMerchant::store($data);
  

    $data = [
      'type' => 'personal',
      'ktp_director_number' => '',
      'owner_ktp_file' => '',
      'owner_ktp_selfie_file' => '',
      'company_name' => '',
      'company_phone' => '',
      'company_email' => '',
      'siup_number' => '',
      'owner_npwp_file' => '',
      'company_npwp_file' => '',
      'company_siup_file' => '',
      'company_certificate_file' => '',
      'bank_account_id' => ''
    ];

    MootaMerchant::legal($data)->save();
  

    $data = [
      'logo' => 'image.png',
      'merchant_name' => '',
      'merchant_email' => '',
      'merchant_phone' => '',
      'address' => '',
      'business_type' => '',
      'website' => ''
    ];

    $merchantId = 'gQnp0VqzNrO';

    MootaMerchant::update($data, $merchantId);
  

    $data = [
      'type' => 'personal',
      'ktp_director_number' => '',
      'owner_ktp_file' => '',
      'owner_ktp_selfie_file' => '',
      'company_name' => '',
      'company_phone' => '',
      'company_email' => '',
      'siup_number' => '',
      'owner_npwp_file' => '',
      'company_npwp_file' => '',
      'company_siup_file' => '',
      'company_certificate_file' => '',
      'bank_account_id' => ''
    ];

    $merchantId = 'gQnp0VqzNrO';

    MootaMerchant::legal($data, $merchantId)->save();