Skip to content

Commit

Permalink
Merge branch 'develop' into feature/ocsgw-remove-analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
mpeterss committed Nov 11, 2019
2 parents 208634a + bda0d7f commit 7528412
Show file tree
Hide file tree
Showing 67 changed files with 633 additions and 1,291 deletions.
3 changes: 1 addition & 2 deletions .circleci/prime-canary-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ prime:
ACTIVATE_TOPIC_ID: ocs-activate
CCR_SUBSCRIPTION_ID: ocs-ccr-sub
GOOGLE_APPLICATION_CREDENTIALS: /secret/prime-service-account.json
MY_INFO_API_URI: https://myinfosg.api.gov.sg/v2
MY_INFO_API_REALM: prod
MY_INFO_V3_API_URI: https://api.myinfo.gov.sg/com/v3
MY_INFO_REDIRECT_URI: https://dl.oya.world/links/myinfo

secretVolumes:
Expand Down
2 changes: 0 additions & 2 deletions .circleci/prime-dev-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ prime:
ACTIVATE_TOPIC_ID: ocs-activate
CCR_SUBSCRIPTION_ID: ocs-ccr-sub
GOOGLE_APPLICATION_CREDENTIALS: /secret/prime-service-account.json
MY_INFO_V2_API_URI: https://myinfosgstg.api.gov.sg/test/v2
MY_INFO_V3_API_URI: https://test.api.myinfo.gov.sg/com/v3
MY_INFO_API_REALM: dev
MY_INFO_REDIRECT_URI: https://dl-dev.oya.world/links/myinfo

secretVolumes:
Expand Down
2 changes: 0 additions & 2 deletions .circleci/prime-prod-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ prime:
ACTIVATE_TOPIC_ID: ocs-activate
CCR_SUBSCRIPTION_ID: ocs-ccr-sub
GOOGLE_APPLICATION_CREDENTIALS: /secret/prime-service-account.json
MY_INFO_V2_API_URI: https://myinfosg.api.gov.sg/v2
MY_INFO_V3_API_URI: https://api.myinfo.gov.sg/com/v3
MY_INFO_API_REALM: prod
MY_INFO_REDIRECT_URI: https://dl.oya.world/links/myinfo

secretVolumes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fun enableRegion(email: String, region: String = "no") {
when (region) {
"sg" -> {
get<String> {
path = "/regions/sg/kyc/myInfo/activation-code"
path = "/regions/sg/kyc/myInfo/v3/personData/activation-code"
this.email = email
}
put<String>(expectedResultCode = 204) {
Expand Down
89 changes: 8 additions & 81 deletions acceptance-tests/src/main/kotlin/org/ostelco/at/jersey/Tests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import org.ostelco.prime.customer.model.PurchaseRecordList
import org.ostelco.prime.customer.model.Region
import org.ostelco.prime.customer.model.RegionDetails
import org.ostelco.prime.customer.model.RegionDetails.StatusEnum.APPROVED
import org.ostelco.prime.customer.model.RegionDetails.StatusEnum.PENDING
import org.ostelco.prime.customer.model.RegionDetails.StatusEnum.AVAILABLE
import org.ostelco.prime.customer.model.RegionDetails.StatusEnum.PENDING
import org.ostelco.prime.customer.model.RegionDetailsList
import org.ostelco.prime.customer.model.ScanInformation
import org.ostelco.prime.customer.model.SimProfile
Expand Down Expand Up @@ -228,6 +228,7 @@ class RegionsTest {
.region(Region().id("no").name("Norway"))
.status(APPROVED)
.kycStatusMap(mapOf(KycType.JUMIO.name to KycStatus.APPROVED))
.kycExpiryDateMap(emptyMap())
.simProfiles(SimProfileList())

assertEquals(regionDetails, noRegionDetails, "RegionDetails do not match")
Expand Down Expand Up @@ -1433,32 +1434,6 @@ class JumioKycTest {

class SingaporeKycTest {

@Test
fun `jersey test - GET myinfoConfig v2`() {

val email = "myinfo-v2-${randomInt()}@test.com"
var customerId = ""
try {

customerId = createCustomer(name = "Test MyInfoConfig v2 Customer", email = email).id

val myInfoConfig = get<MyInfoConfig> {
path = "/regions/sg/kyc/myInfoConfig"
this.email = email
}

assertEquals(
"http://ext-myinfo-emulator:8080/v2/authorise" +
"?client_id=STG2-MYINFO-SELF-TEST" +
"&attributes=name,sex,dob,residentialstatus,nationality,mobileno,email,mailadd" +
"&redirect_uri=http://localhost:3001/callback",
myInfoConfig.url)

} finally {
StripePayment.deleteCustomer(customerId = customerId)
}
}

@Test
fun `jersey test - GET myinfoConfig v3`() {

Expand All @@ -1485,60 +1460,6 @@ class SingaporeKycTest {
}
}

@Test
fun `jersey test - GET myinfo v2`() {

val email = "myinfo-v2-${randomInt()}@test.com"
var customerId = ""
try {

customerId = createCustomer(name = "Test MyInfo v2 Customer", email = email).id

run {
val regionDetailsList = get<RegionDetailsList> {
path = "/regions"
this.email = email
}
regionDetailsList.forEach {
assertTrue(it.status == AVAILABLE, "All regions should be in available state")
assertTrue(it.simProfiles.isEmpty(), "All regions should have empty Sim profile list")
}
}

val personData: String = get {
path = "/regions/sg/kyc/myInfo/authCode"
this.email = email
}

val expectedPersonData = """{"name":{"lastupdated":"2018-03-20","source":"1","classification":"C","value":"TAN XIAO HUI"},"sex":{"lastupdated":"2018-03-20","source":"1","classification":"C","value":"F"},"nationality":{"lastupdated":"2018-03-20","source":"1","classification":"C","value":"SG"},"dob":{"lastupdated":"2018-03-20","source":"1","classification":"C","value":"1970-05-17"},"email":{"lastupdated":"2018-08-23","source":"4","classification":"C","value":"[email protected]"},"mobileno":{"lastupdated":"2018-08-23","code":"65","source":"4","classification":"C","prefix":"+","nbr":"97399245"},"mailadd":{"country":"SG","unit":"128","street":"BEDOK NORTH AVENUE 4","lastupdated":"2018-03-20","block":"102","postal":"460102","source":"1","classification":"C","floor":"09","building":"PEARL GARDEN"},"uinfin":"S9812381D"}"""
assertEquals(expectedPersonData, personData, "MyInfo PersonData do not match")

run {
val regionDetailsList = get<RegionDetailsList> {
path = "/regions"
this.email = email
}

val sgRegionDetails = regionDetailsList.singleOrNull { it.region.id == "sg" }
assertTrue(sgRegionDetails != null, "regionDetailsList should contain sg region")

val regionDetails = RegionDetails()
.region(Region().id("sg").name("Singapore"))
.status(PENDING)
.kycStatusMap(mutableMapOf(
KycType.JUMIO.name to KycStatus.PENDING,
KycType.MY_INFO.name to KycStatus.APPROVED,
KycType.ADDRESS.name to KycStatus.PENDING,
KycType.NRIC_FIN.name to KycStatus.PENDING))
.simProfiles(SimProfileList())

assertEquals(regionDetails, sgRegionDetails, "RegionDetails do not match")
}
} finally {
StripePayment.deleteCustomer(customerId = customerId)
}
}

@Test
fun `jersey test - GET myinfo v3`() {

Expand Down Expand Up @@ -1584,6 +1505,7 @@ class SingaporeKycTest {
KycType.MY_INFO.name to KycStatus.APPROVED,
KycType.ADDRESS.name to KycStatus.PENDING,
KycType.NRIC_FIN.name to KycStatus.PENDING))
.kycExpiryDateMap(emptyMap())
.simProfiles(SimProfileList())

assertEquals(regionDetails, newRegionDetailsList, "RegionDetails do not match")
Expand Down Expand Up @@ -1633,6 +1555,7 @@ class SingaporeKycTest {
KycType.NRIC_FIN.name to KycStatus.APPROVED,
KycType.JUMIO.name to KycStatus.PENDING,
KycType.ADDRESS.name to KycStatus.PENDING))
.kycExpiryDateMap(emptyMap())
.simProfiles(SimProfileList())

assertEquals(regionDetails, sgRegionDetails, "RegionDetails do not match")
Expand Down Expand Up @@ -1684,6 +1607,7 @@ class SingaporeKycTest {
KycType.NRIC_FIN.name to KycStatus.APPROVED,
KycType.JUMIO.name to KycStatus.APPROVED,
KycType.ADDRESS.name to KycStatus.PENDING))
.kycExpiryDateMap(emptyMap())
.simProfiles(SimProfileList())

assertEquals(regionDetails, sgRegionDetails, "RegionDetails do not match")
Expand Down Expand Up @@ -1712,6 +1636,7 @@ class SingaporeKycTest {
KycType.MY_INFO.name to KycStatus.PENDING,
KycType.ADDRESS.name to KycStatus.APPROVED,
KycType.NRIC_FIN.name to KycStatus.APPROVED))
.kycExpiryDateMap(emptyMap())
.simProfiles(SimProfileList())

assertEquals(regionDetails, sgRegionDetails, "RegionDetails do not match")
Expand Down Expand Up @@ -1786,6 +1711,7 @@ class SingaporeKycTest {
KycType.NRIC_FIN.name to KycStatus.PENDING,
KycType.JUMIO.name to KycStatus.APPROVED,
KycType.ADDRESS.name to KycStatus.PENDING))
.kycExpiryDateMap(emptyMap())
.simProfiles(SimProfileList())

assertEquals(regionDetails, sgRegionDetails, "RegionDetails do not match")
Expand Down Expand Up @@ -1814,6 +1740,7 @@ class SingaporeKycTest {
KycType.MY_INFO.name to KycStatus.PENDING,
KycType.ADDRESS.name to KycStatus.APPROVED,
KycType.NRIC_FIN.name to KycStatus.PENDING))
.kycExpiryDateMap(emptyMap())
.simProfiles(SimProfileList())

assertEquals(regionDetails, sgRegionDetails, "RegionDetails do not match")
Expand Down
81 changes: 8 additions & 73 deletions acceptance-tests/src/main/kotlin/org/ostelco/at/okhttp/Tests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import org.ostelco.prime.customer.model.Product
import org.ostelco.prime.customer.model.Region
import org.ostelco.prime.customer.model.RegionDetails
import org.ostelco.prime.customer.model.RegionDetails.StatusEnum.APPROVED
import org.ostelco.prime.customer.model.RegionDetails.StatusEnum.PENDING
import org.ostelco.prime.customer.model.RegionDetails.StatusEnum.AVAILABLE
import org.ostelco.prime.customer.model.RegionDetails.StatusEnum.PENDING
import org.ostelco.prime.customer.model.RegionDetailsList
import org.ostelco.prime.customer.model.ScanInformation
import org.ostelco.prime.customer.model.SimProfile
Expand Down Expand Up @@ -154,6 +154,7 @@ class RegionsTest {
.region(Region().id("no").name("Norway"))
.status(APPROVED)
.kycStatusMap(mapOf(KycType.JUMIO.name to KycStatus.APPROVED))
.kycExpiryDateMap(emptyMap())
.simProfiles(SimProfileList())

assertEquals(regionDetails, regionDetailsList[noRegionIndex], "RegionDetails do not match")
Expand Down Expand Up @@ -605,31 +606,6 @@ class PurchaseTest {

class SingaporeKycTest {

@Test
fun `okhttp test - GET myinfoConfig v2`() {

val email = "myinfo-${randomInt()}@test.com"
var customerId = ""
try {

customerId = createCustomer(name = "Test MyInfoConfig v2 Customer", email = email).id

val client = clientForSubject(subject = email)

val myInfoConfig = client.myInfoV2Config

assertEquals(
"http://ext-myinfo-emulator:8080/v2/authorise" +
"?client_id=STG2-MYINFO-SELF-TEST" +
"&attributes=name,sex,dob,residentialstatus,nationality,mobileno,email,mailadd" +
"&redirect_uri=http://localhost:3001/callback",
myInfoConfig.url)

} finally {
StripePayment.deleteCustomer(customerId = customerId)
}
}

@Test
fun `okhttp test - GET myinfoConfig v3`() {

Expand All @@ -655,53 +631,6 @@ class SingaporeKycTest {
}
}

@Test
fun `okhttp test - GET myinfo v2`() {

val email = "myinfo-v2-${randomInt()}@test.com"
var customerId = ""
try {

customerId = createCustomer(name = "Test MyInfo v2 Customer", email = email).id

val client = clientForSubject(subject = email)

run {
val regionDetailsList = client.allRegions

regionDetailsList.forEach {
assertTrue(it.status == AVAILABLE, "All regions should be in available state")
}
}

val personData: String = jacksonObjectMapper().writeValueAsString(client.getCustomerMyInfoV2Data("authCode"))

val expectedPersonData = """{"name":{"lastupdated":"2018-03-20","source":"1","classification":"C","value":"TAN XIAO HUI"},"sex":{"lastupdated":"2018-03-20","source":"1","classification":"C","value":"F"},"nationality":{"lastupdated":"2018-03-20","source":"1","classification":"C","value":"SG"},"dob":{"lastupdated":"2018-03-20","source":"1","classification":"C","value":"1970-05-17"},"email":{"lastupdated":"2018-08-23","source":"4","classification":"C","value":"[email protected]"},"mobileno":{"lastupdated":"2018-08-23","code":"65","source":"4","classification":"C","prefix":"+","nbr":"97399245"},"mailadd":{"country":"SG","unit":"128","street":"BEDOK NORTH AVENUE 4","lastupdated":"2018-03-20","block":"102","postal":"460102","source":"1","classification":"C","floor":"09","building":"PEARL GARDEN"},"uinfin":"S9812381D"}"""
assertEquals(expectedPersonData, personData, "MyInfo PersonData do not match")

run {
val regionDetailsList = client.allRegions

val sgRegionIndex = regionDetailsList.indexOfFirst { it.region.id == "sg" }
assertTrue(sgRegionIndex != -1, "regionDetailsList should contain sg region")

val regionDetails = RegionDetails()
.region(Region().id("sg").name("Singapore"))
.status(PENDING)
.kycStatusMap(mutableMapOf(
KycType.JUMIO.name to KycStatus.PENDING,
KycType.MY_INFO.name to KycStatus.APPROVED,
KycType.ADDRESS.name to KycStatus.PENDING,
KycType.NRIC_FIN.name to KycStatus.PENDING))
.simProfiles(SimProfileList())

assertEquals(regionDetails, regionDetailsList[sgRegionIndex], "RegionDetails do not match")
}
} finally {
StripePayment.deleteCustomer(customerId = customerId)
}
}

@Test
fun `okhttp test - GET myinfo v3`() {

Expand Down Expand Up @@ -740,6 +669,7 @@ class SingaporeKycTest {
KycType.MY_INFO.name to KycStatus.APPROVED,
KycType.ADDRESS.name to KycStatus.PENDING,
KycType.NRIC_FIN.name to KycStatus.PENDING))
.kycExpiryDateMap(emptyMap())
.simProfiles(SimProfileList())

assertEquals(regionDetails, regionDetailsList[sgRegionIndex], "RegionDetails do not match")
Expand Down Expand Up @@ -783,6 +713,7 @@ class SingaporeKycTest {
KycType.NRIC_FIN.name to KycStatus.APPROVED,
KycType.JUMIO.name to KycStatus.PENDING,
KycType.ADDRESS.name to KycStatus.PENDING))
.kycExpiryDateMap(emptyMap())
.simProfiles(SimProfileList())

assertEquals(regionDetails, regionDetailsList[sgRegionIndex], "RegionDetails do not match")
Expand Down Expand Up @@ -828,6 +759,7 @@ class SingaporeKycTest {
KycType.NRIC_FIN.name to KycStatus.APPROVED,
KycType.JUMIO.name to KycStatus.APPROVED,
KycType.ADDRESS.name to KycStatus.PENDING))
.kycExpiryDateMap(emptyMap())
.simProfiles(SimProfileList())

assertEquals(regionDetails, regionDetailsList[sgRegionIndex], "RegionDetails do not match")
Expand All @@ -849,6 +781,7 @@ class SingaporeKycTest {
KycType.MY_INFO.name to KycStatus.PENDING,
KycType.ADDRESS.name to KycStatus.APPROVED,
KycType.NRIC_FIN.name to KycStatus.APPROVED))
.kycExpiryDateMap(emptyMap())
.simProfiles(SimProfileList())

assertEquals(regionDetails, regionDetailsList[sgRegionIndex], "RegionDetails do not match")
Expand Down Expand Up @@ -916,6 +849,7 @@ class SingaporeKycTest {
KycType.NRIC_FIN.name to KycStatus.PENDING,
KycType.JUMIO.name to KycStatus.APPROVED,
KycType.ADDRESS.name to KycStatus.PENDING))
.kycExpiryDateMap(emptyMap())
.simProfiles(SimProfileList())

assertEquals(regionDetails, regionDetailsList[sgRegionIndex], "RegionDetails do not match")
Expand All @@ -937,6 +871,7 @@ class SingaporeKycTest {
KycType.MY_INFO.name to KycStatus.PENDING,
KycType.ADDRESS.name to KycStatus.APPROVED,
KycType.NRIC_FIN.name to KycStatus.PENDING))
.kycExpiryDateMap(emptyMap())
.simProfiles(SimProfileList())

assertEquals(regionDetails, regionDetailsList[sgRegionIndex], "RegionDetails do not match")
Expand Down
Loading

0 comments on commit 7528412

Please sign in to comment.