├── .github ├── CONTRIBUTING.md ├── FUNDING.yml └── workflows │ ├── ci.yml │ ├── codeql-analysis.yml │ ├── release.yml │ └── snapshot.yml ├── .gitignore ├── .idea ├── .gitignore ├── .name ├── codeStyleSettings.xml ├── codeStyles │ ├── Project.xml │ └── codeStyleConfig.xml ├── copyright │ ├── apache.xml │ └── profiles_settings.xml ├── encodings.xml ├── inspectionProfiles │ └── Project_Default.xml ├── misc.xml ├── scopes │ └── scope_settings.xml └── vcs.xml ├── LICENSE ├── NEWS ├── README.md ├── catalog ├── pom.xml └── src │ └── main │ └── java │ └── org │ └── killbill │ └── billing │ └── catalog │ └── plugin │ └── api │ ├── CatalogPluginApi.java │ ├── StandalonePluginCatalog.java │ └── VersionedPluginCatalog.java ├── control ├── pom.xml └── src │ └── main │ └── java │ └── org │ └── killbill │ └── billing │ └── control │ └── plugin │ └── api │ ├── ControlResult.java │ ├── HPPType.java │ ├── OnFailurePaymentControlResult.java │ ├── OnSuccessPaymentControlResult.java │ ├── PaymentApiType.java │ ├── PaymentControlApiException.java │ ├── PaymentControlContext.java │ ├── PaymentControlPluginApi.java │ └── PriorPaymentControlResult.java ├── currency ├── pom.xml └── src │ └── main │ └── java │ └── org │ └── killbill │ └── billing │ └── currency │ └── plugin │ └── api │ └── CurrencyPluginApi.java ├── entitlement ├── pom.xml └── src │ └── main │ └── java │ └── org │ └── killbill │ └── billing │ └── entitlement │ └── plugin │ └── api │ ├── EntitlementContext.java │ ├── EntitlementPluginApi.java │ ├── EntitlementPluginApiException.java │ ├── OnFailureEntitlementResult.java │ ├── OnSuccessEntitlementResult.java │ ├── OperationType.java │ └── PriorEntitlementResult.java ├── invoice ├── pom.xml └── src │ └── main │ └── java │ └── org │ └── killbill │ └── billing │ └── invoice │ └── plugin │ └── api │ ├── AdditionalItemsResult.java │ ├── InvoiceContext.java │ ├── InvoiceFormatterFactory.java │ ├── InvoiceGroup.java │ ├── InvoiceGroupingResult.java │ ├── InvoicePluginApi.java │ ├── InvoicePluginApiRetryException.java │ ├── InvoiceResult.java │ ├── OnFailureInvoiceResult.java │ ├── OnSuccessInvoiceResult.java │ └── PriorInvoiceResult.java ├── notification ├── pom.xml ├── spotbugs-exclude.xml └── src │ └── main │ └── java │ └── org │ └── killbill │ └── billing │ └── notification │ └── plugin │ └── api │ ├── BlockingStateMetadata.java │ ├── BroadcastMetadata.java │ ├── ExtBusEvent.java │ ├── ExtBusEventType.java │ ├── InvoiceNotificationMetadata.java │ ├── InvoicePaymentMetadata.java │ ├── NotificationPluginApi.java │ ├── NotificationPluginApiRetryException.java │ ├── PaymentMetadata.java │ ├── SubscriptionMetadata.java │ ├── TagMetadata.java │ └── TenantConfigMetadata.java ├── payment ├── pom.xml └── src │ └── main │ └── java │ └── org │ └── killbill │ └── billing │ └── payment │ └── plugin │ └── api │ ├── PaymentMethodInfoPlugin.java │ ├── PaymentPluginApi.java │ └── PaymentPluginApiException.java ├── pom.xml ├── release.sh └── usage ├── pom.xml └── src └── main └── java └── org └── killbill └── billing └── usage └── plugin └── api ├── UsageContext.java └── UsagePluginApi.java /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## How to contribute to Kill Bill 2 | 3 | **Do not open up a GitHub issue before reaching out to our [Mailing-List](https://groups.google.com/forum/#!forum/killbilling-users)**. GitHub issues are primarily intended for tracking bug reports and fixes by the core team. 4 | 5 | #### **Did you find a bug?** 6 | 7 | In your [Mailing-List](https://groups.google.com/forum/#!forum/killbilling-users) post, specify: 8 | 9 | * Step by step description on how to reproduce the issue 10 | * [Account data and system dump](http://docs.killbill.io/latest/debugging.html#_seeking_help) via KPM of an affected account 11 | 12 | #### **Do you intend to add a new feature or change an existing one?** 13 | 14 | Do not open an issue or pull request on GitHub until you have collected positive feedback about the change on the [Mailing-List](https://groups.google.com/forum/#!forum/killbilling-users). 15 | 16 | When submitting code, make sure to add [new tests](http://docs.killbill.io/latest/development.html#_navigating_the_kill_bill_codebase). 17 | 18 | #### **Do you want to contribute to the Kill Bill documentation?** 19 | 20 | Open a pull request on GitHub in the [killbill-docs](https://github.com/killbill/killbill-docs) repository. 21 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [killbill] 4 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: ci 2 | 3 | on: 4 | push: 5 | pull_request: 6 | workflow_dispatch: 7 | 8 | jobs: 9 | ci: 10 | uses: killbill/gh-actions-shared/.github/workflows/ci.yml@main 11 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | name: CodeQL 2 | 3 | on: 4 | push: 5 | pull_request: 6 | workflow_dispatch: 7 | 8 | jobs: 9 | analyze: 10 | uses: killbill/gh-actions-shared/.github/workflows/codeql-analysis.yml@main 11 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: release 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | parent_version: 7 | description: 'New killbill-oss-parent version' 8 | required: false 9 | default: '' 10 | perform_version: 11 | description: 'tag to (re-)perform (in case of release:perform failure)' 12 | required: false 13 | default: '' 14 | 15 | env: 16 | MAVEN_FLAGS: "-B --no-transfer-progress" 17 | MAVEN_OPTS: "-Xmx2G -XX:+ExitOnOutOfMemoryError -Dmaven.wagon.rto=60000 -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 -Dmaven.wagon.http.retryHandler.count=3" 18 | 19 | jobs: 20 | release: 21 | runs-on: ubuntu-latest 22 | steps: 23 | - name: Checkout code 24 | if: github.event.inputs.perform_version == '' 25 | uses: actions/checkout@v2 26 | - name: Checkout full repository 27 | # Required when performing an existing release. 28 | if: github.event.inputs.perform_version != '' 29 | uses: actions/checkout@v2 30 | with: 31 | fetch-depth: '0' 32 | - name: Setup git user 33 | env: 34 | BUILD_USER: ${{ secrets.BUILD_USER }} 35 | BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }} 36 | run: | 37 | git config --global user.email "contact@killbill.io" 38 | git config --global user.name "Kill Bill core team" 39 | git config --global url."https://${BUILD_USER}:${BUILD_TOKEN}@github.com/".insteadOf "git@github.com:" 40 | - name: Configure Java 41 | uses: actions/setup-java@v1 42 | with: 43 | java-version: 11 44 | - name: Configure Sonatype mirror 45 | uses: s4u/maven-settings-action@v2.3.0 46 | # Go to Sonatype directly to avoid delay syncs (could get rid of this if actions/setup-java were to support mirrors). 47 | with: 48 | mirrors: '[{"id": "oss-releases", "name": "Sonatype releases", "mirrorOf": "*", "url": "https://oss.sonatype.org/content/repositories/releases/"}]' 49 | - name: Download Java dependencies 50 | # We do as much as we can, but it may not be enough (https://issues.apache.org/jira/browse/MDEP-82) 51 | run: | 52 | mvn ${MAVEN_FLAGS} clean install dependency:resolve dependency:resolve-plugins -DskipTests=true -Dgpg.skip=true -Psonatype-oss-release 53 | - name: Update killbill-oss-parent 54 | if: github.event.inputs.parent_version != '' 55 | run: | 56 | echo "Updating killbill-oss-parent pom.xml to ${{ github.event.inputs.parent_version }}:" 57 | mvn ${MAVEN_FLAGS} versions:update-parent -DgenerateBackupPoms=false -DparentVersion="[${{ github.event.inputs.parent_version }}]" 58 | echo "killbill-oss-parent pom.xml changes:" 59 | git --no-pager diff 60 | echo "Downloading new dependencies:" 61 | mvn ${MAVEN_FLAGS} -U clean install -DskipTests=true 62 | 63 | git add pom.xml 64 | # Will be pushed as part of the release process, only if the release is successful 65 | git commit -m "pom.xml: update killbill-oss-parent to ${{ github.event.inputs.parent_version }}" 66 | - name: Configure settings.xml for release 67 | uses: actions/setup-java@v1 68 | with: 69 | java-version: 11 70 | server-id: ossrh-releases 71 | server-username: OSSRH_USER 72 | server-password: OSSRH_PASS 73 | gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }} 74 | gpg-passphrase: GPG_PASSPHRASE 75 | - name: Release artifacts 76 | if: github.event.inputs.perform_version == '' 77 | env: 78 | OSSRH_USER: ${{ secrets.OSSRH_USER }} 79 | OSSRH_PASS: ${{ secrets.OSSRH_PASS }} 80 | GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} 81 | # It will still check the remote but hopefully not download much (0 B at 0 B/s). -o isn't safe because of MDEP-82 (see above). 82 | run: | 83 | mvn ${MAVEN_FLAGS} release:clean release:prepare release:perform 84 | - name: Perform release 85 | if: github.event.inputs.perform_version != '' 86 | env: 87 | OSSRH_USER: ${{ secrets.OSSRH_USER }} 88 | OSSRH_PASS: ${{ secrets.OSSRH_PASS }} 89 | GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} 90 | # It will still check the remote but hopefully not download much (0 B at 0 B/s). -o isn't safe because of MDEP-82 (see above). 91 | # See https://issues.apache.org/jira/browse/SCM-729 for why the release.properties file is required. 92 | run: | 93 | echo "scm.url=scm\:git\:git@github.com\:${GITHUB_REPOSITORY}.git" > release.properties 94 | echo "scm.tag=${{ github.event.inputs.perform_version }}" >> release.properties 95 | mvn ${MAVEN_FLAGS} release:perform 96 | -------------------------------------------------------------------------------- /.github/workflows/snapshot.yml: -------------------------------------------------------------------------------- 1 | name: snapshot 2 | 3 | on: 4 | push: 5 | workflow_dispatch: 6 | 7 | jobs: 8 | snapshot: 9 | uses: killbill/gh-actions-shared/.github/workflows/snapshot.yml@main 10 | secrets: 11 | OSSRH_USER: ${{ secrets.OSSRH_USER }} 12 | OSSRH_PASS: ${{ secrets.OSSRH_PASS }} 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # https://github.com/github/gitignore/blob/ce5da10a3a43c4dd8bd9572eda17c0a37ee0eac1/Global/JetBrains.gitignore 3 | # 4 | 5 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider 6 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 7 | 8 | # User-specific stuff 9 | .idea/**/workspace.xml 10 | .idea/**/tasks.xml 11 | .idea/**/usage.statistics.xml 12 | .idea/**/dictionaries 13 | .idea/**/shelf 14 | 15 | # AWS User-specific 16 | .idea/**/aws.xml 17 | 18 | # Generated files 19 | .idea/**/contentModel.xml 20 | 21 | # Sensitive or high-churn files 22 | .idea/**/dataSources/ 23 | .idea/**/dataSources.ids 24 | .idea/**/dataSources.local.xml 25 | .idea/**/sqlDataSources.xml 26 | .idea/**/dynamic.xml 27 | .idea/**/uiDesigner.xml 28 | .idea/**/dbnavigator.xml 29 | 30 | # Gradle 31 | .idea/**/gradle.xml 32 | .idea/**/libraries 33 | 34 | # Gradle and Maven with auto-import 35 | # When using Gradle or Maven with auto-import, you should exclude module files, 36 | # since they will be recreated, and may cause churn. Uncomment if using 37 | # auto-import. 38 | .idea/artifacts 39 | .idea/compiler.xml 40 | .idea/jarRepositories.xml 41 | .idea/modules.xml 42 | .idea/*.iml 43 | .idea/modules 44 | *.iml 45 | *.ipr 46 | 47 | # CMake 48 | cmake-build-*/ 49 | 50 | # Mongo Explorer plugin 51 | .idea/**/mongoSettings.xml 52 | 53 | # File-based project format 54 | *.iws 55 | 56 | # IntelliJ 57 | out/ 58 | 59 | # mpeltonen/sbt-idea plugin 60 | .idea_modules/ 61 | 62 | # JIRA plugin 63 | atlassian-ide-plugin.xml 64 | 65 | # Cursive Clojure plugin 66 | .idea/replstate.xml 67 | 68 | # SonarLint plugin 69 | .idea/sonarlint/ 70 | 71 | # Crashlytics plugin (for Android Studio and IntelliJ) 72 | com_crashlytics_export_strings.xml 73 | crashlytics.properties 74 | crashlytics-build.properties 75 | fabric.properties 76 | 77 | # Editor-based Rest Client 78 | .idea/httpRequests 79 | 80 | # Android studio 3.1+ serialized cache file 81 | .idea/caches/build_file_checksums.ser 82 | 83 | # 84 | # https://github.com/github/gitignore/blob/36ce3a894d9ddff2916bc98d71380aa7167ff1d7/Global/Eclipse.gitignore 85 | # 86 | 87 | .metadata 88 | bin/ 89 | tmp/ 90 | *.tmp 91 | *.bak 92 | *.swp 93 | *~.nib 94 | local.properties 95 | .settings/ 96 | .loadpath 97 | .recommenders 98 | .classpath 99 | 100 | # External tool builders 101 | .externalToolBuilders/ 102 | 103 | # Locally stored "Eclipse launch configurations" 104 | *.launch 105 | 106 | # PyDev specific (Python IDE for Eclipse) 107 | *.pydevproject 108 | 109 | # CDT-specific (C/C++ Development Tooling) 110 | .cproject 111 | 112 | # CDT- autotools 113 | .autotools 114 | 115 | # Java annotation processor (APT) 116 | .factorypath 117 | 118 | # PDT-specific (PHP Development Tools) 119 | .buildpath 120 | 121 | # sbteclipse plugin 122 | .target 123 | 124 | # Tern plugin 125 | .tern-project 126 | 127 | # TeXlipse plugin 128 | .texlipse 129 | 130 | # STS (Spring Tool Suite) 131 | .springBeans 132 | 133 | # Code Recommenders 134 | .recommenders/ 135 | 136 | # Annotation Processing 137 | .apt_generated/ 138 | .apt_generated_test/ 139 | 140 | # Scala IDE specific (Scala & Java development for Eclipse) 141 | .cache-main 142 | .scala_dependencies 143 | .worksheet 144 | 145 | # Uncomment this line if you wish to ignore the project description file. 146 | # Typically, this file would be tracked if it contains build/dependency configurations: 147 | .project 148 | 149 | # 150 | # https://github.com/github/gitignore/blob/6651bca9c83572f908474fc6206ed8a80df91290/Maven.gitignore 151 | # 152 | 153 | target/ 154 | pom.xml.tag 155 | pom.xml.releaseBackup 156 | pom.xml.versionsBackup 157 | pom.xml.next 158 | release.properties 159 | dependency-reduced-pom.xml 160 | buildNumber.properties 161 | .mvn/timing.properties 162 | # https://github.com/takari/maven-wrapper#usage-without-binary-jar 163 | .mvn/wrapper/maven-wrapper.jar 164 | 165 | # 166 | # https://github.com/github/gitignore/blob/36ce3a894d9ddff2916bc98d71380aa7167ff1d7/Java.gitignore 167 | # 168 | 169 | # Compiled class file 170 | *.class 171 | 172 | # Log file 173 | *.log 174 | 175 | # BlueJ files 176 | *.ctxt 177 | 178 | # Mobile Tools for Java (J2ME) 179 | .mtj.tmp/ 180 | 181 | # Package Files # 182 | *.jar 183 | *.war 184 | *.nar 185 | *.ear 186 | *.zip 187 | *.tar.gz 188 | *.rar 189 | 190 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 191 | hs_err_pid* 192 | 193 | # 194 | # https://github.com/github/gitignore/blob/320a610b9ffba3ff28166370b6dd9f73096e34b7/Global/macOS.gitignore 195 | # 196 | 197 | # General 198 | .DS_Store 199 | .AppleDouble 200 | .LSOverride 201 | 202 | # Icon must end with two \r 203 | Icon 204 | 205 | 206 | # Thumbnails 207 | ._* 208 | 209 | # Files that might appear in the root of a volume 210 | .DocumentRevisions-V100 211 | .fseventsd 212 | .Spotlight-V100 213 | .TemporaryItems 214 | .Trashes 215 | .VolumeIcon.icns 216 | .com.apple.timemachine.donotpresent 217 | 218 | # Directories potentially created on remote AFP share 219 | .AppleDB 220 | .AppleDesktop 221 | Network Trash Folder 222 | Temporary Items 223 | .apdisk 224 | 225 | # 226 | # https://github.com/github/gitignore/blob/320a610b9ffba3ff28166370b6dd9f73096e34b7/Global/TextMate.gitignore 227 | # 228 | 229 | *.tmproj 230 | *.tmproject 231 | tmtags 232 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Datasource local storage ignored files 5 | /dataSources/ 6 | /dataSources.local.xml 7 | # Editor-based HTTP Client requests 8 | /httpRequests/ 9 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | killbill-plugin-api -------------------------------------------------------------------------------- /.idea/codeStyleSettings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 59 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 28 | 29 | 30 | 32 | 33 | 55 | 56 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/copyright/apache.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 53 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/scopes/scope_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | 0.26.4 2 | Add paymentAttemptId into the INVOICE_PAYMENT_SUCCESS json 3 | 4 | 0.26.3 5 | Update killbill-oss-parent to 0.143.45 6 | 7 | 0.26.2 8 | Add UsagePluginApi#getUsageForSubscription api 9 | 10 | 0.26.1 11 | Fix typo in UsagePluginApi 12 | 13 | 0.26.0 14 | Initial usage plugin api 15 | Initial usage plugin api 16 | 17 | 0.25.0 18 | Update version to 0.25.x 19 | 20 | 0.24.8 21 | Add new metadata object for InvoiceNotification 22 | 23 | 0.24.7 24 | Update killbill-oss-parent to 0.141.52 25 | 26 | 0.24.6 27 | invoice: make OnSuccessInvoiceResult an interface 28 | 29 | 0.24.5 30 | Invoice Plugin Api Enhancements 31 | 32 | 0.24.4 33 | Add missing CTOR in InvoicePaymentMetadata 34 | 35 | 0.24.3 36 | adding object to write invoice payment metadata in bus events 37 | 38 | 0.24.2 39 | Rename OperationType.UNCANCEL_SUBSCRIPTION -> OperationType.UNDO_PENDING_SUBSCRIPTION_OPERATION 40 | 41 | 0.24.1 42 | Enhance CatalogPluginApi to allow Kill Bill catalog module to cache plugin catalog 43 | invoice: introduce InvoicePluginApiRetryException 44 | Remove VersionedPluginCatalog#getRecurringBillingMode as this should now be defined at the Plan level 45 | notification: Add ExtBusEvent#getUserToken api 46 | payment: Enhance payment control plugin to allow an overwrite of pluginName during addPaymentMethod operation 47 | invoice: make InvoicePluginApiRetryException extend QueueRetryException 48 | invoice: add missing constructors in InvoicePluginApiRetryException 49 | notification: add NotificationPluginApiRetryException 50 | 51 | 0.23.1 52 | Add bundleExternalKey in Subscription event metadata field 53 | 54 | 0.23 55 | Add new Metadata field for Subscription events 56 | 57 | 0.22 58 | Shopping cart API 59 | 60 | 0.21 61 | Add metadata object for Payment events 62 | 63 | 0.20 64 | Update plugin-api with HA branch 65 | 66 | 0.19 67 | Update plugin-api to 0.19 for KB release 0.17 68 | 69 | 0.18 70 | Add ExtBusEventType BROADCAST_SERVICE 71 | 72 | 0.17 73 | Modify EntitlementContext for new combo entitlement api 74 | 75 | 0.16 76 | Add dryRun to InvoicePluginApi#getAdditionalInvoiceItems signature 77 | 78 | 0.15 79 | Add new PaymentApiType and HPPType in the PaymentControlContext to support more than just pure payment transaction control plugin 80 | 81 | 0.14 82 | Additional changes in plugin control api (renaming and API changes) 83 | 84 | 0.13 85 | Rename routing module -> control module (and same for package) 86 | Add getAdjustedPluginProperties() to OnSuccessPaymentControlResult and OnFailurePaymentControlResult 87 | 88 | 0.12 89 | Add new EntitlementPluginApi 90 | 91 | 0.11 92 | Add support for catalog plugin api 93 | 94 | 0.10 95 | routing: allow control plugins to override plugin properties 96 | 97 | 0.9 98 | Initial release for Kill Bill 0.14.x 99 | Update killbill-oss-parent to 0.11 100 | 101 | 0.8.5 102 | Add new event type for INVOICE_NOTIFICATION 103 | 104 | 0.8.4 105 | Revert plugin interface to allow for all plugin types to receive events 106 | 107 | 0.8.3 108 | Add new plugin interface to allow for all plugin types to receive events 109 | Add new ExtBusEventType TENANT_CONFIG_CHANGE, TENANT_CONFIG_DELETION and new metaData field 110 | 111 | 0.8.2 112 | Rename module/package/api retry -> routing 113 | 114 | 0.8.1 115 | Add plugin properties for PaymentControlPluginApi 116 | 117 | 0.7.5 118 | Update PriorPaymentControlResult to allow overwriting payment methodID 119 | 120 | 0.7.4 121 | Introduce new invoice plugin 122 | Introduce new retry plugin 123 | Payment: 124 | Introduce PaymentPluginApi#creditPayment (https://github.com/killbill/killbill/issues/187) 125 | Deprecate PaymentInfoPlugin and RefundInfoPlugin for PaymentTransactionInfoPlugin 126 | Rename PaymentPluginApi#processPayment to purchasePayment 127 | Rename PaymentPluginApi#processRefund to refundPayment 128 | Add kbTransactionId to authorizePayment, capturePayment, purchasePayment, voidPayment and refundPayment 129 | Update killbill-oss-parent to 0.7.12 130 | 131 | 0.7.3 132 | Add missing context in PaymentPluginApi#resetPaymentMethods 133 | 134 | 0.7.2 135 | Iteration on payment gateway APIs 136 | Update killbill-oss-parent to 0.7.8 137 | 138 | 0.7.1 139 | Iteration on direct payment API 140 | Update killbill-oss-parent to 0.7.5 141 | 142 | 0.7.0 143 | Allow custom properties to be passed to payment API calls 144 | Update killbill-oss-parent to 0.7.0 145 | 146 | 0.6.5 147 | Add (ActiveMerchant-like) APIs for direct payment (auth, capture, ...) 148 | 149 | 0.6.4 150 | Update package from com.ning -> org.killbill 151 | 152 | 0.6.3 153 | Update killbill-oss-parent to 0.5.17 154 | Add PaymentPluginApi#searchRefunds 155 | 156 | 0.6.2 157 | Add PaymentPluginApi#searchPayments 158 | Update to killbill-oss-parent 0.5.9 159 | 160 | 0.6.1 161 | Currency api changes 162 | 163 | 0.6.0 164 | Add new Currency plugin apis 165 | 166 | 0.5.0 167 | Add support for pagination in PaymentPluginApi#searchPaymentMethods 168 | Update to killbill-oss-parent 0.5.1 169 | 170 | 0.4.0 171 | Add external event type for PAUSE/RESUME (entitlement) 172 | 173 | 0.3.0 174 | Add searchPaymentMethods in PaymentPluginApi 175 | Update to killbill-oss-parent 0.3.7 176 | 177 | 0.2.6 178 | Update to killbill-oss-parent 0.3.5 179 | 180 | 0.2.5 181 | Update to killbill-oss-parent 0.3.1 182 | 183 | 0.2.4 184 | Update to killbill-oss-parent 0.2.5 185 | 186 | 0.2.3 187 | Initial import from https://github.com/killbill/killbill 188 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # killbill-plugin-api 2 | ![Maven Central](https://img.shields.io/maven-central/v/org.kill-bill.billing.plugin/killbill-plugin-api?color=blue&label=Maven%20Central) 3 | 4 | Kill Bill plugin APIs. 5 | 6 | ## Kill Bill compatibility 7 | 8 | | API version | Kill Bill version | 9 | | ----------: | ----------------: | 10 | | 0.18.y | 0.16.z | 11 | | 0.23.y | 0.18.z | 12 | | 0.24.y | 0.19.z | 13 | | 0.25.y | 0.20.z | 14 | | 0.26.y | 0.22.z | 15 | | 0.27.y | 0.24.z | 16 | 17 | ## Usage 18 | 19 | Add the relevant submodule(s) to a project: 20 | 21 | ```xml 22 | 23 | org.kill-bill.billing.plugin 24 | killbill-plugin-api-catalog 25 | ... release version ... 26 | 27 | 28 | org.kill-bill.billing.plugin 29 | killbill-plugin-api-control 30 | ... release version ... 31 | 32 | 33 | org.kill-bill.billing.plugin 34 | killbill-plugin-api-currency 35 | ... release version ... 36 | 37 | 38 | org.kill-bill.billing.plugin 39 | killbill-plugin-api-entitlement 40 | ... release version ... 41 | 42 | 43 | org.kill-bill.billing.plugin 44 | killbill-plugin-api-invoice 45 | ... release version ... 46 | 47 | 48 | org.kill-bill.billing.plugin 49 | killbill-plugin-api-notification 50 | ... release version ... 51 | 52 | 53 | org.kill-bill.billing.plugin 54 | killbill-plugin-api-payment 55 | ... release version ... 56 | 57 | 58 | org.kill-bill.billing.plugin 59 | killbill-plugin-api-usage 60 | ... release version ... 61 | 62 | ``` 63 | 64 | ## About 65 | 66 | Kill Bill is the leading Open-Source Subscription Billing & Payments Platform. For more information about the project, go to https://killbill.io/. 67 | -------------------------------------------------------------------------------- /catalog/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 4.0.0 20 | 21 | org.kill-bill.billing.plugin 22 | killbill-plugin-api 23 | 0.27.4-SNAPSHOT 24 | 25 | killbill-plugin-api-catalog 26 | Kill Bill catalog plugin apis 27 | 28 | 29 | joda-time 30 | joda-time 31 | 32 | 33 | org.kill-bill.billing 34 | killbill-api 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /catalog/src/main/java/org/killbill/billing/catalog/plugin/api/CatalogPluginApi.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Groupon, Inc 3 | * Copyright 2014 The Billing Project, LLC 4 | * 5 | * The Billing Project licenses this file to you under the Apache License, version 2.0 6 | * (the "License"); you may not use this file except in compliance with the 7 | * License. You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | package org.killbill.billing.catalog.plugin.api; 19 | 20 | import org.joda.time.DateTime; 21 | import org.killbill.billing.payment.api.PluginProperty; 22 | import org.killbill.billing.util.callcontext.TenantContext; 23 | 24 | public interface CatalogPluginApi { 25 | 26 | /** 27 | * 28 | * @param properties 29 | * @param context 30 | * @return 31 | */ 32 | public DateTime getLatestCatalogVersion(Iterable properties, final TenantContext context); 33 | 34 | 35 | /** 36 | * Returns a plugin versioned catalog for this tenant 37 | * 38 | * @param context 39 | * @return 40 | */ 41 | public VersionedPluginCatalog getVersionedPluginCatalog(Iterable properties, final TenantContext context); 42 | } 43 | -------------------------------------------------------------------------------- /catalog/src/main/java/org/killbill/billing/catalog/plugin/api/StandalonePluginCatalog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * Copyright 2015 Groupon, Inc 4 | * Copyright 2015 The Billing Project, LLC 5 | * 6 | * The Billing Project licenses this file to you under the Apache License, version 2.0 7 | * (the "License"); you may not use this file except in compliance with the 8 | * License. You may obtain a copy of the License at: 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | * License for the specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package org.killbill.billing.catalog.plugin.api; 20 | 21 | import org.joda.time.DateTime; 22 | import org.killbill.billing.catalog.api.Currency; 23 | import org.killbill.billing.catalog.api.Plan; 24 | import org.killbill.billing.catalog.api.PriceList; 25 | import org.killbill.billing.catalog.api.Product; 26 | import org.killbill.billing.catalog.api.Unit; 27 | import org.killbill.billing.catalog.api.rules.PlanRules; 28 | 29 | public interface StandalonePluginCatalog { 30 | 31 | /** 32 | * 33 | * @return the effective date for this catalog 34 | */ 35 | public DateTime getEffectiveDate(); 36 | 37 | /** 38 | * 39 | * @return the {@code Currency}s available 40 | */ 41 | public Iterable getCurrencies(); 42 | 43 | /** 44 | * 45 | * @return the {@code Unit}s available 46 | */ 47 | public Iterable getUnits(); 48 | 49 | /** 50 | * 51 | * @return the {@code Product}s available 52 | */ 53 | public Iterable getProducts(); 54 | 55 | /** 56 | * 57 | * @return the {@code Plan}s available 58 | */ 59 | public Iterable getPlans(); 60 | 61 | /** 62 | * 63 | * @return the {@code PriceList}s available (the first one will be the default {@code PriceList}) 64 | */ 65 | public PriceList getDefaultPriceList(); 66 | 67 | public Iterable getChildrenPriceList(); 68 | 69 | public PlanRules getPlanRules(); 70 | } 71 | -------------------------------------------------------------------------------- /catalog/src/main/java/org/killbill/billing/catalog/plugin/api/VersionedPluginCatalog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * Copyright 2015 Groupon, Inc 4 | * Copyright 2015 The Billing Project, LLC 5 | * 6 | * The Billing Project licenses this file to you under the Apache License, version 2.0 7 | * (the "License"); you may not use this file except in compliance with the 8 | * License. You may obtain a copy of the License at: 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | * License for the specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package org.killbill.billing.catalog.plugin.api; 20 | 21 | import org.killbill.billing.catalog.api.BillingMode; 22 | 23 | public interface VersionedPluginCatalog { 24 | 25 | /** 26 | * 27 | * @return the name of the catalog 28 | */ 29 | public String getCatalogName(); 30 | 31 | /** 32 | * 33 | * @return the {@code StandalonePluginCatalog} for each version 34 | */ 35 | public Iterable getStandalonePluginCatalogs(); 36 | } 37 | -------------------------------------------------------------------------------- /control/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 4.0.0 21 | 22 | org.kill-bill.billing.plugin 23 | killbill-plugin-api 24 | 0.27.4-SNAPSHOT 25 | ../pom.xml 26 | 27 | killbill-plugin-api-control 28 | Kill Bill payment control plugin apis 29 | 30 | 31 | joda-time 32 | joda-time 33 | 34 | 35 | org.kill-bill.billing 36 | killbill-api 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /control/src/main/java/org/killbill/billing/control/plugin/api/ControlResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * Copyright 2015 Groupon, Inc 4 | * Copyright 2015 The Billing Project, LLC 5 | * 6 | * The Billing Project licenses this file to you under the Apache License, version 2.0 7 | * (the "License"); you may not use this file except in compliance with the 8 | * License. You may obtain a copy of the License at: 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | * License for the specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package org.killbill.billing.control.plugin.api; 20 | 21 | import org.killbill.billing.payment.api.PluginProperty; 22 | 23 | public interface ControlResult { 24 | /** 25 | * @return the new plugin properties that should be used for that attempt 26 | */ 27 | public Iterable getAdjustedPluginProperties(); 28 | } 29 | -------------------------------------------------------------------------------- /control/src/main/java/org/killbill/billing/control/plugin/api/HPPType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * Copyright 2015 Groupon, Inc 4 | * Copyright 2015 The Billing Project, LLC 5 | * 6 | * The Billing Project licenses this file to you under the Apache License, version 2.0 7 | * (the "License"); you may not use this file except in compliance with the 8 | * License. You may obtain a copy of the License at: 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | * License for the specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package org.killbill.billing.control.plugin.api; 20 | 21 | public enum HPPType { 22 | BUILD_FORM_DESCRIPTOR 23 | } 24 | -------------------------------------------------------------------------------- /control/src/main/java/org/killbill/billing/control/plugin/api/OnFailurePaymentControlResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Groupon, Inc 3 | * Copyright 2014 The Billing Project, LLC 4 | * 5 | * The Billing Project licenses this file to you under the Apache License, version 2.0 6 | * (the "License"); you may not use this file except in compliance with the 7 | * License. You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | package org.killbill.billing.control.plugin.api; 19 | 20 | import org.joda.time.DateTime; 21 | 22 | public interface OnFailurePaymentControlResult extends ControlResult { 23 | 24 | /** 25 | * @return the date the call should be retried or null if there should be no retry 26 | */ 27 | public DateTime getNextRetryDate(); 28 | } 29 | -------------------------------------------------------------------------------- /control/src/main/java/org/killbill/billing/control/plugin/api/OnSuccessPaymentControlResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * Copyright 2014 Groupon, Inc 4 | * Copyright 2014 The Billing Project, LLC 5 | * 6 | * The Billing Project licenses this file to you under the Apache License, version 2.0 7 | * (the "License"); you may not use this file except in compliance with the 8 | * License. You may obtain a copy of the License at: 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | * License for the specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package org.killbill.billing.control.plugin.api; 20 | 21 | public interface OnSuccessPaymentControlResult extends ControlResult { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /control/src/main/java/org/killbill/billing/control/plugin/api/PaymentApiType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * Copyright 2015 Groupon, Inc 4 | * Copyright 2015 The Billing Project, LLC 5 | * 6 | * The Billing Project licenses this file to you under the Apache License, version 2.0 7 | * (the "License"); you may not use this file except in compliance with the 8 | * License. You may obtain a copy of the License at: 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | * License for the specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package org.killbill.billing.control.plugin.api; 20 | 21 | public enum PaymentApiType { 22 | PAYMENT_TRANSACTION, 23 | PAYMENT_METHOD, 24 | HPP, 25 | NOTIFICATION 26 | } 27 | -------------------------------------------------------------------------------- /control/src/main/java/org/killbill/billing/control/plugin/api/PaymentControlApiException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * Copyright 2014 Groupon, Inc 4 | * Copyright 2014 The Billing Project, LLC 5 | * 6 | * The Billing Project licenses this file to you under the Apache License, version 2.0 7 | * (the "License"); you may not use this file except in compliance with the 8 | * License. You may obtain a copy of the License at: 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | * License for the specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package org.killbill.billing.control.plugin.api; 20 | 21 | public class PaymentControlApiException extends Exception { 22 | 23 | public PaymentControlApiException() { 24 | } 25 | 26 | public PaymentControlApiException(final String message) { 27 | super(message); 28 | } 29 | 30 | public PaymentControlApiException(final String message, final Throwable cause) { 31 | super(message, cause); 32 | } 33 | 34 | public PaymentControlApiException(final Throwable cause) { 35 | super(cause); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /control/src/main/java/org/killbill/billing/control/plugin/api/PaymentControlContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Groupon, Inc 3 | * Copyright 2014 The Billing Project, LLC 4 | * 5 | * The Billing Project licenses this file to you under the Apache License, version 2.0 6 | * (the "License"); you may not use this file except in compliance with the 7 | * License. You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | package org.killbill.billing.control.plugin.api; 19 | 20 | import java.math.BigDecimal; 21 | import java.util.UUID; 22 | 23 | import org.killbill.billing.catalog.api.Currency; 24 | import org.killbill.billing.payment.api.PluginProperty; 25 | import org.killbill.billing.payment.api.TransactionType; 26 | import org.killbill.billing.util.callcontext.CallContext; 27 | 28 | public interface PaymentControlContext extends CallContext { 29 | 30 | public UUID getAccountId(); 31 | 32 | public UUID getPaymentId(); 33 | 34 | public UUID getAttemptPaymentId(); 35 | 36 | public String getPaymentExternalKey(); 37 | 38 | public UUID getTransactionId(); 39 | 40 | public String getTransactionExternalKey(); 41 | 42 | public PaymentApiType getPaymentApiType(); 43 | 44 | public TransactionType getTransactionType(); 45 | 46 | public HPPType getHPPType(); 47 | 48 | public BigDecimal getAmount(); 49 | 50 | public Currency getCurrency(); 51 | 52 | public UUID getPaymentMethodId(); 53 | 54 | public String getPaymentPluginName(); 55 | 56 | public BigDecimal getProcessedAmount(); 57 | 58 | public Currency getProcessedCurrency(); 59 | 60 | public boolean isApiPayment(); 61 | } 62 | -------------------------------------------------------------------------------- /control/src/main/java/org/killbill/billing/control/plugin/api/PaymentControlPluginApi.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Groupon, Inc 3 | * Copyright 2014 The Billing Project, LLC 4 | * 5 | * The Billing Project licenses this file to you under the Apache License, version 2.0 6 | * (the "License"); you may not use this file except in compliance with the 7 | * License. You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | package org.killbill.billing.control.plugin.api; 19 | 20 | import org.killbill.billing.payment.api.PluginProperty; 21 | 22 | public interface PaymentControlPluginApi { 23 | 24 | public PriorPaymentControlResult priorCall(PaymentControlContext context, Iterable properties) throws PaymentControlApiException; 25 | 26 | public OnSuccessPaymentControlResult onSuccessCall(PaymentControlContext context, Iterable properties) throws PaymentControlApiException; 27 | 28 | public OnFailurePaymentControlResult onFailureCall(PaymentControlContext context, Iterable properties) throws PaymentControlApiException; 29 | } 30 | -------------------------------------------------------------------------------- /control/src/main/java/org/killbill/billing/control/plugin/api/PriorPaymentControlResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Groupon, Inc 3 | * Copyright 2014-2015 The Billing Project, LLC 4 | * 5 | * The Billing Project licenses this file to you under the Apache License, version 2.0 6 | * (the "License"); you may not use this file except in compliance with the 7 | * License. You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | package org.killbill.billing.control.plugin.api; 19 | 20 | import java.math.BigDecimal; 21 | import java.util.UUID; 22 | 23 | import org.killbill.billing.catalog.api.Currency; 24 | import org.killbill.billing.payment.api.PluginProperty; 25 | 26 | public interface PriorPaymentControlResult extends ControlResult { 27 | 28 | /** 29 | * @return true if call should not proceed 30 | */ 31 | public boolean isAborted(); 32 | 33 | /** 34 | * @return the new amount that should be used for that attempt 35 | */ 36 | public BigDecimal getAdjustedAmount(); 37 | 38 | /** 39 | * @return the new currency that should be used for that attempt 40 | */ 41 | public Currency getAdjustedCurrency(); 42 | 43 | /** 44 | * @return the new payment method id that should be used for that attempt 45 | */ 46 | public UUID getAdjustedPaymentMethodId(); 47 | 48 | /** 49 | * @return the new payment method plugin name (Only for ADD_PAYMENT_METHOD) 50 | */ 51 | public String getAdjustedPluginName(); 52 | } 53 | -------------------------------------------------------------------------------- /currency/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 4.0.0 21 | 22 | org.kill-bill.billing.plugin 23 | killbill-plugin-api 24 | 0.27.4-SNAPSHOT 25 | 26 | killbill-plugin-api-currency 27 | Kill Bill currency conversion plugin apis 28 | 29 | 30 | joda-time 31 | joda-time 32 | 33 | 34 | org.kill-bill.billing 35 | killbill-api 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /currency/src/main/java/org/killbill/billing/currency/plugin/api/CurrencyPluginApi.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.killbill.billing.currency.plugin.api; 18 | 19 | import java.util.Set; 20 | import java.util.SortedSet; 21 | 22 | import org.joda.time.DateTime; 23 | import org.killbill.billing.catalog.api.Currency; 24 | import org.killbill.billing.currency.api.Rate; 25 | 26 | public interface CurrencyPluginApi { 27 | 28 | /** 29 | * @return all the base rates supported 30 | */ 31 | public Set getBaseCurrencies(); 32 | 33 | /** 34 | * @return the last conversion date for a given currency 35 | */ 36 | public DateTime getLatestConversionDate(Currency baseCurrency); 37 | 38 | /** 39 | * @param baseCurrency the base currency 40 | * @return the conversions dates for that currency 41 | */ 42 | public SortedSet getConversionDates(Currency baseCurrency); 43 | 44 | /** 45 | * @param baseCurrency the base currency 46 | * @return the list of rates for that currency 47 | */ 48 | public Set getCurrentRates(Currency baseCurrency); 49 | 50 | /** 51 | * @param baseCurrency the base currency 52 | * @param conversionDate the conversion date 53 | * @return the list of rates for that currency and that conversion date 54 | */ 55 | public Set getRates(Currency baseCurrency, DateTime conversionDate); 56 | } 57 | -------------------------------------------------------------------------------- /entitlement/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 4.0.0 20 | 21 | org.kill-bill.billing.plugin 22 | killbill-plugin-api 23 | 0.27.4-SNAPSHOT 24 | 25 | killbill-plugin-api-entitlement 26 | Kill Bill entitlement plugin apis 27 | 28 | 29 | org.kill-bill.billing 30 | killbill-api 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /entitlement/src/main/java/org/killbill/billing/entitlement/plugin/api/EntitlementContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 The Billing Project, LLC 3 | * 4 | * The Billing Project licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.killbill.billing.entitlement.plugin.api; 18 | 19 | import java.util.UUID; 20 | 21 | import org.killbill.billing.catalog.api.BillingActionPolicy; 22 | import org.killbill.billing.entitlement.api.BaseEntitlementWithAddOnsSpecifier; 23 | import org.killbill.billing.payment.api.PluginProperty; 24 | import org.killbill.billing.util.callcontext.CallContext; 25 | 26 | public interface EntitlementContext extends CallContext { 27 | 28 | public OperationType getOperationType(); 29 | 30 | public UUID getAccountId(); 31 | 32 | public UUID getDestinationAccountId(); 33 | 34 | public Iterable getBaseEntitlementWithAddOnsSpecifiers(); 35 | 36 | public BillingActionPolicy getBillingActionPolicy(); 37 | 38 | public Iterable getPluginProperties(); 39 | } 40 | -------------------------------------------------------------------------------- /entitlement/src/main/java/org/killbill/billing/entitlement/plugin/api/EntitlementPluginApi.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 The Billing Project, LLC 3 | * 4 | * The Billing Project licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.killbill.billing.entitlement.plugin.api; 18 | 19 | import org.killbill.billing.payment.api.PluginProperty; 20 | 21 | public interface EntitlementPluginApi { 22 | 23 | public PriorEntitlementResult priorCall(EntitlementContext context, Iterable properties) throws EntitlementPluginApiException; 24 | 25 | public OnSuccessEntitlementResult onSuccessCall(EntitlementContext context, Iterable properties) throws EntitlementPluginApiException; 26 | 27 | public OnFailureEntitlementResult onFailureCall(EntitlementContext context, Iterable properties) throws EntitlementPluginApiException; 28 | } 29 | -------------------------------------------------------------------------------- /entitlement/src/main/java/org/killbill/billing/entitlement/plugin/api/EntitlementPluginApiException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 The Billing Project, LLC 3 | * 4 | * The Billing Project licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.killbill.billing.entitlement.plugin.api; 18 | 19 | public class EntitlementPluginApiException extends Exception { 20 | 21 | public EntitlementPluginApiException() { 22 | } 23 | 24 | public EntitlementPluginApiException(final String message) { 25 | super(message); 26 | } 27 | 28 | public EntitlementPluginApiException(final String message, final Throwable cause) { 29 | super(message, cause); 30 | } 31 | 32 | public EntitlementPluginApiException(final Throwable cause) { 33 | super(cause); 34 | } 35 | 36 | public EntitlementPluginApiException(final String message, final Throwable cause, final boolean enableSuppression, final boolean writableStackTrace) { 37 | super(message, cause, enableSuppression, writableStackTrace); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /entitlement/src/main/java/org/killbill/billing/entitlement/plugin/api/OnFailureEntitlementResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 The Billing Project, LLC 3 | * 4 | * The Billing Project licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.killbill.billing.entitlement.plugin.api; 18 | 19 | public interface OnFailureEntitlementResult { 20 | } 21 | -------------------------------------------------------------------------------- /entitlement/src/main/java/org/killbill/billing/entitlement/plugin/api/OnSuccessEntitlementResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 The Billing Project, LLC 3 | * 4 | * The Billing Project licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.killbill.billing.entitlement.plugin.api; 18 | 19 | public interface OnSuccessEntitlementResult { 20 | } 21 | -------------------------------------------------------------------------------- /entitlement/src/main/java/org/killbill/billing/entitlement/plugin/api/OperationType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 The Billing Project, LLC 3 | * 4 | * The Billing Project licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.killbill.billing.entitlement.plugin.api; 18 | 19 | public enum OperationType { 20 | CREATE_SUBSCRIPTION, 21 | CHANGE_PLAN, 22 | CANCEL_SUBSCRIPTION, 23 | UNDO_PENDING_SUBSCRIPTION_OPERATION, 24 | ADD_BLOCKING_STATE, 25 | PAUSE_BUNDLE, 26 | RESUME_BUNDLE, 27 | TRANSFER_BUNDLE, 28 | CREATE_SUBSCRIPTIONS_WITH_AO, 29 | UPDATE_BUNDLE_EXTERNAL_KEY, 30 | CREATE_SHOPPING_CART_SUBSCRIPTIONS 31 | } 32 | -------------------------------------------------------------------------------- /entitlement/src/main/java/org/killbill/billing/entitlement/plugin/api/PriorEntitlementResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 The Billing Project, LLC 3 | * 4 | * The Billing Project licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.killbill.billing.entitlement.plugin.api; 18 | 19 | import org.killbill.billing.catalog.api.BillingActionPolicy; 20 | import org.killbill.billing.entitlement.api.BaseEntitlementWithAddOnsSpecifier; 21 | import org.killbill.billing.payment.api.PluginProperty; 22 | 23 | public interface PriorEntitlementResult { 24 | 25 | public boolean isAborted(); 26 | 27 | public BillingActionPolicy getAdjustedBillingActionPolicy(); 28 | 29 | public Iterable getAdjustedBaseEntitlementWithAddOnsSpecifiers(); 30 | 31 | public Iterable getAdjustedPluginProperties(); 32 | } 33 | -------------------------------------------------------------------------------- /invoice/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 4.0.0 20 | 21 | org.kill-bill.billing.plugin 22 | killbill-plugin-api 23 | 0.27.4-SNAPSHOT 24 | 25 | killbill-plugin-api-invoice 26 | Kill Bill invoice plugin apis 27 | 28 | 29 | joda-time 30 | joda-time 31 | 32 | 33 | org.kill-bill.billing 34 | killbill-api 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /invoice/src/main/java/org/killbill/billing/invoice/plugin/api/AdditionalItemsResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020-2022 Equinix, Inc 3 | * Copyright 2014-2022 The Billing Project, LLC 4 | * 5 | * The Billing Project licenses this file to you under the Apache License, version 2.0 6 | * (the "License"); you may not use this file except in compliance with the 7 | * License. You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | package org.killbill.billing.invoice.plugin.api; 19 | 20 | import java.util.List; 21 | 22 | import org.killbill.billing.invoice.api.InvoiceItem; 23 | 24 | public interface AdditionalItemsResult extends InvoiceResult { 25 | List getAdditionalItems(); 26 | } 27 | -------------------------------------------------------------------------------- /invoice/src/main/java/org/killbill/billing/invoice/plugin/api/InvoiceContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2018 Groupon, Inc 3 | * Copyright 2014-2018 The Billing Project, LLC 4 | * 5 | * The Billing Project licenses this file to you under the Apache License, version 2.0 6 | * (the "License"); you may not use this file except in compliance with the 7 | * License. You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | package org.killbill.billing.invoice.plugin.api; 19 | 20 | import java.util.List; 21 | 22 | import org.joda.time.LocalDate; 23 | import org.killbill.billing.invoice.api.Invoice; 24 | import org.killbill.billing.util.callcontext.CallContext; 25 | 26 | public interface InvoiceContext extends CallContext { 27 | 28 | /** 29 | * @return the target date for that invoice run 30 | */ 31 | public LocalDate getTargetDate(); 32 | 33 | /** 34 | * @return the invoice that is being / has been created 35 | */ 36 | public Invoice getInvoice(); 37 | 38 | /** 39 | * @return the existing invoices for this account before that invoice run 40 | */ 41 | public List getExistingInvoices(); 42 | 43 | /** 44 | * @return if true, the invoice won't be persisted 45 | */ 46 | public boolean isDryRun(); 47 | 48 | /** 49 | * @return true if this invoice run was rescheduled 50 | */ 51 | public boolean isRescheduled(); 52 | } 53 | -------------------------------------------------------------------------------- /invoice/src/main/java/org/killbill/billing/invoice/plugin/api/InvoiceFormatterFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020-2024 Equinix, Inc 3 | * Copyright 2014-2024 The Billing Project, LLC 4 | * 5 | * The Billing Project licenses this file to you under the Apache License, version 2.0 6 | * (the "License"); you may not use this file except in compliance with the 7 | * License. You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | package org.killbill.billing.invoice.plugin.api; 19 | 20 | import java.util.Locale; 21 | import java.util.ResourceBundle; 22 | 23 | import org.killbill.billing.currency.api.CurrencyConversionApi; 24 | import org.killbill.billing.invoice.api.Invoice; 25 | import org.killbill.billing.invoice.api.formatters.InvoiceFormatter; 26 | 27 | public interface InvoiceFormatterFactory { 28 | 29 | /** 30 | * 31 | * @param defaultLocale Default Killbill locale 32 | * @param catalogBundlePath Path to the catalog translation bundle 33 | * @param invoice the invoice that is being formatted 34 | * @param locale locale associated with the account 35 | * @param currencyConversionApi API used for currency conversion 36 | * @param bundle ResourceBundle corresponding to the account locale and catalogBundlePath 37 | * @param defaultBundle ResourceBundle corresponding to the default locale and catalogBundlePath 38 | * @return InvoiceFormatter corresponding to the formatted invoice 39 | */ 40 | InvoiceFormatter createInvoiceFormatter(final String defaultLocale, final String catalogBundlePath, final Invoice invoice, final Locale locale, final CurrencyConversionApi currencyConversionApi, ResourceBundle bundle, ResourceBundle defaultBundle); 41 | } 42 | -------------------------------------------------------------------------------- /invoice/src/main/java/org/killbill/billing/invoice/plugin/api/InvoiceGroup.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020-2022 Equinix, Inc 3 | * Copyright 2014-2022 The Billing Project, LLC 4 | * 5 | * The Billing Project licenses this file to you under the Apache License, version 2.0 6 | * (the "License"); you may not use this file except in compliance with the 7 | * License. You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | package org.killbill.billing.invoice.plugin.api; 19 | 20 | import java.util.List; 21 | import java.util.UUID; 22 | 23 | public interface InvoiceGroup { 24 | 25 | List getInvoiceItemIds(); 26 | } 27 | -------------------------------------------------------------------------------- /invoice/src/main/java/org/killbill/billing/invoice/plugin/api/InvoiceGroupingResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020-2022 Equinix, Inc 3 | * Copyright 2014-2022 The Billing Project, LLC 4 | * 5 | * The Billing Project licenses this file to you under the Apache License, version 2.0 6 | * (the "License"); you may not use this file except in compliance with the 7 | * License. You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | package org.killbill.billing.invoice.plugin.api; 19 | 20 | import java.util.List; 21 | 22 | public interface InvoiceGroupingResult extends InvoiceResult { 23 | 24 | List getInvoiceGroups(); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /invoice/src/main/java/org/killbill/billing/invoice/plugin/api/InvoicePluginApi.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Groupon, Inc 3 | * Copyright 2014-2015 The Billing Project, LLC 4 | * 5 | * The Billing Project licenses this file to you under the Apache License, version 2.0 6 | * (the "License"); you may not use this file except in compliance with the 7 | * License. You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | package org.killbill.billing.invoice.plugin.api; 19 | 20 | import java.util.List; 21 | 22 | import org.killbill.billing.invoice.api.Invoice; 23 | import org.killbill.billing.invoice.api.InvoiceItem; 24 | import org.killbill.billing.payment.api.PluginProperty; 25 | import org.killbill.billing.util.callcontext.CallContext; 26 | 27 | public interface InvoicePluginApi { 28 | 29 | PriorInvoiceResult priorCall(InvoiceContext context, Iterable properties); 30 | 31 | /** 32 | * Returns additional invoice items (setup fees, VAT tax, etc) to be added to the invoice upon creation 33 | * 34 | * @param invoice the invoice that is being created 35 | * @param dryRun if true, the invoice won't be persisted 36 | * @param context the call context 37 | * @return the list of additional invoice items to add to the new invoice 38 | */ 39 | AdditionalItemsResult getAdditionalInvoiceItems(Invoice invoice, boolean dryRun, Iterable properties, InvoiceContext context); 40 | 41 | InvoiceGroupingResult getInvoiceGrouping(Invoice invoice, boolean dryRun, Iterable properties, InvoiceContext context); 42 | 43 | OnSuccessInvoiceResult onSuccessCall(InvoiceContext context, Iterable properties); 44 | 45 | OnFailureInvoiceResult onFailureCall(InvoiceContext context, Iterable properties); 46 | } 47 | -------------------------------------------------------------------------------- /invoice/src/main/java/org/killbill/billing/invoice/plugin/api/InvoicePluginApiRetryException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2017 Groupon, Inc 3 | * Copyright 2014-2017 The Billing Project, LLC 4 | * 5 | * The Billing Project licenses this file to you under the Apache License, version 2.0 6 | * (the "License"); you may not use this file except in compliance with the 7 | * License. You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | package org.killbill.billing.invoice.plugin.api; 19 | 20 | import java.util.List; 21 | 22 | import org.joda.time.Period; 23 | import org.killbill.billing.util.queue.QueueRetryException; 24 | 25 | public class InvoicePluginApiRetryException extends QueueRetryException { 26 | 27 | public InvoicePluginApiRetryException() { 28 | } 29 | 30 | public InvoicePluginApiRetryException(final Exception e) { 31 | super(e); 32 | } 33 | 34 | public InvoicePluginApiRetryException(final List retrySchedule) { 35 | super(retrySchedule); 36 | } 37 | 38 | public InvoicePluginApiRetryException(final Exception e, final List retrySchedule) { 39 | super(e, retrySchedule); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /invoice/src/main/java/org/killbill/billing/invoice/plugin/api/InvoiceResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020-2022 Equinix, Inc 3 | * Copyright 2014-2022 The Billing Project, LLC 4 | * 5 | * The Billing Project licenses this file to you under the Apache License, version 2.0 6 | * (the "License"); you may not use this file except in compliance with the 7 | * License. You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | package org.killbill.billing.invoice.plugin.api; 19 | 20 | import org.killbill.billing.payment.api.PluginProperty; 21 | 22 | public interface InvoiceResult { 23 | /** 24 | * @return the new plugin properties that should be used for that attempt 25 | */ 26 | public Iterable getAdjustedPluginProperties(); 27 | } 28 | -------------------------------------------------------------------------------- /invoice/src/main/java/org/killbill/billing/invoice/plugin/api/OnFailureInvoiceResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2018 Groupon, Inc 3 | * Copyright 2014-2018 The Billing Project, LLC 4 | * 5 | * The Billing Project licenses this file to you under the Apache License, version 2.0 6 | * (the "License"); you may not use this file except in compliance with the 7 | * License. You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | package org.killbill.billing.invoice.plugin.api; 19 | 20 | public interface OnFailureInvoiceResult extends InvoiceResult { 21 | } 22 | -------------------------------------------------------------------------------- /invoice/src/main/java/org/killbill/billing/invoice/plugin/api/OnSuccessInvoiceResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2018 Groupon, Inc 3 | * Copyright 2014-2018 The Billing Project, LLC 4 | * 5 | * The Billing Project licenses this file to you under the Apache License, version 2.0 6 | * (the "License"); you may not use this file except in compliance with the 7 | * License. You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | package org.killbill.billing.invoice.plugin.api; 19 | 20 | public interface OnSuccessInvoiceResult extends InvoiceResult { 21 | } 22 | -------------------------------------------------------------------------------- /invoice/src/main/java/org/killbill/billing/invoice/plugin/api/PriorInvoiceResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2018 Groupon, Inc 3 | * Copyright 2014-2018 The Billing Project, LLC 4 | * 5 | * The Billing Project licenses this file to you under the Apache License, version 2.0 6 | * (the "License"); you may not use this file except in compliance with the 7 | * License. You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | package org.killbill.billing.invoice.plugin.api; 19 | 20 | import org.joda.time.DateTime; 21 | 22 | public interface PriorInvoiceResult extends InvoiceResult { 23 | 24 | /** 25 | * @return true if call should not proceed 26 | */ 27 | public boolean isAborted(); 28 | 29 | /** 30 | * @return the date the invoice should be rescheduled or null if invoice generation should proceed 31 | */ 32 | public DateTime getRescheduleDate(); 33 | } 34 | -------------------------------------------------------------------------------- /notification/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 4.0.0 21 | 22 | org.kill-bill.billing.plugin 23 | killbill-plugin-api 24 | 0.27.4-SNAPSHOT 25 | ../pom.xml 26 | 27 | killbill-plugin-api-notification 28 | Kill Bill notification plugin apis 29 | 30 | spotbugs-exclude.xml 31 | 32 | 33 | 34 | com.fasterxml.jackson.core 35 | jackson-annotations 36 | 37 | 38 | joda-time 39 | joda-time 40 | 41 | 42 | org.kill-bill.billing 43 | killbill-api 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /notification/spotbugs-exclude.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /notification/src/main/java/org/killbill/billing/notification/plugin/api/BlockingStateMetadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Groupon, Inc 3 | * Copyright 2016 The Billing Project, LLC 4 | * 5 | * The Billing Project licenses this file to you under the Apache License, version 2.0 6 | * (the "License"); you may not use this file except in compliance with the 7 | * License. You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | package org.killbill.billing.notification.plugin.api; 19 | 20 | import java.util.UUID; 21 | 22 | import org.joda.time.DateTime; 23 | import org.killbill.billing.entitlement.api.BlockingStateType; 24 | 25 | import com.fasterxml.jackson.annotation.JsonCreator; 26 | import com.fasterxml.jackson.annotation.JsonProperty; 27 | 28 | public class BlockingStateMetadata { 29 | 30 | private UUID blockableId; 31 | private String service; 32 | private String stateName; 33 | private BlockingStateType blockingType; 34 | private DateTime effectiveDate; 35 | private Boolean isTransitionedToBlockedBilling; 36 | private Boolean isTransitionedToUnblockedBilling; 37 | private Boolean isTransitionedToBlockedEntitlement; 38 | private Boolean isTransitionedToUnblockedEntitlement; 39 | 40 | public BlockingStateMetadata() { 41 | } 42 | 43 | @JsonCreator 44 | public BlockingStateMetadata(@JsonProperty("blockableId") final UUID blockableId, 45 | @JsonProperty("service") final String service, 46 | @JsonProperty("stateName") final String stateName, 47 | @JsonProperty("blockingType") final BlockingStateType blockingType, 48 | @JsonProperty("effectiveDate") final DateTime effectiveDate, 49 | @JsonProperty("isTransitionedToBlockedBilling") final Boolean isTransitionedToBlockedBilling, 50 | @JsonProperty("isTransitionedToUnblockedBilling") final Boolean isTransitionedToUnblockedBilling, 51 | @JsonProperty("isTransitionedToBlockedEntitlement") final Boolean isTransitionedToBlockedEntitlement, 52 | @JsonProperty("isTransitionedToUnblockedEntitlement") final Boolean isTransitionedToUnblockedEntitlement) { 53 | this.blockableId = blockableId; 54 | this.service = service; 55 | this.stateName = stateName; 56 | this.blockingType = blockingType; 57 | this.effectiveDate = effectiveDate; 58 | this.isTransitionedToBlockedBilling = isTransitionedToBlockedBilling; 59 | this.isTransitionedToUnblockedBilling = isTransitionedToUnblockedBilling; 60 | this.isTransitionedToBlockedEntitlement = isTransitionedToBlockedEntitlement; 61 | this.isTransitionedToUnblockedEntitlement = isTransitionedToUnblockedEntitlement; 62 | } 63 | 64 | public UUID getBlockableId() { 65 | return blockableId; 66 | } 67 | 68 | public String getService() { 69 | return service; 70 | } 71 | 72 | public String getStateName() { 73 | return stateName; 74 | } 75 | 76 | public BlockingStateType getBlockingType() { 77 | return blockingType; 78 | } 79 | 80 | public DateTime getEffectiveDate() { 81 | return effectiveDate; 82 | } 83 | 84 | public Boolean getTransitionedToBlockedBilling() { 85 | return isTransitionedToBlockedBilling; 86 | } 87 | 88 | public Boolean getTransitionedToUnblockedBilling() { 89 | return isTransitionedToUnblockedBilling; 90 | } 91 | 92 | public Boolean getTransitionedToBlockedEntitlement() { 93 | return isTransitionedToBlockedEntitlement; 94 | } 95 | 96 | public Boolean getTransitionedToUnblockedEntitlement() { 97 | return isTransitionedToUnblockedEntitlement; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /notification/src/main/java/org/killbill/billing/notification/plugin/api/BroadcastMetadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * Copyright 2015 Groupon, Inc 4 | * Copyright 2015 The Billing Project, LLC 5 | * 6 | * The Billing Project licenses this file to you under the Apache License, version 2.0 7 | * (the "License"); you may not use this file except in compliance with the 8 | * License. You may obtain a copy of the License at: 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | * License for the specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package org.killbill.billing.notification.plugin.api; 20 | 21 | import com.fasterxml.jackson.annotation.JsonCreator; 22 | import com.fasterxml.jackson.annotation.JsonProperty; 23 | 24 | public class BroadcastMetadata { 25 | 26 | private String service; 27 | private String commandType; 28 | private String eventJson; 29 | 30 | public BroadcastMetadata() { 31 | } 32 | 33 | @JsonCreator 34 | public BroadcastMetadata(@JsonProperty("service") final String service, 35 | @JsonProperty("commandType") final String commandType, 36 | @JsonProperty("eventJson") final String eventJson) { 37 | this.service = service; 38 | this.commandType = commandType; 39 | this.eventJson = eventJson; 40 | } 41 | 42 | public String getService() { 43 | return service; 44 | } 45 | 46 | public String getCommandType() { 47 | return commandType; 48 | } 49 | 50 | public String getEventJson() { 51 | return eventJson; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /notification/src/main/java/org/killbill/billing/notification/plugin/api/ExtBusEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.killbill.billing.notification.plugin.api; 18 | 19 | import java.util.UUID; 20 | 21 | import org.killbill.billing.ObjectType; 22 | 23 | /** 24 | * The interface {@code ExtBusEvent} represents the event type that is published for Killbill users. 25 | */ 26 | public interface ExtBusEvent { 27 | 28 | /** 29 | * @return the {@code ExtBusEventType} 30 | */ 31 | public ExtBusEventType getEventType(); 32 | 33 | /** 34 | * @return the {@code ObjectType} 35 | */ 36 | public ObjectType getObjectType(); 37 | 38 | /** 39 | * @return the unique id for the object that was created/modified 40 | */ 41 | public UUID getObjectId(); 42 | 43 | /** 44 | * 45 | * @return an additional field, specific to the event type: 46 | * - TENANT_CONFIG_CHANGE, TENANT_CONFIG_DELETION : the per tenant key. 47 | * - Other events: null 48 | */ 49 | public String getMetaData(); 50 | 51 | /** 52 | * @return the unique id for the account associated with that object 53 | */ 54 | public UUID getAccountId(); 55 | 56 | public UUID getTenantId(); 57 | 58 | /** 59 | * 60 | * @return the user token coming from API request 61 | */ 62 | UUID getUserToken(); 63 | } 64 | -------------------------------------------------------------------------------- /notification/src/main/java/org/killbill/billing/notification/plugin/api/ExtBusEventType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.killbill.billing.notification.plugin.api; 18 | 19 | /** 20 | * The enum {@code ExtBusEventType} represents the user visible bus event types. 21 | */ 22 | 23 | public enum ExtBusEventType { 24 | ACCOUNT_CREATION, 25 | ACCOUNT_CHANGE, 26 | BLOCKING_STATE, 27 | BROADCAST_SERVICE, 28 | SUBSCRIPTION_CREATION, 29 | SUBSCRIPTION_PHASE, 30 | SUBSCRIPTION_CHANGE, 31 | SUBSCRIPTION_CANCEL, 32 | SUBSCRIPTION_UNCANCEL, 33 | SUBSCRIPTION_BCD_CHANGE, 34 | SUBSCRIPTION_QUANTITY, 35 | SUBSCRIPTION_EXPIRED, 36 | ENTITLEMENT_CREATION, 37 | ENTITLEMENT_CANCEL, 38 | BUNDLE_PAUSE, 39 | BUNDLE_RESUME, 40 | OVERDUE_CHANGE, 41 | INVOICE_CREATION, 42 | INVOICE_ADJUSTMENT, 43 | INVOICE_NOTIFICATION, 44 | INVOICE_PAYMENT_SUCCESS, 45 | INVOICE_PAYMENT_FAILED, 46 | PAYMENT_SUCCESS, 47 | PAYMENT_FAILED, 48 | TAG_CREATION, 49 | TAG_DELETION, 50 | CUSTOM_FIELD_CREATION, 51 | CUSTOM_FIELD_DELETION, 52 | TENANT_CONFIG_CHANGE, 53 | TENANT_CONFIG_DELETION; 54 | } 55 | -------------------------------------------------------------------------------- /notification/src/main/java/org/killbill/billing/notification/plugin/api/InvoiceNotificationMetadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2018 Groupon, Inc 3 | * Copyright 2014-2018 The Billing Project, LLC 4 | * 5 | * The Billing Project licenses this file to you under the Apache License, version 2.0 6 | * (the "License"); you may not use this file except in compliance with the 7 | * License. You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | package org.killbill.billing.notification.plugin.api; 19 | 20 | import java.math.BigDecimal; 21 | 22 | import org.joda.time.DateTime; 23 | import org.killbill.billing.catalog.api.Currency; 24 | 25 | import com.fasterxml.jackson.annotation.JsonCreator; 26 | import com.fasterxml.jackson.annotation.JsonProperty; 27 | 28 | public class InvoiceNotificationMetadata { 29 | 30 | private final DateTime targetDate; 31 | private final BigDecimal amountOwed; 32 | private final Currency currency; 33 | 34 | @JsonCreator 35 | public InvoiceNotificationMetadata(@JsonProperty("targetDate") final DateTime targetDate, 36 | @JsonProperty("amountOwed") final BigDecimal amountOwed, 37 | @JsonProperty("currency") final Currency currency) { 38 | this.targetDate = targetDate; 39 | this.amountOwed = amountOwed; 40 | this.currency = currency; 41 | } 42 | 43 | public DateTime getTargetDate() { 44 | return targetDate; 45 | } 46 | 47 | public BigDecimal getAmountOwed() { 48 | return amountOwed; 49 | } 50 | 51 | public Currency getCurrency() { 52 | return currency; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /notification/src/main/java/org/killbill/billing/notification/plugin/api/InvoicePaymentMetadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2017 Groupon, Inc 3 | * Copyright 2014-2017 The Billing Project, LLC 4 | * 5 | * The Billing Project licenses this file to you under the Apache License, version 2.0 6 | * (the "License"); you may not use this file except in compliance with the 7 | * License. You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | package org.killbill.billing.notification.plugin.api; 19 | 20 | import java.math.BigDecimal; 21 | import java.util.UUID; 22 | 23 | import org.joda.time.DateTime; 24 | import org.killbill.billing.catalog.api.Currency; 25 | import org.killbill.billing.invoice.api.InvoicePaymentType; 26 | 27 | import com.fasterxml.jackson.annotation.JsonProperty; 28 | 29 | public class InvoicePaymentMetadata { 30 | 31 | private UUID paymentId; 32 | private UUID paymentAttemptId; 33 | private InvoicePaymentType invoicePaymentType; 34 | private DateTime paymentDate; 35 | private BigDecimal amount; 36 | private Currency currency; 37 | private UUID linkedInvoicePaymentId; 38 | private String paymentCookieId; 39 | private Currency processedCurrency; 40 | 41 | /** 42 | * This is needed for object deserialization. 43 | */ 44 | public InvoicePaymentMetadata() {} 45 | 46 | public InvoicePaymentMetadata(@JsonProperty("paymentId") final UUID paymentId, 47 | @JsonProperty("paymentAttemptId") final UUID paymentAttemptId, 48 | @JsonProperty("invoicePaymentType") final InvoicePaymentType invoicePaymentType, 49 | @JsonProperty("paymentDate") final DateTime paymentDate, 50 | @JsonProperty("amount") final BigDecimal amount, 51 | @JsonProperty("currency") final Currency currency, 52 | @JsonProperty("linkedInvoicePaymentId") final UUID linkedInvoicePaymentId, 53 | @JsonProperty("paymentCookieId") final String paymentCookieId, 54 | @JsonProperty("processedCurrency") final Currency processedCurrency) { 55 | this.paymentId = paymentId; 56 | this.paymentAttemptId = paymentAttemptId; 57 | this.invoicePaymentType = invoicePaymentType; 58 | this.paymentDate = paymentDate; 59 | this.amount = amount; 60 | this.currency = currency; 61 | this.linkedInvoicePaymentId = linkedInvoicePaymentId; 62 | this.paymentCookieId = paymentCookieId; 63 | this.processedCurrency = processedCurrency; 64 | } 65 | 66 | public UUID getPaymentId() { 67 | return paymentId; 68 | } 69 | 70 | public UUID getPaymentAttemptId() { 71 | return paymentAttemptId; 72 | } 73 | 74 | public InvoicePaymentType getInvoicePaymentType() { 75 | return invoicePaymentType; 76 | } 77 | 78 | public DateTime getPaymentDate() { 79 | return paymentDate; 80 | } 81 | 82 | public BigDecimal getAmount() { 83 | return amount; 84 | } 85 | 86 | public Currency getCurrency() { 87 | return currency; 88 | } 89 | 90 | public UUID getLinkedInvoicePaymentId() { 91 | return linkedInvoicePaymentId; 92 | } 93 | 94 | public String getPaymentCookieId() { 95 | return paymentCookieId; 96 | } 97 | 98 | public Currency getProcessedCurrency() { 99 | return processedCurrency; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /notification/src/main/java/org/killbill/billing/notification/plugin/api/NotificationPluginApi.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.killbill.billing.notification.plugin.api; 18 | 19 | public interface NotificationPluginApi { 20 | 21 | /** 22 | * Dispatching of external Killbill events for notification plugins 23 | * 24 | * @param killbillEvent the killbill event 25 | */ 26 | public void onEvent(ExtBusEvent killbillEvent); 27 | } 28 | -------------------------------------------------------------------------------- /notification/src/main/java/org/killbill/billing/notification/plugin/api/NotificationPluginApiRetryException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2017 Groupon, Inc 3 | * Copyright 2014-2017 The Billing Project, LLC 4 | * 5 | * The Billing Project licenses this file to you under the Apache License, version 2.0 6 | * (the "License"); you may not use this file except in compliance with the 7 | * License. You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | package org.killbill.billing.notification.plugin.api; 19 | 20 | import java.util.List; 21 | 22 | import org.joda.time.Period; 23 | import org.killbill.billing.util.queue.QueueRetryException; 24 | 25 | public class NotificationPluginApiRetryException extends QueueRetryException { 26 | 27 | public NotificationPluginApiRetryException() { 28 | } 29 | 30 | public NotificationPluginApiRetryException(final Exception e) { 31 | super(e); 32 | } 33 | 34 | public NotificationPluginApiRetryException(final List retrySchedule) { 35 | super(retrySchedule); 36 | } 37 | 38 | public NotificationPluginApiRetryException(final Exception e, final List retrySchedule) { 39 | super(e, retrySchedule); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /notification/src/main/java/org/killbill/billing/notification/plugin/api/PaymentMetadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Groupon, Inc 3 | * Copyright 2016 The Billing Project, LLC 4 | * 5 | * The Billing Project licenses this file to you under the Apache License, version 2.0 6 | * (the "License"); you may not use this file except in compliance with the 7 | * License. You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | package org.killbill.billing.notification.plugin.api; 19 | 20 | import java.math.BigDecimal; 21 | import java.util.UUID; 22 | 23 | import org.joda.time.DateTime; 24 | import org.killbill.billing.catalog.api.Currency; 25 | import org.killbill.billing.payment.api.TransactionStatus; 26 | import org.killbill.billing.payment.api.TransactionType; 27 | 28 | import com.fasterxml.jackson.annotation.JsonCreator; 29 | import com.fasterxml.jackson.annotation.JsonProperty; 30 | 31 | public class PaymentMetadata { 32 | 33 | private UUID paymentTransactionId; 34 | private BigDecimal amount; 35 | private Currency currency; 36 | private TransactionStatus status; 37 | private TransactionType transactionType; 38 | private DateTime effectiveDate; 39 | 40 | public PaymentMetadata() {} 41 | 42 | @JsonCreator 43 | public PaymentMetadata(@JsonProperty("paymentTransactionId") final UUID paymentTransactionId, 44 | @JsonProperty("amount") final BigDecimal amount, 45 | @JsonProperty("currency") final Currency currency, 46 | @JsonProperty("status") final TransactionStatus status, 47 | @JsonProperty("transactionType") final TransactionType transactionType, 48 | @JsonProperty("effectiveDate") final DateTime effectiveDate) { 49 | this.paymentTransactionId = paymentTransactionId; 50 | this.amount = amount; 51 | this.currency = currency; 52 | this.status = status; 53 | this.transactionType = transactionType; 54 | this.effectiveDate = effectiveDate; 55 | } 56 | 57 | public UUID getPaymentTransactionId() { 58 | return paymentTransactionId; 59 | } 60 | 61 | public BigDecimal getAmount() { 62 | return amount; 63 | } 64 | 65 | public Currency getCurrency() { 66 | return currency; 67 | } 68 | 69 | public TransactionStatus getStatus() { 70 | return status; 71 | } 72 | 73 | public TransactionType getTransactionType() { 74 | return transactionType; 75 | } 76 | 77 | public DateTime getEffectiveDate() { 78 | return effectiveDate; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /notification/src/main/java/org/killbill/billing/notification/plugin/api/SubscriptionMetadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * Copyright 2016 Groupon, Inc 4 | * Copyright 2016 The Billing Project, LLC 5 | * 6 | * The Billing Project licenses this file to you under the Apache License, version 2.0 7 | * (the "License"); you may not use this file except in compliance with the 8 | * License. You may obtain a copy of the License at: 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | * License for the specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package org.killbill.billing.notification.plugin.api; 20 | 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | public class SubscriptionMetadata { 24 | 25 | public enum ActionType { 26 | EFFECTIVE, 27 | REQUESTED 28 | }; 29 | 30 | private ActionType actionType; 31 | private String bundleExternalKey; 32 | private boolean subscriptionChangeUndo; 33 | 34 | /** 35 | * This is needed for object deserialization. 36 | */ 37 | public SubscriptionMetadata() {} 38 | 39 | public SubscriptionMetadata(@JsonProperty("actionType") final ActionType actionType, 40 | @JsonProperty("bundleExternalKey") final String bundleExternalKey, 41 | @JsonProperty("subscriptionChangeUndo") final boolean subscriptionChangeUndo) { 42 | this.actionType = actionType; 43 | this.bundleExternalKey = bundleExternalKey; 44 | this.subscriptionChangeUndo = subscriptionChangeUndo; 45 | } 46 | 47 | public ActionType getActionType() { 48 | return actionType; 49 | } 50 | 51 | public String getBundleExternalKey() { 52 | return bundleExternalKey; 53 | } 54 | 55 | public boolean getSubscriptionChangeUndo() { 56 | return subscriptionChangeUndo; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /notification/src/main/java/org/killbill/billing/notification/plugin/api/TagMetadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Equinix, Inc 3 | * Copyright 2022 The Billing Project, LLC 4 | * 5 | * The Billing Project licenses this file to you under the Apache License, version 2.0 6 | * (the "License"); you may not use this file except in compliance with the 7 | * License. You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | package org.killbill.billing.notification.plugin.api; 19 | 20 | import com.fasterxml.jackson.annotation.JsonCreator; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | public class TagMetadata { 24 | 25 | private String tagDefinitionName; 26 | 27 | public TagMetadata() {} 28 | 29 | @JsonCreator 30 | public TagMetadata(@JsonProperty("tagDefinitionName") final String tagDefinitionName) { 31 | this.tagDefinitionName = tagDefinitionName; 32 | } 33 | 34 | public String getTagDefinitionName() { 35 | return tagDefinitionName; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /notification/src/main/java/org/killbill/billing/notification/plugin/api/TenantConfigMetadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Equinix, Inc 3 | * Copyright 2022 The Billing Project, LLC 4 | * 5 | * The Billing Project licenses this file to you under the Apache License, version 2.0 6 | * (the "License"); you may not use this file except in compliance with the 7 | * License. You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | package org.killbill.billing.notification.plugin.api; 19 | 20 | import com.fasterxml.jackson.annotation.JsonCreator; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | public class TenantConfigMetadata { 24 | 25 | private String key; 26 | 27 | public TenantConfigMetadata() {} 28 | 29 | @JsonCreator 30 | public TenantConfigMetadata(@JsonProperty("key") final String key) { 31 | this.key = key; 32 | } 33 | 34 | public String getKey() { 35 | return key; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /payment/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 4.0.0 21 | 22 | org.kill-bill.billing.plugin 23 | killbill-plugin-api 24 | 0.27.4-SNAPSHOT 25 | ../pom.xml 26 | 27 | killbill-plugin-api-payment 28 | Kill Bill payment plugin apis 29 | 30 | 31 | org.kill-bill.billing 32 | killbill-api 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /payment/src/main/java/org/killbill/billing/payment/plugin/api/PaymentMethodInfoPlugin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.killbill.billing.payment.plugin.api; 18 | 19 | import java.util.UUID; 20 | 21 | /** 22 | * Returns the plugin view of existing payment methods 23 | */ 24 | public interface PaymentMethodInfoPlugin { 25 | 26 | /** 27 | * @return the Killbill accountId 28 | */ 29 | public UUID getAccountId(); 30 | 31 | /** 32 | * @return the killbillPaymentMethodId 33 | */ 34 | public UUID getPaymentMethodId(); 35 | 36 | /** 37 | * @return default payment method set on the gateway 38 | */ 39 | public boolean isDefault(); 40 | 41 | /** 42 | * @return the external paymentMethodId on the gateway 43 | */ 44 | public String getExternalPaymentMethodId(); 45 | } 46 | -------------------------------------------------------------------------------- /payment/src/main/java/org/killbill/billing/payment/plugin/api/PaymentPluginApi.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * Copyright 2014 Groupon, Inc 4 | * Copyright 2014 The Billing Project, LLC 5 | * 6 | * The Billing Project licenses this file to you under the Apache License, version 2.0 7 | * (the "License"); you may not use this file except in compliance with the 8 | * License. You may obtain a copy of the License at: 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | * License for the specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package org.killbill.billing.payment.plugin.api; 20 | 21 | import java.math.BigDecimal; 22 | import java.util.List; 23 | import java.util.UUID; 24 | 25 | import org.killbill.billing.catalog.api.Currency; 26 | import org.killbill.billing.payment.api.PaymentMethodPlugin; 27 | import org.killbill.billing.payment.api.PluginProperty; 28 | import org.killbill.billing.util.callcontext.CallContext; 29 | import org.killbill.billing.util.callcontext.TenantContext; 30 | import org.killbill.billing.util.entity.Pagination; 31 | 32 | public interface PaymentPluginApi { 33 | 34 | /** 35 | * Authorize a specific amount in the Gateway. 36 | * 37 | * @param kbAccountId killbill accountId 38 | * @param kbPaymentId killbill payment id 39 | * @param kbTransactionId killbill transaction id 40 | * @param kbPaymentMethodId killbill payment method id 41 | * @param amount amount to charge 42 | * @param currency currency 43 | * @param properties custom properties for the gateway 44 | * @param context call context 45 | * @return information about the authorization in the gateway 46 | * @throws PaymentPluginApiException If any unexpected error occurs 47 | */ 48 | public PaymentTransactionInfoPlugin authorizePayment(UUID kbAccountId, UUID kbPaymentId, UUID kbTransactionId, UUID kbPaymentMethodId, BigDecimal amount, Currency currency, Iterable properties, CallContext context) 49 | throws PaymentPluginApiException; 50 | 51 | /** 52 | * Capture a specific amount in the Gateway. 53 | * 54 | * @param kbAccountId killbill accountId 55 | * @param kbPaymentId killbill payment id 56 | * @param kbTransactionId killbill transaction id 57 | * @param kbPaymentMethodId killbill payment method id 58 | * @param amount amount to charge 59 | * @param currency currency 60 | * @param properties custom properties for the gateway 61 | * @param context call context 62 | * @return information about the capture in the gateway 63 | * @throws PaymentPluginApiException If any unexpected error occurs 64 | */ 65 | public PaymentTransactionInfoPlugin capturePayment(UUID kbAccountId, UUID kbPaymentId, UUID kbTransactionId, UUID kbPaymentMethodId, BigDecimal amount, Currency currency, Iterable properties, CallContext context) 66 | throws PaymentPluginApiException; 67 | 68 | /** 69 | * Charge a specific amount in the Gateway. 70 | * 71 | * @param kbAccountId killbill accountId 72 | * @param kbPaymentId killbill payment id 73 | * @param kbTransactionId killbill transaction id 74 | * @param kbPaymentMethodId killbill payment method id 75 | * @param amount amount to charge 76 | * @param currency currency 77 | * @param properties custom properties for the gateway 78 | * @param context call context 79 | * @return information about the payment in the gateway 80 | * @throws PaymentPluginApiException If any unexpected error occurs 81 | */ 82 | public PaymentTransactionInfoPlugin purchasePayment(UUID kbAccountId, UUID kbPaymentId, UUID kbTransactionId, UUID kbPaymentMethodId, BigDecimal amount, Currency currency, Iterable properties, CallContext context) 83 | throws PaymentPluginApiException; 84 | 85 | /** 86 | * Void an authorization in the Gateway. 87 | * 88 | * @param kbAccountId killbill accountId 89 | * @param kbPaymentId killbill payment id 90 | * @param kbTransactionId killbill transaction id 91 | * @param kbPaymentMethodId killbill payment method id 92 | * @param properties custom properties for the gateway 93 | * @param context call context 94 | * @return information about the capture in the gateway 95 | * @throws PaymentPluginApiException If any unexpected error occurs 96 | */ 97 | public PaymentTransactionInfoPlugin voidPayment(UUID kbAccountId, UUID kbPaymentId, UUID kbTransactionId, UUID kbPaymentMethodId, Iterable properties, CallContext context) 98 | throws PaymentPluginApiException; 99 | 100 | /** 101 | * Credit a specific amount in the Gateway. 102 | * 103 | * @param kbAccountId killbill accountId 104 | * @param kbPaymentId killbill payment id 105 | * @param kbTransactionId killbill transaction id 106 | * @param kbPaymentMethodId killbill payment method id 107 | * @param amount amount to credit 108 | * @param currency currency 109 | * @param properties custom properties for the gateway 110 | * @param context call context 111 | * @return information about the credit in the gateway 112 | * @throws PaymentPluginApiException If any unexpected error occurs 113 | */ 114 | public PaymentTransactionInfoPlugin creditPayment(UUID kbAccountId, UUID kbPaymentId, UUID kbTransactionId, UUID kbPaymentMethodId, BigDecimal amount, Currency currency, Iterable properties, CallContext context) 115 | throws PaymentPluginApiException; 116 | 117 | /** 118 | * Process a refund against a given payment. 119 | * 120 | * @param kbAccountId killbill accountId 121 | * @param kbPaymentId killbill payment id 122 | * @param kbTransactionId killbill transaction id 123 | * @param kbPaymentMethodId killbill payment method id 124 | * @param amount refund amount 125 | * @param currency currency 126 | * @param properties custom properties for the gateway 127 | * @param context call context 128 | * @return information about the refund in the gateway 129 | * @throws PaymentPluginApiException If any unexpected error occurs 130 | */ 131 | public PaymentTransactionInfoPlugin refundPayment(UUID kbAccountId, UUID kbPaymentId, UUID kbTransactionId, UUID kbPaymentMethodId, BigDecimal amount, Currency currency, Iterable properties, CallContext context) 132 | throws PaymentPluginApiException; 133 | 134 | /** 135 | * Retrieve information about a given payment. 136 | * 137 | * @param kbAccountId killbill accountId 138 | * @param kbPaymentId killbill payment id 139 | * @param properties custom properties for the gateway 140 | * @param context call context 141 | * @return information about the payment in the gateway 142 | * @throws PaymentPluginApiException If any unexpected error occurs 143 | */ 144 | public List getPaymentInfo(UUID kbAccountId, UUID kbPaymentId, Iterable properties, TenantContext context) 145 | throws PaymentPluginApiException; 146 | 147 | /** 148 | * Search payments. 149 | *

150 | * The search is plugin specific, there is no constraint on how the searchKey should be interpreted. 151 | * 152 | * @param offset the offset of the first result 153 | * @param limit the maximum number of results to retrieve 154 | * @param properties custom properties for the gateway 155 | * @param context call context 156 | * @return payments matching the search key 157 | * @throws PaymentPluginApiException If any unexpected error occurs 158 | */ 159 | public Pagination searchPayments(String searchKey, Long offset, Long limit, Iterable properties, TenantContext context) 160 | throws PaymentPluginApiException; 161 | 162 | /** 163 | * Add a payment method for a Killbill account in the gateway. 164 | *

165 | * Note: the payment method doesn't exist yet in Killbill when receiving the call in 166 | * the plugin (kbPaymentMethodId is a placeholder). 167 | * 168 | * @param kbAccountId killbill accountId 169 | * @param paymentMethodProps payment method details 170 | * @param setDefault set it as the default payment method in the gateway 171 | * @param properties custom properties for the gateway 172 | * @param context call context 173 | * @throws PaymentPluginApiException If any unexpected error occurs 174 | */ 175 | public void addPaymentMethod(UUID kbAccountId, UUID kbPaymentMethodId, PaymentMethodPlugin paymentMethodProps, boolean setDefault, Iterable properties, CallContext context) 176 | throws PaymentPluginApiException; 177 | 178 | /** 179 | * Delete a payment method in the gateway. 180 | * 181 | * @param kbAccountId killbill accountId 182 | * @param kbPaymentMethodId killbill payment method id 183 | * @param properties custom properties for the gateway 184 | * @param context call context 185 | * @throws PaymentPluginApiException If any unexpected error occurs 186 | */ 187 | public void deletePaymentMethod(UUID kbAccountId, UUID kbPaymentMethodId, Iterable properties, CallContext context) 188 | throws PaymentPluginApiException; 189 | 190 | /** 191 | * Get payment method details for a given payment method. 192 | * 193 | * @param kbAccountId killbill account id 194 | * @param kbPaymentMethodId killbill payment method id 195 | * @param properties custom properties for the gateway 196 | * @param context call context 197 | * @return PaymentMethodPlugin info for the payment method 198 | * @throws PaymentPluginApiException If any unexpected error occurs 199 | */ 200 | public PaymentMethodPlugin getPaymentMethodDetail(UUID kbAccountId, UUID kbPaymentMethodId, Iterable properties, TenantContext context) 201 | throws PaymentPluginApiException; 202 | 203 | /** 204 | * Set a payment method as default in the gateway. 205 | * 206 | * @param kbAccountId killbill accountId 207 | * @param kbPaymentMethodId killbill payment method id 208 | * @param properties custom properties for the gateway 209 | * @param context call context 210 | * @throws PaymentPluginApiException If any unexpected error occurs 211 | */ 212 | public void setDefaultPaymentMethod(UUID kbAccountId, UUID kbPaymentMethodId, Iterable properties, CallContext context) 213 | throws PaymentPluginApiException; 214 | 215 | /** 216 | * This is used to see the view of paymentMethods kept by the plugin or the view of 217 | * existing payment method on the gateway. 218 | *

219 | * Sometimes payment methods have to be added directly to the gateway for PCI compliance issues 220 | * and so Kill Bill needs to refresh its state. 221 | * 222 | * @param kbAccountId killbill accountId 223 | * @param refreshFromGateway fetch the list of existing payment methods from gateway -- if supported 224 | * @param properties custom properties for the gateway 225 | * @param context call context 226 | * @return all payment methods for that account 227 | * @throws PaymentPluginApiException If any unexpected error occurs 228 | */ 229 | public List getPaymentMethods(UUID kbAccountId, boolean refreshFromGateway, Iterable properties, CallContext context) 230 | throws PaymentPluginApiException; 231 | 232 | /** 233 | * Search payment methods 234 | *

235 | * The search is plugin specific, there is no constraint on how the searchKey should be interpreted. 236 | * 237 | * @param offset the offset of the first result 238 | * @param limit the maximum number of results to retrieve 239 | * @param properties custom properties for the gateway 240 | * @param context call context 241 | * @return payment methods matching the search key 242 | * @throws PaymentPluginApiException If any unexpected error occurs 243 | */ 244 | public Pagination searchPaymentMethods(String searchKey, Long offset, Long limit, Iterable properties, TenantContext context) 245 | throws PaymentPluginApiException; 246 | 247 | /** 248 | * This is used after Killbill decided to refresh its state from the gateway 249 | * 250 | * @param kbAccountId killbill accountId 251 | * @param paymentMethods the list of payment methods 252 | * @param properties custom properties for the gateway 253 | * @param context call context 254 | * @throws PaymentPluginApiException If any unexpected error occurs 255 | */ 256 | public void resetPaymentMethods(UUID kbAccountId, List paymentMethods, Iterable properties, CallContext context) 257 | throws PaymentPluginApiException; 258 | 259 | /** 260 | * Build metadata for the client to create a redirect form 261 | * 262 | * @param kbAccountId killbill accountId 263 | * @param customFields form fields 264 | * @param properties custom properties for the gateway 265 | * @param context call context 266 | * @return redirect form metadata 267 | * @throws PaymentPluginApiException If any unexpected error occurs 268 | */ 269 | public HostedPaymentPageFormDescriptor buildFormDescriptor(UUID kbAccountId, Iterable customFields, Iterable properties, CallContext context) 270 | throws PaymentPluginApiException; 271 | 272 | /** 273 | * Process a notification from the gateway 274 | *

275 | * This potentially does more than just deserialize the payload. The plugin may have to acknowledge it 276 | * with the gateway. 277 | * 278 | * @param notification serialized notification object 279 | * @param properties custom properties for the gateway 280 | * @param context call context 281 | * @return gateway notification object used to build the response to the gateway 282 | * @throws PaymentPluginApiException If any unexpected error occurs 283 | */ 284 | public GatewayNotification processNotification(String notification, Iterable properties, CallContext context) 285 | throws PaymentPluginApiException; 286 | } 287 | -------------------------------------------------------------------------------- /payment/src/main/java/org/killbill/billing/payment/plugin/api/PaymentPluginApiException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.killbill.billing.payment.plugin.api; 18 | 19 | import org.killbill.billing.BillingExceptionBase; 20 | 21 | public class PaymentPluginApiException extends Exception { 22 | 23 | private static final long serialVersionUID = 15642965L; 24 | 25 | private final String errorType; 26 | private final String errorMessage; 27 | 28 | public PaymentPluginApiException(final String msg, final Throwable e) { 29 | super(msg, e); 30 | errorMessage = msg; 31 | errorType = e.getMessage(); 32 | } 33 | 34 | public PaymentPluginApiException(final String errorType, final String errorMessage) { 35 | this.errorMessage = errorMessage; 36 | this.errorType = errorType; 37 | } 38 | 39 | public PaymentPluginApiException(final String errorType, BillingExceptionBase billingExceptionBase) { 40 | this.errorMessage = billingExceptionBase.getMessage(); 41 | this.errorType = errorType; 42 | } 43 | 44 | public String getErrorType() { 45 | return errorType; 46 | } 47 | 48 | public String getErrorMessage() { 49 | return errorMessage; 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | final StringBuilder sb = new StringBuilder(); 55 | sb.append("PaymentPluginApiException"); 56 | if (errorMessage != null) { 57 | sb.append("{errorMessage='").append(errorMessage).append('\''); 58 | } 59 | if (errorType != null) { 60 | sb.append(", errorType='").append(errorType).append('\''); 61 | } 62 | sb.append('}'); 63 | return sb.toString(); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 4.0.0 21 | 22 | org.kill-bill.billing 23 | killbill-oss-parent 24 | 0.146.27 25 | 26 | org.kill-bill.billing.plugin 27 | killbill-plugin-api 28 | 0.27.4-SNAPSHOT 29 | pom 30 | Kill Bill plugin apis 31 | Kill Bill plugin apis 32 | http://github.com/killbill/killbill-plugin-api 33 | 34 | 35 | notification 36 | payment 37 | currency 38 | control 39 | invoice 40 | catalog 41 | entitlement 42 | usage 43 | 44 | 45 | scm:git:git://github.com/killbill/killbill-plugin-api.git 46 | scm:git:git@github.com:killbill/killbill-plugin-api.git 47 | HEAD 48 | http://github.com/killbill/killbill-plugin-api/tree/master 49 | 50 | 51 | Github 52 | https://github.com/killbill/killbill-plugin-api/issues 53 | 54 | 55 | true 56 | 57 | 58 | -------------------------------------------------------------------------------- /release.sh: -------------------------------------------------------------------------------- 1 | ################################################################################### 2 | # # 3 | # Copyright 2010-2014 Ning, Inc. # 4 | # # 5 | # Ning licenses this file to you under the Apache License, version 2.0 # 6 | # (the "License"); you may not use this file except in compliance with the # 7 | # License. You may obtain a copy of the License at: # 8 | # # 9 | # http://www.apache.org/licenses/LICENSE-2.0 # 10 | # # 11 | # Unless required by applicable law or agreed to in writing, software # 12 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # 13 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # 14 | # License for the specific language governing permissions and limitations # 15 | # under the License. # 16 | # # 17 | ################################################################################### 18 | # Prepare a release: 19 | # * Update the NEWS file 20 | # * Commit all pending changes 21 | # * Do the release 22 | set -e 23 | 24 | # Make sure we're up-to-date 25 | git pull 26 | 27 | LAST_NEWS_VERSION=$(head -1 NEWS) 28 | NEXT_VERSION=`grep -E '([0-9]+\.[0-9]+(\.[0-9]+)?)-SNAPSHOT' pom.xml | sed 's/[\t \n]*\(.*\)-SNAPSHOT<\/version>[\t \n]*/\1/'` 29 | 30 | echo "Enter the NEWS changelog for version $NEXT_VERSION and hit ctrl-d when done (ctrl-c to abort)" 31 | original_news_message=$(cat) 32 | 33 | # Indent it 34 | news_message=$(echo "$original_news_message" | sed 's/^/ /g') 35 | 36 | if [ "$LAST_NEWS_VERSION" = "$NEXT_VERSION" ]; then 37 | previous_news=$(cat NEWS | sed '1d') 38 | echo -e "$NEXT_VERSION\n$news_message\n$previous_news" > NEWS 39 | else 40 | previous_news=$(cat NEWS) 41 | echo -e "$NEXT_VERSION\n$news_message\n\n$previous_news" > NEWS 42 | fi 43 | 44 | # Add to git 45 | git add -p 46 | git commit -s -m "pom.xml: updates for release $NEXT_VERSION 47 | 48 | $original_news_message" 49 | 50 | # Make sure we can push before the release 51 | git push 52 | 53 | # Do the release 54 | echo "Running: mvn release:clean" && \ 55 | mvn release:clean && \ 56 | echo "Running: mvn release:prepare" && \ 57 | mvn release:prepare && \ 58 | echo "Running: mvn release:perform" && \ 59 | mvn release:perform 60 | -------------------------------------------------------------------------------- /usage/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 4.0.0 20 | 21 | org.kill-bill.billing.plugin 22 | killbill-plugin-api 23 | 0.27.4-SNAPSHOT 24 | 25 | killbill-plugin-api-usage 26 | Kill Bill usage plugin apis 27 | 28 | 29 | joda-time 30 | joda-time 31 | 32 | 33 | org.kill-bill.billing 34 | killbill-api 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /usage/src/main/java/org/killbill/billing/usage/plugin/api/UsageContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020-2022 Equinix, Inc 3 | * Copyright 2014-2022 The Billing Project, LLC 4 | * 5 | * The Billing Project licenses this file to you under the Apache License, version 2.0 6 | * (the "License"); you may not use this file except in compliance with the 7 | * License. You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | package org.killbill.billing.usage.plugin.api; 19 | 20 | import org.joda.time.LocalDate; 21 | import org.killbill.billing.invoice.api.DryRunType; 22 | import org.killbill.billing.util.callcontext.TenantContext; 23 | 24 | public interface UsageContext extends TenantContext { 25 | 26 | // Specify the type of dry-run operation or null otherwise 27 | DryRunType getDryRunType(); 28 | // Specify targetDate Associated with the invoice run 29 | LocalDate getInputTargetDate(); 30 | } 31 | -------------------------------------------------------------------------------- /usage/src/main/java/org/killbill/billing/usage/plugin/api/UsagePluginApi.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2019 Groupon, Inc 3 | * Copyright 2014-2019 The Billing Project, LLC 4 | * 5 | * The Billing Project licenses this file to you under the Apache License, version 2.0 6 | * (the "License"); you may not use this file except in compliance with the 7 | * License. You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | package org.killbill.billing.usage.plugin.api; 19 | 20 | import java.util.List; 21 | import java.util.UUID; 22 | 23 | import org.joda.time.DateTime; 24 | import org.killbill.billing.payment.api.PluginProperty; 25 | import org.killbill.billing.usage.api.RawUsageRecord; 26 | 27 | public interface UsagePluginApi { 28 | 29 | List getUsageForAccount(DateTime startDate, DateTime endDate, UsageContext context, Iterable properties); 30 | 31 | List getUsageForSubscription(UUID subscriptionId, DateTime startDate, DateTime endDate, UsageContext context, Iterable properties); 32 | } 33 | --------------------------------------------------------------------------------