Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

isdaniel/ElectronicInvoice_TW

Open more actions menu

Repository files navigation

ElectronicInvoice_TW NuGet Downloads Build status Ask DeepWiki


Nuget下載

PM > Install-Package ElectronicInvoice_TW 

範例程式

EInvoiceDemo專案範例:

範例是呼叫【撈取中獎發票API】

使用工廠模式

//設定使用哪個抓取Setting類別
var setting  = new AppsettingConfig();

//建立工廠 將配置檔傳入建構子中
InvoiceApiFactory factory = new InvoiceApiFactory(setting);

//建立查詢參數  
//下面範例查詢 發票民國106年7.8月中獎發票
QryWinningListModel model = new QryWinningListModel()
{
    invTerm = "10608"
};

//在工廠中藉由傳入參數 取得Api產品
var api = factory.GetProxyInstace(model);

//api回傳結果
var result = api.ExecuteApi(model);

使用InvoiceApiContext

  • 簡化使用創建流程
  1. 創建一個 InvoiceApiContext 物件
  2. 傳入要使用的Model,即可獲得使用的值
var setting  = new AppsettingConfig();
DonateQueryModel donateModel = new DonateQueryModel()
{
    qKey = "伊甸"
};
InvoiceApiContext apiContext = new InvoiceApiContext(setting);
result = apiContext.ExecuteApi(donateModel); 

使用Model可以參考


WebConfig配置

<appSettings>
  <!--查詢api的url  api名稱為key,請求網址為value-->
  <add key="QryWinningListApi" value="https://api.einvoice.nat.gov.tw/PB2CAPIVAN/invapp/InvApp" />
  <!--是否開啟API模擬-->
  <add key="IsMockAPI" value="0" />
  <!--設置你們Key和IV-->
  <add key="GovAppId" value="" />
  <add key="GovAPIKey" value=""/>
</appSettings>

JsonConfig 範例

{
	"GovAppId":"",
	"GovAPIKey":"",
	"IsMockAPI":"0",
	"ApiURLTable":{
		"QryWinningListApi":"https://wwwtest.einvoice.nat.gov.tw/PB2CAPIVAN/invapp/InvApp",
		"QryCarrierAggApi":"https://www.einvoice.nat.gov.tw/PB2CAPIVAN/Carrier/Aggregate",
		"DonateQueryApi":"https://wwwtest.einvoice.nat.gov.tw/PB2CAPIVAN/loveCodeapp/qryLoveCode",
		"MyApi":"https://wwwtest.einvoice.nat.gov.tw/PB2CAPIVAN/invapp/InvApp"
	}
}

SDK說明連結

Blog原理解說


Todo List

基礎建設:

  • 建立InvoiceApiContext封裝Factory Api實做
  • 撰寫單元測試
  • API文件和Model類別使用對應表

API實做:

Release Note:

  • 1.5.0 ~ 2.0.0 支援.net core和.net framework 4.6.1以上

Contributors :

Contributing Guidelines

To contribute to this repository, please follow these guidelines:

Please make sure you write unit-test for your modification code, and pass all previous unit-test case.

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch-name).
  3. Make your changes.
  4. Commit your changes (git commit -m 'Add some feature').
  5. Push to the branch (git push origin feature-branch-name).
  6. Open a pull request.

About

⭐🇹🇼台灣電子發票串接SDK 可以快速開發測試電子發票

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.