GithubHelp home page GithubHelp logo

mchatsdk's Introduction

MChatSDK

Монгол чатын хөгжүүлэгчдэд зориулсан SDK.

Dependency

.NETFramework4.5+

.NETStandart2.0+

Newtonsoft.Json

Яаж суулгах вэ?

Nuget дээр манай sdk-ийн хувилбарууд тавигдаж байгаа бөгөөд та шууд visual studio дээрээсээ суулгах боломжтой.

Доорх холбоосоор орж сонирхоно уу

https://www.nuget.org/packages/mchat.sdk/

Яаж хэрэглэх вэ?

Хамгийн түрүүнд тохиргоог хийх хэрэгтэй. Тохиргоо хийгээгүй үед Exception заахыг анхаарна уу!

MChatWorkerConfiguration.Instance.Configure("API_KEY", MChatWorkerConfiguration.MChatWorkerType.MChatWorkerKey, "WORKER_KEY");

Утсаар төлөх дээрх кодыг уншуулан төлбөр авах

MChatRequestReceipt receipt = new MChatRequestReceipt();
receipt.totalPrice = 2;
receipt.title = "receipt title";
receipt.subTitle = "receipt subtitle";
receipt.noat = "20";
receipt.nhat = "0";
receipt.ttd = "ttd";
ArrayList products = new ArrayList();
products.Add(new MChatProduct("Coca Cola", 100, 1));
products.Add(new MChatProduct("Hiam", 1000, 1));
receipt.products = products;
MChatResponseChargeByQRCode responseCharge = await client.ChargeByQRCode(new MChatRequestChargeByQRCode(receipt, "token", "ref_number"));

Гүйлгээнд НӨАТ-ын мэдээлэлийг хавсаргах

MChatResponse updateResponse = await client.UpdateTransaction(new MChatRequestUpdateTransaction("IBNK-563101", "ddtd", "billType", "lotteryId", "qrCode"));

Хэрэглэгч уншуулж болох QR код гаргах

MChatRequestReceipt receipt = new MChatRequestReceipt();
receipt.totalPrice = 2;
receipt.title = "receipt title";
receipt.subTitle = "receipt subtitle";
receipt.noat = "20";
receipt.nhat = "0";
receipt.ttd = "ttd";
ArrayList products = new ArrayList();
products.Add(new MChatProduct("Coca Cola", 100, 1));
products.Add(new MChatProduct("Hiam", 1000, 1));
receipt.products = products;
MChatResponseGenerateQRCode responseGenerateQRCode = await client.GeneratePaymentQRCode(new MChatRequestGenerateQRCode(receipt, false, "dynamic_link_callback", "tag", "branch_id" "ref_number")); // dynamicLink үүсгэхийг хүсвэл true утга явуулна

Хэрэглэгч уншуулж болох QR код гарган notification service - тэй холбогдон төлбөр төлөгдсөн эсхийг мэдэх.

MChatRequestReceipt receipt = new MChatRequestReceipt();
receipt.totalPrice = 2;
receipt.title = "Laviva";
receipt.subTitle = "Welcome to Laviva";
receipt.noat = "20";
receipt.nhat = "0";
receipt.ttd = "ttd";
ArrayList products = new ArrayList();
products.Add(new MChatProduct("Coca Cola", 100, 1));
products.Add(new MChatProduct("Hiam", 1000, 1));
receipt.products = products;
MChatResponseGenerateQRCode response = await client.GeneratePaymentQRCode(new MChatRequestGenerateQRCode(receipt, false, "dynamic_link_callback", "tag", "branch_id" "ref_number")), (MChatWorkerClient scanPayment, BNSState state, String generatedQRCode, String dynamicLink, MChatResponse res) =>
{
    if (state == BNSState.Ready)
    {
        // Succesfully connected and ready to receive notification from notification service
    }
    else if (state == BNSState.Connected)
    {
        // Successfully connected to notification service
    }
    else if (state == BNSState.Disconnected)
    {
        // Disconnected from notification service
    }
    else if (state == BNSState.PaymentSuccessful)
    {
        // Got response from payment notification service
        // Notification service - ээс хариу ирсэний дараа заавал статусийг нь шалгах хэрэгтэй.
    }
    else if (state == BNSState.ErrorOccured)
    {
        // Error Occured when connection notification service
        // Timeout эсвэл ямар наг алдаа гарсаны дараа статус шалгах хэрэгтэй
    }
});

Гүйлгээг reference_number - аар шалгах

MChatResponse checkTransactionByRefResponse = await client.CheckTransactionByRefNumber("ref_number");

Хэрэглэгчид харуулсан QR кодны статусийг шалгах

MChatResponseCheckStatus responseStatus = await client.CheckQRCodePaymentStatus(generatedQRCode);

Тухайн Worker - ийн хийсэн гүйлгээний жагсаалтыг авах.

MChatResponseTransactionList responseTransactionList = await client.GetTransactionList(0, 20);

Гүйлгээний дэлгэрэнгүй мэдээлэл авах.

MChatResponseTransactionDetail responseTransactionDetail = await client.GetTransactionDetail("IBNK-563101");

Settlement upload хийх

//Max Count 10
ArrayList settlements = new ArrayList();
settlements.Add(new MChatRequestSettlementTransaction("reference_number", 1000));
MChatResponseSettlementUpload settlementResponse = await client.SettleUpload(new MChatRequestSettleUpload(settlements));

mchatsdk's People

Contributors

heropd avatar ebattulga avatar

Stargazers

 avatar soideawe avatar Батмөнх Билгүүн avatar  avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.