CN109976738A - It is a kind of to realize that dynamic adjusts the charging method of charging SDK partner based on design pattern - Google Patents
It is a kind of to realize that dynamic adjusts the charging method of charging SDK partner based on design pattern Download PDFInfo
- Publication number
- CN109976738A CN109976738A CN201910249199.4A CN201910249199A CN109976738A CN 109976738 A CN109976738 A CN 109976738A CN 201910249199 A CN201910249199 A CN 201910249199A CN 109976738 A CN109976738 A CN 109976738A
- Authority
- CN
- China
- Prior art keywords
- charging
- sdk
- payment
- design pattern
- partner
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/31—Programming languages or programming paradigms
- G06F8/315—Object-oriented languages
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/08—Payment architectures
- G06Q20/14—Payment architectures specially adapted for billing systems
Abstract
The present invention discloses a kind of charging method that dynamic adjustment charging SDK partner is realized based on design pattern, it is related to charging method technical field, this method based on charging flow include user obtain payment two dimensional code, it pays manufacturer and notifies payment result, three steps of user query payment result, the two dimensional code paid is obtained executing user, when paying manufacturer's notice the two steps of payment result, firstly the need of defining interface BossSDK as unified standard, need to formulate unified standard method simultaneously, then, adapter, which is defined, according to different SDK manufacturers realizes interface, and call method corresponding with interface is realized, finally, define adapter factory, by specifying the corresponding SDK adapter of different strategy generatings, realize switching at runtime SDK manufacturer, realize routine call decoupling, by for designing mould The dynamic adaptation and scalability of program are realized in the utilization of formula, reduce the exploitation maintenance cost in later period.
Description
Technical field
It is specifically a kind of that dynamic adjustment charging is realized based on design pattern the present invention relates to charging method technical field
The charging method of SDK partner.
Background technique
The Full Name in English of SDK is: software development kit, and the meaning for translating into Chinese is exactly that " software is opened
Send out kit ".More popular understanding refers to the tool for the realization a certain function of software product of being provided by the third party service provider
Packet.Occur generally in the form of set API and document, example, tool.Usual SDK is to provide profession by the company of technicality
The set of service, for example Android developing instrument or the service based on hardware development etc. are provided.Also have for a certain software function
SDK, such as push technology, image recognition technology, mobile payment technology, while also to provide resource total for the company of resources advantage class
The SDK enjoyed, such as some advertisement SDK provide profit channel, and distribution SDK provides product and downloads channel.
Currently, frequently encountering following problems in project development process, client proposes demand by the cooperation of Third-party payment
Side is switched to Alipay payment from wechat payment, or has currently supported wechat and Alipay payment, needs to be further added by drawing card
Payment access is drawn, because the SDK method of each payment manufacturer is different, at this time if good programming does not inevitably result in greatly
Core code modification is measured, modified program maintenance and scalability are problematic in that, and are made to the code of stable release
Modification will definitely increase a large amount of test job.
Summary of the invention
The present invention is directed to the demand and shortcoming of current technology development, provides one kind based on design pattern and realizes that dynamic is adjusted
The charging method of whole charging SDK partner.
A kind of charging method for being realized dynamic adjustment charging SDK partner based on design pattern of the invention, is solved above-mentioned
Technical problem the technical solution adopted is as follows:
A kind of to realize that dynamic adjusts the charging method of charging SDK partner based on design pattern, charging flow includes user
Obtain the two dimensional code of payment, payment manufacturer notifies three payment result, user query payment result steps.
In the two dimensional code of user's acquisition payment, payment manufacturer notice the two steps of payment result:
Firstly the need of defining interface BossSDK as unified standard, while needing to formulate unified standard method;
Then, adapter is defined according to different SDK manufacturers and realizes interface, and call side corresponding with interface is realized
Method;
Finally, defining adapter factory, by specifying the corresponding SDK adapter of different strategy generatings, realize that dynamic is cut
SDK manufacturer is changed, realizes routine call decoupling.
User obtains the two dimensional code of payment, and detailed process includes:
Call bossSDK to subscription authentication;
Create order;
PaySDK is called to obtain two dimensional code.
It pays manufacturer and notifies that payment result, detailed process include:
Modify order pay status;
Account charging;
Account is deducted fees;
User authorizes and modifies order licensing status.
After account charging, it can be determined whether to rush just according to recharging result.
After modifying order licensing status, flat account can be determined whether according to Authorization result.
User query payment result, detailed process include:
Inquire the payment authorization state of specified order.
Defining interface BossSDK as unified standard when, define accountRechargeAuthenticate () be used for into
Row user supplements authentication with money, defines accountRecharge () for account charging, defines accountCharge () for account
It deducts fees.
During defining interface BossSDK, defining adapter realization interface, defining adapter factory, need to follow
Single responsibility principle, Richter scale replacement principle rely on and are inverted principle, interface isolation principle, opening and closing principle, Di meter Te rule.
A kind of charging method for realizing dynamic adjustment charging SDK partner based on design pattern of the invention, with existing skill
Art is compared and is had the beneficial effect that
When the present invention executes the two dimensional code of user's acquisition payment, payment manufacturer notice the two steps of payment result, first
It needs defining interface BossSDK as unified standard, while needing to formulate unified standard method, then, according to different SDK
Manufacturer defines adapter and realizes interface, and method corresponding with interface is realized is called to pass through finally, defining adapter factory
The corresponding SDK adapter of different strategy generatings is specified, realizes switching at runtime SDK manufacturer, routine call decoupling is realized, by right
In the utilization of design pattern, the dynamic adaptation and scalability of program are realized, reduce the exploitation maintenance cost in later period.
Specific embodiment
The technical issues of to make technical solution of the present invention, solving and technical effect are more clearly understood, below in conjunction with tool
Body embodiment carries out clear, complete description to technical solution of the present invention, it is clear that described embodiment is only this hair
Bright a part of the embodiment, instead of all the embodiments.Based on the embodiment of the present invention, those skilled in the art are not doing
All embodiments obtained under the premise of creative work out, all within protection scope of the present invention.
Embodiment one:
The present embodiment proposes a kind of charging method that dynamic adjustment charging SDK partner is realized based on design pattern, charging
Process includes that user obtains the two dimensional code of payment, payment manufacturer notice three payment result, user query payment result steps.
In the two dimensional code of user's acquisition payment, payment manufacturer notice the two steps of payment result:
Firstly the need of defining interface BossSDK as unified standard, while needing to formulate unified standard method;
Then, adapter is defined according to different SDK manufacturers and realizes interface, and call side corresponding with interface is realized
Method;
Finally, defining adapter factory, by specifying the corresponding SDK adapter of different strategy generatings, realize that dynamic is cut
SDK manufacturer is changed, realizes routine call decoupling.
User obtains the two dimensional code of payment, and detailed process includes:
Call bossSDK to subscription authentication;
Create order;
PaySDK is called to obtain two dimensional code.
It pays manufacturer and notifies that payment result, detailed process include:
Modify order pay status;
Account charging;
Account is deducted fees;
User authorizes and modifies order licensing status.
After account charging, it can be determined whether to rush just according to recharging result.
After modifying order licensing status, flat account can be determined whether according to Authorization result.
User query payment result, detailed process include:
Inquire the payment authorization state of specified order.
Defining interface BossSDK as unified standard when, define accountRechargeAuthenticate () be used for into
Row user supplements authentication with money, defines accountRecharge () for account charging, defines accountCharge () for account
It deducts fees.
During defining interface BossSDK, defining adapter realization interface, defining adapter factory, need to follow
Single responsibility principle, Richter scale replacement principle rely on and are inverted principle, interface isolation principle, opening and closing principle, Di meter Te rule.
According to above statement, the definition of associated class realizes that process is as follows in this charging method:
Receive payment request class PayController
Such includes following three kinds of methods:
PayCharging (): it executes and obtains two dimensional code method
PayQuery (): inquiry payment result method is executed
PayResultHook (): notice payment result method is executed
Such specific implementation code is as follows:
Operational approach realizes class PayServiceImpl
Such includes following four kinds of methods:
PayCharging (): it executes and obtains two dimensional code method
PayQuery (String token): inquiry payment result method is executed
PayResultHook (): notice payment result method is executed
UserAuthAndUpdateOrderStatus (): user's authorization and more new order licensing status method are executed, is needed
To guarantee atomicity in an affairs
Such specific implementation code is as follows:
Order operation persistent layer realizes class PayDaoImpl
Such includes following four kinds of methods:
SaveOrder (): it executes and saves order method
UpdateOrderStatus (String type): modification order status method is executed
GetOrder (): it executes and obtains order method
UserAuth (): subscriber entitlement method is executed
Such specific implementation code is as follows:
Factory class BossSDKFactory:BossSDK creates object according to strategy
Such includes the following two kinds method:
SdkMap (): by reading configuration information, the corresponding relationship of strategy and adapter is preloaded
Create (): according to the corresponding object of strategy generating
Such specific implementation code is as follows:
Operate abstraction interface BossSDK:Boss
Such includes following three kinds of methods:
AccountRechargeAuthenticate (): method for authenticating is supplemented in execution with money
AccountRecharge (): account charging method is executed
AccountCharge (): account charging method is executed
It is as follows that the interface implements code:
Provider method class BossSDKYX:SDK
Such includes following four kinds of methods:
Authenticate (): user supplements authentication with money
ChargeMoney (): account charging
UserAuthenticate (): user's verification
Buy (): account is deducted fees;
Such specific implementation code is as follows:
Provider method class BossSDKCY:SDK
Such includes following three kinds of methods:
RechargeAuthenticate (): user supplements authentication with money
Recharge (): account charging
Charge (): account is deducted fees
Such specific implementation code is as follows:
Adapter class BossSDKYXAdapter:SDK
BossSDKYX: hold corresponding SDK object reference
Such specific implementation code is as follows:
Adapter class BossSDKCYAdapter:SDK
BossSDKCY: hold corresponding SDK object reference
Such specific implementation code is as follows:
Program can respectively specify that the SDK provider of Different Strategies when executing, realize corresponding function respectively, as a result such as
Under:
Claims (8)
1. a kind of realize that dynamic adjusts the charging method of charging SDK partner based on design pattern, charging flow includes that user obtains
Take payment two dimensional code, payment manufacturer notice three payment result, user query payment result steps, which is characterized in that with
Family obtains the two dimensional code of payment, payment manufacturer notifies in the two steps of payment result, it is necessary first to which defining interface BossSDK makees
It to seek unity of standard, while needing to formulate unified standard method, then, adapter realization is defined according to different SDK manufacturers and is connect
Mouthful, and method corresponding with interface is realized is called, finally, adapter factory is defined, by specifying different strategy generatings pair
The SDK adapter answered realizes switching at runtime SDK manufacturer, realizes routine call decoupling.
2. a kind of charging method that dynamic adjustment charging SDK partner is realized based on design pattern according to claim 1,
It is characterized in that, user obtains the two dimensional code of payment, detailed process includes:
Call bossSDK to subscription authentication;
Create order;
PaySDK is called to obtain two dimensional code.
3. a kind of charging method that dynamic adjustment charging SDK partner is realized based on design pattern according to claim 2,
It is characterized in that, payment manufacturer notifies that payment result, detailed process include:
Modify order pay status;
Account charging;
Account is deducted fees;
User authorizes and modifies order licensing status.
4. a kind of charging method that dynamic adjustment charging SDK partner is realized based on design pattern according to claim 3,
It is characterized in that, can be determined whether to rush just according to recharging result after account charging.
5. a kind of charging method that dynamic adjustment charging SDK partner is realized based on design pattern according to claim 3,
It is characterized in that, can determine whether flat account according to Authorization result after modifying order licensing status.
6. a kind of charging method that dynamic adjustment charging SDK partner is realized based on design pattern according to claim 3,
It is characterized in that, user query payment result, detailed process include:
Inquire the payment authorization state of specified order.
7. a kind of charging method that dynamic adjustment charging SDK partner is realized based on design pattern according to claim 4,
It is characterized in that, defining accountRechargeAuthenticate () use when defining interface BossSDK is as unified standard
Authentication is supplemented with money in carrying out user, defines accountRecharge () for account charging, definition accountCharge () is used for
Account is deducted fees.
8. a kind of charging method that dynamic adjustment charging SDK partner is realized based on design pattern according to claim 1,
It is characterized in that, needing to abide by during defining interface BossSDK, defining adapter realization interface, defining adapter factory
Single responsibility principle, Richter scale replacement principle are followed, relies on and is inverted principle, interface isolation principle, opening and closing principle, Di meter Te rule.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910249199.4A CN109976738A (en) | 2019-03-29 | 2019-03-29 | It is a kind of to realize that dynamic adjusts the charging method of charging SDK partner based on design pattern |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910249199.4A CN109976738A (en) | 2019-03-29 | 2019-03-29 | It is a kind of to realize that dynamic adjusts the charging method of charging SDK partner based on design pattern |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109976738A true CN109976738A (en) | 2019-07-05 |
Family
ID=67081629
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910249199.4A Pending CN109976738A (en) | 2019-03-29 | 2019-03-29 | It is a kind of to realize that dynamic adjusts the charging method of charging SDK partner based on design pattern |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109976738A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112286619A (en) * | 2020-12-28 | 2021-01-29 | 南京智闪萤科技有限公司 | Method, electronic device, and storage medium for data-driven interface presentation |
CN117555590A (en) * | 2023-10-26 | 2024-02-13 | 之江实验室 | Automatic detection method and device for object-oriented design principle |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105427101A (en) * | 2015-11-19 | 2016-03-23 | 成都连银信息技术有限公司 | Unified payment access gateway supporting multiple payment channels |
CN106296147A (en) * | 2016-08-19 | 2017-01-04 | 上海宝尊电子商务有限公司 | The insertable store of a kind of level configurations pays module |
CN106445509A (en) * | 2016-09-09 | 2017-02-22 | 厦门雅基软件有限公司 | SDK batch quick access tool |
CN107622431A (en) * | 2016-07-15 | 2018-01-23 | 长沙海商网络技术有限公司 | The whole network pc+ wechat+app multi-user mall systems |
-
2019
- 2019-03-29 CN CN201910249199.4A patent/CN109976738A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105427101A (en) * | 2015-11-19 | 2016-03-23 | 成都连银信息技术有限公司 | Unified payment access gateway supporting multiple payment channels |
CN107622431A (en) * | 2016-07-15 | 2018-01-23 | 长沙海商网络技术有限公司 | The whole network pc+ wechat+app multi-user mall systems |
CN106296147A (en) * | 2016-08-19 | 2017-01-04 | 上海宝尊电子商务有限公司 | The insertable store of a kind of level configurations pays module |
CN106445509A (en) * | 2016-09-09 | 2017-02-22 | 厦门雅基软件有限公司 | SDK batch quick access tool |
Non-Patent Citations (2)
Title |
---|
C359621028: "电商第三方支付微信支付接入订单系统", 《HTTPS://BLOG.CSDN.NET/C359621028/ARTICLE/DETAILS/79676073》 * |
U011824095: "策略模式+简单工厂-实际应用场景", 《HTTPS://BLOG.CSDN.NET/U011824095/ARTICLE/DETAILS/86302836》 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112286619A (en) * | 2020-12-28 | 2021-01-29 | 南京智闪萤科技有限公司 | Method, electronic device, and storage medium for data-driven interface presentation |
CN112286619B (en) * | 2020-12-28 | 2021-05-07 | 南京智闪萤科技有限公司 | Method, electronic device, and storage medium for data-driven interface presentation |
CN117555590A (en) * | 2023-10-26 | 2024-02-13 | 之江实验室 | Automatic detection method and device for object-oriented design principle |
CN117555590B (en) * | 2023-10-26 | 2024-05-14 | 之江实验室 | Automatic detection method and device for object-oriented design principle |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Pustišek et al. | Blockchain based autonomous selection of electric vehicle charging station | |
US9402000B2 (en) | Metering traffic for a mobile device | |
ES2355946T3 (en) | BILLING SYSTEM AND BILLING METHOD. | |
US9665729B2 (en) | Revocation of application on mobile device | |
CN109976738A (en) | It is a kind of to realize that dynamic adjusts the charging method of charging SDK partner based on design pattern | |
CN109857405A (en) | Compilation Method, device, storage medium and the terminal of application program installation kit | |
CN105915588B (en) | A kind of mixing cloud computing management system based on data virtualization | |
CN101655949A (en) | Intelligent card charging system and method thereof | |
CN103777961A (en) | Mobile application billing software development kit, mobile application and mobile terminal | |
CN108009808A (en) | The method for developing functions and device of group's account | |
CN106709713A (en) | Method for managing multiple wearable devices of user | |
CN111582844A (en) | Block chain based commission fee distribution method, device and storage medium | |
US7286655B2 (en) | Service accounting system and method | |
CN107274164A (en) | A kind of fusion fund transfer system of third party's mobile payment by all kinds of means and its method | |
CN109062545A (en) | A kind of hybrid Quick Development Framework of Android system native applications | |
CN114926158A (en) | Order payment method, device, storage medium and electronic equipment | |
WO2005091555A1 (en) | A method for implementing the intelligent network charging | |
CN110336714A (en) | A kind of test method of mobile phone app access network signaling mechanisms | |
CN102595365B (en) | Business component-based development method | |
CN109191204A (en) | The accounting management method and device of virtual machine in cloud data system | |
WO2007076724A1 (en) | A method and system for processing charging data in a communication system | |
KR20210128276A (en) | Authentification And Payment Method Of Electric Car Charging Through Social Payment | |
EP2911404A1 (en) | Iptv value-added service management system and method | |
CN103796186A (en) | Communication flow statistical method based on applications and mobile terminal desktop system | |
JP2022518171A (en) | How to determine the shared service index based on the communication certificate sharing service |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190705 |
|
RJ01 | Rejection of invention patent application after publication |