updating ci
This commit is contained in:
@@ -37,6 +37,173 @@ public class ConfigController {
|
||||
private final CategoryService categoryService;
|
||||
private final IntegrationProcessorService integrationProcessorService;
|
||||
|
||||
@GetMapping("/seed/live")
|
||||
public ResponseEntity seedLiveConfig(){
|
||||
|
||||
// clear existing payment processors before seeding
|
||||
paymentProcessorService.getPaymentProcessorRepository().deleteAll();
|
||||
paymentProcessorService.getPaymentProcessorRepository().saveAll(Arrays.asList(
|
||||
PaymentProcessor.builder()
|
||||
.name("Ecocash")
|
||||
.label("ECOCASH")
|
||||
.type("GATEWAY")
|
||||
.image("ecocash.png")
|
||||
.accountFieldName("phoneNumber")
|
||||
.accountFieldLabel("EcoCash Phone Number")
|
||||
.description("Pay using your mobile wallet")
|
||||
.authType("REMOTE")
|
||||
.build(),
|
||||
PaymentProcessor.builder()
|
||||
.name("Visa/MasterCard")
|
||||
.label("MPGS")
|
||||
.type("GATEWAY")
|
||||
.image("visa-mastercard.png")
|
||||
.accountFieldName("cardNumber")
|
||||
.accountFieldLabel("Card Number")
|
||||
.description("Pay using your international card")
|
||||
.authType("WEB")
|
||||
.build()
|
||||
));
|
||||
|
||||
|
||||
|
||||
integrationProcessorService.getIntegrationProcessorRepository().deleteAll();
|
||||
integrationProcessorService.getIntegrationProcessorRepository().saveAll(Arrays.asList(
|
||||
IntegrationProcessor.builder()
|
||||
.name("STEWARD")
|
||||
.label("STEWARD")
|
||||
.description("Steward Integration Processor")
|
||||
.build()
|
||||
));
|
||||
|
||||
// clear existing categories before seeding
|
||||
categoryService.getCategoryRepository().deleteAll();
|
||||
// seed categories
|
||||
List<Category> categories = Arrays.asList(
|
||||
Category.builder()
|
||||
.name("Airtime")
|
||||
.description("Airtime for local mobile networks")
|
||||
.label("AIRTIME")
|
||||
.build(),
|
||||
Category.builder()
|
||||
.name("Utilities")
|
||||
.description("Council bills & rates")
|
||||
.label("UTILITIES")
|
||||
.build()
|
||||
);
|
||||
categoryService.getCategoryRepository().saveAll(categories);
|
||||
|
||||
// clear existing providers before seeding
|
||||
providerService.getProviderRepository().deleteAll();
|
||||
|
||||
// seed providers
|
||||
List<Provider> providers = Arrays.asList(
|
||||
Provider.builder()
|
||||
.description("Econet Airtime")
|
||||
.clientId("econet_airtime")
|
||||
.label("ECONET")
|
||||
.category("AIRTIME")
|
||||
.image("econet.png")
|
||||
.externalId("78f1f497-c9eb-401c-b22c-884756e68e40")
|
||||
.integrationProcessorLabel("STEWARD")
|
||||
.accountFieldName("Phone Number")
|
||||
.build(),
|
||||
Provider.builder()
|
||||
.description("NetOne Airtime")
|
||||
.clientId("netone_usd_airtime")
|
||||
.label("NETONE")
|
||||
.category("AIRTIME")
|
||||
.image("netone.png")
|
||||
.externalId("95d485a7-39c9-4559-8a27-6521969abe8f")
|
||||
.integrationProcessorLabel("STEWARD")
|
||||
.accountFieldName("Phone Number")
|
||||
.build(),
|
||||
Provider.builder()
|
||||
.description("Prepaid Zesa")
|
||||
.clientId("zesa_prepaid_usd")
|
||||
.label("ZESA")
|
||||
.category("UTILITIES")
|
||||
.image("zesa.png")
|
||||
.externalId("0f67f7cc-b62b-4fb5-915f-6740b2afdba6")
|
||||
.integrationProcessorLabel("STEWARD")
|
||||
.accountFieldName("Meter Number")
|
||||
.build(),
|
||||
Provider.builder()
|
||||
.description("Econet Broadband")
|
||||
.clientId("econet_broadband_usd")
|
||||
.label("ECONET_BROADBAND")
|
||||
.category("AIRTIME")
|
||||
.image("econet.png")
|
||||
.externalId("287863e2-a791-4106-b629-79dadc9a6779")
|
||||
.integrationProcessorLabel("STEWARD")
|
||||
.accountFieldName("Phone Number")
|
||||
.build()
|
||||
);
|
||||
providerService.getProviderRepository().saveAll(providers);
|
||||
|
||||
// Clear existing charges and charge conditions before seeding
|
||||
List<ChargeCondition> chargeConditions = Arrays.asList(
|
||||
ChargeCondition.builder()
|
||||
.name("Ecocash Gateway")
|
||||
.type(ChargeConditionType.GATEWAY)
|
||||
.codes("ECOCASH")
|
||||
.build(),
|
||||
ChargeCondition.builder()
|
||||
.name("Steward Gateway")
|
||||
.type(ChargeConditionType.GATEWAY)
|
||||
.codes("STEWARD")
|
||||
.build(),
|
||||
ChargeCondition.builder()
|
||||
.name("Mastercard Gateway")
|
||||
.type(ChargeConditionType.GATEWAY)
|
||||
.codes("MPGS")
|
||||
.build()
|
||||
);
|
||||
chargeService.getChargeRepository().deleteAll();
|
||||
chargeConditionService.getChargeConditionRepository().deleteAll();
|
||||
chargeConditionService.getChargeConditionRepository().saveAll(chargeConditions);
|
||||
|
||||
List<Charge> charges = Arrays.asList(
|
||||
Charge.builder()
|
||||
.description("Gateway fee")
|
||||
.chargeLabel(ChargeLabelEnum.GATEWAY_FEE)
|
||||
.currency(CurrencyType.USD)
|
||||
.percentageRate(new BigDecimal("1"))
|
||||
.includes(new HashSet<>() {{
|
||||
add(chargeConditions.get(0));
|
||||
}})
|
||||
.build(),
|
||||
Charge.builder()
|
||||
.description("Gateway fee")
|
||||
.chargeLabel(ChargeLabelEnum.GATEWAY_FEE)
|
||||
.currency(CurrencyType.USD)
|
||||
.percentageRate(new BigDecimal("2"))
|
||||
.min(new BigDecimal("0.55"))
|
||||
.includes(new HashSet<>() {{
|
||||
add(chargeConditions.get(2));
|
||||
}})
|
||||
.build()
|
||||
// Charge.builder()
|
||||
// .description("Tax")
|
||||
// .chargeLabel(ChargeLabelEnum.TAX)
|
||||
// .currency(CurrencyType.USD)
|
||||
// .percentageRate(new BigDecimal("2"))
|
||||
// .max(new BigDecimal("10150"))
|
||||
// .minimumAmount(new BigDecimal("5"))
|
||||
// .maximumAmount(new BigDecimal("500000"))
|
||||
// .includes(new HashSet<>() {{
|
||||
// add(chargeConditions.get(0));
|
||||
// add(chargeConditions.get(1));
|
||||
// add(chargeConditions.get(2));
|
||||
// }})
|
||||
// .build()
|
||||
);
|
||||
|
||||
chargeService.getChargeRepository().saveAll(charges);
|
||||
|
||||
return ResponseEntity.ok("Project configuration seeding complete");
|
||||
}
|
||||
|
||||
@GetMapping("/seed")
|
||||
public ResponseEntity seedConfig(){
|
||||
|
||||
|
||||
@@ -1,10 +1,2 @@
|
||||
# sbz.merchant.url=http://localhost:24000/v1
|
||||
sbz.merchant.url=https://api.stewardpay.co.zw/lab/v2
|
||||
|
||||
spring.datasource.url=jdbc:postgresql://localhost:5432/qpay?useLegacyDatetimeCode=false
|
||||
spring.datasource.username=postgres
|
||||
spring.datasource.password=example
|
||||
|
||||
nflow.db.postgresql.url=jdbc:postgresql://localhost:5432/qpay
|
||||
nflow.db.postgresql.user=postgres
|
||||
nflow.db.postgresql.password=example
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
|
||||
<changeSet author="vkhoza (generated)" id="1760560268483-1">
|
||||
<createTable tableName="additional_data">
|
||||
<column name="id" type="BYTEA">
|
||||
<column name="id" type="UUID">
|
||||
<constraints nullable="false" primaryKey="true" primaryKeyName="additional_dataPK"/>
|
||||
</column>
|
||||
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
|
||||
@@ -14,7 +14,7 @@
|
||||
</changeSet>
|
||||
<changeSet author="vkhoza (generated)" id="1760560268483-2">
|
||||
<createTable tableName="category">
|
||||
<column name="id" type="BYTEA">
|
||||
<column name="id" type="UUID">
|
||||
<constraints nullable="false" primaryKey="true" primaryKeyName="categoryPK"/>
|
||||
</column>
|
||||
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
|
||||
@@ -27,7 +27,7 @@
|
||||
</changeSet>
|
||||
<changeSet author="vkhoza (generated)" id="1760560268483-3">
|
||||
<createTable tableName="charge">
|
||||
<column name="id" type="BYTEA">
|
||||
<column name="id" type="UUID">
|
||||
<constraints nullable="false" primaryKey="true" primaryKeyName="chargePK"/>
|
||||
</column>
|
||||
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
|
||||
@@ -55,7 +55,7 @@
|
||||
</changeSet>
|
||||
<changeSet author="vkhoza (generated)" id="1760560268483-4">
|
||||
<createTable tableName="charge_condition">
|
||||
<column name="id" type="BYTEA">
|
||||
<column name="id" type="UUID">
|
||||
<constraints nullable="false" primaryKey="true" primaryKeyName="charge_conditionPK"/>
|
||||
</column>
|
||||
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
|
||||
@@ -67,27 +67,27 @@
|
||||
</changeSet>
|
||||
<changeSet author="vkhoza (generated)" id="1760560268483-5">
|
||||
<createTable tableName="charge_exclude_products">
|
||||
<column name="charge_id" type="BYTEA">
|
||||
<column name="charge_id" type="UUID">
|
||||
<constraints nullable="false" primaryKey="true" primaryKeyName="charge_exclude_productsPK"/>
|
||||
</column>
|
||||
<column name="charge_condition_id" type="BYTEA">
|
||||
<column name="charge_condition_id" type="UUID">
|
||||
<constraints nullable="false" primaryKey="true" primaryKeyName="charge_exclude_productsPK"/>
|
||||
</column>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="vkhoza (generated)" id="1760560268483-6">
|
||||
<createTable tableName="charge_include_products">
|
||||
<column name="charge_id" type="BYTEA">
|
||||
<column name="charge_id" type="UUID">
|
||||
<constraints nullable="false" primaryKey="true" primaryKeyName="charge_include_productsPK"/>
|
||||
</column>
|
||||
<column name="charge_condition_id" type="BYTEA">
|
||||
<column name="charge_condition_id" type="UUID">
|
||||
<constraints nullable="false" primaryKey="true" primaryKeyName="charge_include_productsPK"/>
|
||||
</column>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="vkhoza (generated)" id="1760560268483-7">
|
||||
<createTable tableName="currency">
|
||||
<column name="id" type="BYTEA">
|
||||
<column name="id" type="UUID">
|
||||
<constraints nullable="false" primaryKey="true" primaryKeyName="currencyPK"/>
|
||||
</column>
|
||||
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
|
||||
@@ -99,7 +99,7 @@
|
||||
</changeSet>
|
||||
<changeSet author="vkhoza (generated)" id="1760560268483-8">
|
||||
<createTable tableName="integration_processor">
|
||||
<column name="id" type="BYTEA">
|
||||
<column name="id" type="UUID">
|
||||
<constraints nullable="false" primaryKey="true" primaryKeyName="integration_processorPK"/>
|
||||
</column>
|
||||
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
|
||||
@@ -111,7 +111,7 @@
|
||||
</changeSet>
|
||||
<changeSet author="vkhoza (generated)" id="1760560268483-9">
|
||||
<createTable tableName="otp">
|
||||
<column name="id" type="BYTEA">
|
||||
<column name="id" type="UUID">
|
||||
<constraints nullable="false" primaryKey="true" primaryKeyName="otpPK"/>
|
||||
</column>
|
||||
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
|
||||
@@ -124,7 +124,7 @@
|
||||
</changeSet>
|
||||
<changeSet author="vkhoza (generated)" id="1760560268483-10">
|
||||
<createTable tableName="payment_processor">
|
||||
<column name="id" type="BYTEA">
|
||||
<column name="id" type="UUID">
|
||||
<constraints nullable="false" primaryKey="true" primaryKeyName="payment_processorPK"/>
|
||||
</column>
|
||||
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
|
||||
@@ -141,7 +141,7 @@
|
||||
</changeSet>
|
||||
<changeSet author="vkhoza (generated)" id="1760560268483-11">
|
||||
<createTable tableName="provider">
|
||||
<column name="id" type="BYTEA">
|
||||
<column name="id" type="UUID">
|
||||
<constraints nullable="false" primaryKey="true" primaryKeyName="providerPK"/>
|
||||
</column>
|
||||
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
|
||||
@@ -161,7 +161,7 @@
|
||||
</changeSet>
|
||||
<changeSet author="vkhoza (generated)" id="1760560268483-12">
|
||||
<createTable tableName="recipient">
|
||||
<column name="id" type="BYTEA">
|
||||
<column name="id" type="UUID">
|
||||
<constraints nullable="false" primaryKey="true" primaryKeyName="recipientPK"/>
|
||||
</column>
|
||||
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
|
||||
@@ -178,7 +178,7 @@
|
||||
</changeSet>
|
||||
<changeSet author="vkhoza (generated)" id="1760560268483-13">
|
||||
<createTable tableName="setting">
|
||||
<column name="id" type="BYTEA">
|
||||
<column name="id" type="UUID">
|
||||
<constraints nullable="false" primaryKey="true" primaryKeyName="settingPK"/>
|
||||
</column>
|
||||
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
|
||||
@@ -189,7 +189,7 @@
|
||||
</changeSet>
|
||||
<changeSet author="vkhoza (generated)" id="1760560268483-14">
|
||||
<createTable tableName="transaction">
|
||||
<column name="id" type="BYTEA">
|
||||
<column name="id" type="UUID">
|
||||
<constraints nullable="false" primaryKey="true" primaryKeyName="transactionPK"/>
|
||||
</column>
|
||||
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
|
||||
@@ -256,7 +256,7 @@
|
||||
</changeSet>
|
||||
<changeSet author="vkhoza (generated)" id="1760560268483-15">
|
||||
<createTable tableName="transaction_event">
|
||||
<column name="id" type="BYTEA">
|
||||
<column name="id" type="UUID">
|
||||
<constraints nullable="false" primaryKey="true" primaryKeyName="transaction_eventPK"/>
|
||||
</column>
|
||||
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
|
||||
@@ -270,7 +270,7 @@
|
||||
</changeSet>
|
||||
<changeSet author="vkhoza (generated)" id="1760560268483-16">
|
||||
<createTable tableName="users">
|
||||
<column name="id" type="BYTEA">
|
||||
<column name="id" type="UUID">
|
||||
<constraints nullable="false" primaryKey="true" primaryKeyName="usersPK"/>
|
||||
</column>
|
||||
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
|
||||
|
||||
Reference in New Issue
Block a user