-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6eec4d
commit c51dc08
Showing
12 changed files
with
118 additions
and
20 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
from django.apps import AppConfig as BaseAppConfig | ||
|
||
from hope_payment_gateway.apps.gateway.registry import export_registry, registry | ||
from hope_payment_gateway.apps.gateway.registry import delivery_mechanism_registry, export_registry, registry | ||
|
||
|
||
class AppConfig(BaseAppConfig): | ||
name = __name__.rpartition(".")[0] | ||
verbose_name = "Western Union" | ||
|
||
def ready(self) -> None: | ||
from .handlers import CSVExportStrategy, WesternUnionHandler | ||
from .handlers import WesternUnionHandler | ||
|
||
registry.register(WesternUnionHandler) | ||
export_registry.register(CSVExportStrategy) | ||
|
||
from . import tasks # noqa |
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
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
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 |
---|---|---|
@@ -1,13 +1,15 @@ | ||
from django.apps import AppConfig as BaseAppConfig | ||
|
||
from hope_payment_gateway.apps.gateway.registry import registry | ||
from hope_payment_gateway.apps.gateway.registry import delivery_mechanism_registry, export_registry | ||
|
||
|
||
class AppConfig(BaseAppConfig): | ||
name = __name__.rpartition(".")[0] | ||
verbose_name = "Gateway" | ||
|
||
def ready(self) -> None: | ||
from hope_payment_gateway.apps.fsp.western_union.handlers import WesternUnionHandler | ||
|
||
registry.register(WesternUnionHandler) | ||
from .handlers import CSVExportStrategy, MobileMoneyProcessor | ||
|
||
export_registry.register(CSVExportStrategy) | ||
delivery_mechanism_registry.register(MobileMoneyProcessor) |
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,19 @@ | ||
from django import forms | ||
from django.core.validators import RegexValidator | ||
|
||
from phonenumber_field.formfields import PhoneNumberField | ||
|
||
iban_validator = RegexValidator("^[A-Z]{2}(?:[ ]?[0-9]){18,20}$", "Invalid IBAN") | ||
|
||
|
||
class DeliveryMechanismForm(forms.Form): | ||
pass | ||
|
||
|
||
class MobileMoneyForm(DeliveryMechanismForm): | ||
phone_no = PhoneNumberField(help_text="Telephone number") | ||
iban = forms.CharField(max_length=24, validators=[iban_validator], help_text="IBAN Address") | ||
|
||
|
||
class IbanForm(DeliveryMechanismForm): | ||
iban = forms.CharField(max_length=24, validators=[iban_validator], help_text="IBAN Address") |
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,14 @@ | ||
from .forms import MobileMoneyForm | ||
from .registry import DeliveryMechanismProcessor, FSPProcessor | ||
|
||
|
||
class CSVExportStrategy(FSPProcessor): | ||
|
||
def export(self): | ||
pass | ||
|
||
|
||
class MobileMoneyProcessor(DeliveryMechanismProcessor): | ||
|
||
def get_form(self): | ||
return MobileMoneyForm() |
19 changes: 19 additions & 0 deletions
19
src/hope_payment_gateway/apps/gateway/migrations/0022_deliverymechanism_strategy.py
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,19 @@ | ||
# Generated by Django 5.0.6 on 2024-06-27 08:19 | ||
|
||
import strategy_field.fields | ||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("gateway", "0021_paymentrecord_marked_for_payment"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="deliverymechanism", | ||
name="form", | ||
field=strategy_field.fields.StrategyField(blank=True, null=True), | ||
), | ||
] |
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
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