-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #454 from Sachin-Mamoru/petdesk-billing
[PetDesk App] Add ACR based step up authentication for billing api
- Loading branch information
Showing
24 changed files
with
1,080 additions
and
798 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...e-sample/b2c/web-app/petdesk/apis/ballerina/billing-management-service/.devcontainer.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"image": "ballerina/ballerina-devcontainer:2201.3.2", | ||
"extensions": ["WSO2.ballerina"], | ||
} |
1 change: 1 addition & 0 deletions
1
petcare-sample/b2c/web-app/petdesk/apis/ballerina/billing-management-service/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
target |
8 changes: 8 additions & 0 deletions
8
petcare-sample/b2c/web-app/petdesk/apis/ballerina/billing-management-service/Ballerina.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[package] | ||
org = "sachinm" | ||
name = "billing_management_service" | ||
version = "0.1.0" | ||
distribution = "2201.3.2" | ||
|
||
[build-options] | ||
observabilityIncluded = true |
307 changes: 307 additions & 0 deletions
307
...re-sample/b2c/web-app/petdesk/apis/ballerina/billing-management-service/Dependencies.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,307 @@ | ||
# AUTO-GENERATED FILE. DO NOT MODIFY. | ||
|
||
# This file is auto-generated by Ballerina for managing dependency versions. | ||
# It should not be modified by hand. | ||
|
||
[ballerina] | ||
dependencies-toml-version = "2" | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "auth" | ||
version = "2.5.0" | ||
dependencies = [ | ||
{org = "ballerina", name = "crypto"}, | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "lang.array"}, | ||
{org = "ballerina", name = "lang.string"}, | ||
{org = "ballerina", name = "log"}, | ||
{org = "ballerina", name = "regex"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "cache" | ||
version = "3.3.0" | ||
dependencies = [ | ||
{org = "ballerina", name = "constraint"}, | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "task"}, | ||
{org = "ballerina", name = "time"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "constraint" | ||
version = "1.0.2" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "crypto" | ||
version = "2.3.2" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "time"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "file" | ||
version = "1.5.0" | ||
dependencies = [ | ||
{org = "ballerina", name = "io"}, | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "log"}, | ||
{org = "ballerina", name = "os"}, | ||
{org = "ballerina", name = "regex"}, | ||
{org = "ballerina", name = "time"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "http" | ||
version = "2.5.4" | ||
dependencies = [ | ||
{org = "ballerina", name = "auth"}, | ||
{org = "ballerina", name = "cache"}, | ||
{org = "ballerina", name = "constraint"}, | ||
{org = "ballerina", name = "crypto"}, | ||
{org = "ballerina", name = "file"}, | ||
{org = "ballerina", name = "io"}, | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "jwt"}, | ||
{org = "ballerina", name = "lang.array"}, | ||
{org = "ballerina", name = "lang.decimal"}, | ||
{org = "ballerina", name = "lang.int"}, | ||
{org = "ballerina", name = "lang.runtime"}, | ||
{org = "ballerina", name = "lang.string"}, | ||
{org = "ballerina", name = "lang.value"}, | ||
{org = "ballerina", name = "log"}, | ||
{org = "ballerina", name = "mime"}, | ||
{org = "ballerina", name = "oauth2"}, | ||
{org = "ballerina", name = "observe"}, | ||
{org = "ballerina", name = "regex"}, | ||
{org = "ballerina", name = "time"}, | ||
{org = "ballerina", name = "url"} | ||
] | ||
modules = [ | ||
{org = "ballerina", packageName = "http", moduleName = "http"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "io" | ||
version = "1.3.1" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "lang.value"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "jballerina.java" | ||
version = "0.0.0" | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "jwt" | ||
version = "2.5.0" | ||
dependencies = [ | ||
{org = "ballerina", name = "cache"}, | ||
{org = "ballerina", name = "crypto"}, | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "lang.int"}, | ||
{org = "ballerina", name = "lang.string"}, | ||
{org = "ballerina", name = "log"}, | ||
{org = "ballerina", name = "regex"}, | ||
{org = "ballerina", name = "time"} | ||
] | ||
modules = [ | ||
{org = "ballerina", packageName = "jwt", moduleName = "jwt"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "lang.__internal" | ||
version = "0.0.0" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "lang.object"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "lang.array" | ||
version = "0.0.0" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "lang.__internal"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "lang.decimal" | ||
version = "0.0.0" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "lang.int" | ||
version = "0.0.0" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "lang.object" | ||
version = "0.0.0" | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "lang.regexp" | ||
version = "0.0.0" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "lang.runtime" | ||
version = "0.0.0" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "lang.string" | ||
version = "0.0.0" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "lang.regexp"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "lang.value" | ||
version = "0.0.0" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "log" | ||
version = "2.5.1" | ||
dependencies = [ | ||
{org = "ballerina", name = "io"}, | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "lang.value"}, | ||
{org = "ballerina", name = "observe"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "mime" | ||
version = "2.5.1" | ||
dependencies = [ | ||
{org = "ballerina", name = "io"}, | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "lang.int"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "oauth2" | ||
version = "2.5.0" | ||
dependencies = [ | ||
{org = "ballerina", name = "cache"}, | ||
{org = "ballerina", name = "crypto"}, | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "log"}, | ||
{org = "ballerina", name = "time"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "observe" | ||
version = "1.0.6" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "os" | ||
version = "1.5.0" | ||
dependencies = [ | ||
{org = "ballerina", name = "io"}, | ||
{org = "ballerina", name = "jballerina.java"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "regex" | ||
version = "1.3.2" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "lang.string"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "task" | ||
version = "2.3.2" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "time"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "time" | ||
version = "2.2.5" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "url" | ||
version = "2.2.4" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerinai" | ||
name = "observe" | ||
version = "0.0.0" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "observe"} | ||
] | ||
modules = [ | ||
{org = "ballerinai", packageName = "observe", moduleName = "observe"} | ||
] | ||
|
||
[[package]] | ||
org = "sachinm" | ||
name = "billing_management_service" | ||
version = "0.1.0" | ||
dependencies = [ | ||
{org = "ballerina", name = "http"}, | ||
{org = "ballerina", name = "jwt"}, | ||
{org = "ballerinai", name = "observe"} | ||
] | ||
modules = [ | ||
{org = "sachinm", packageName = "billing_management_service", moduleName = "billing_management_service"} | ||
] | ||
|
||
|
35 changes: 35 additions & 0 deletions
35
...sample/b2c/web-app/petdesk/apis/ballerina/billing-management-service/billing_mgt_impl.bal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
table<Billing> key(owner) billingRecords = table []; | ||
|
||
function addBilling(BillingInfo billingInfo, string owner) returns Billing|error { | ||
|
||
billingRecords.put({owner: owner, cardName: billingInfo.cardName, | ||
cardNumber: billingInfo.cardNumber, expiryDate: billingInfo.expiryDate, | ||
securityCode: billingInfo.securityCode}); | ||
Billing billingRecord = <Billing>billingRecords[owner]; | ||
Billing billing = getBillingDetails(billingRecord); | ||
return billing; | ||
} | ||
|
||
function getBillingByOwner(string owner) returns Billing|() { | ||
|
||
Billing? billingRecord = billingRecords[owner]; | ||
|
||
if billingRecord is () { | ||
return (); | ||
} | ||
|
||
return getBillingDetails(billingRecord); | ||
} | ||
|
||
function getBillingDetails(Billing billingRecord) returns Billing { | ||
|
||
Billing billing = { | ||
owner: billingRecord.owner, | ||
cardName: billingRecord.cardName, | ||
cardNumber: billingRecord.cardNumber, | ||
expiryDate: billingRecord.expiryDate, | ||
securityCode: billingRecord.securityCode | ||
}; | ||
|
||
return billing; | ||
} |
Oops, something went wrong.