Skip to content

Commit

Permalink
Renamed "originator" to "shortcode"
Browse files Browse the repository at this point in the history
  • Loading branch information
edudouglas committed Nov 16, 2018
1 parent d9439b5 commit a2755a1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions temba/channels/types/playmobile/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_claim(self):
response = self.client.get(url)
post_data = response.context["form"].initial

post_data["phone_sender"] = "1234"
post_data["shortcode"] = "1122"
post_data["username"] = "unicef"
post_data["password"] = "HmGWbdCFiJBj5bui"

Expand All @@ -39,9 +39,9 @@ def test_claim(self):
from .type import PlayMobileType

self.assertEqual("UZ", channel.country)
self.assertEqual("unicef", channel.config[PlayMobileType.CONFIG_AUTH_USERNAME])
self.assertEqual("HmGWbdCFiJBj5bui", channel.config[PlayMobileType.CONFIG_AUTH_PASSWORD])
self.assertEqual(post_data["phone_sender"], channel.address)
self.assertEqual("unicef", channel.config[PlayMobileType.CONFIG_USERNAME])
self.assertEqual("HmGWbdCFiJBj5bui", channel.config[PlayMobileType.CONFIG_PASSWORD])
self.assertEqual(post_data["shortcode"], channel.address)
self.assertEqual("PM", channel.channel_type)

config_url = reverse("channels.channel_configuration", args=[channel.uuid])
Expand Down
6 changes: 3 additions & 3 deletions temba/channels/types/playmobile/type.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ class PlayMobileType(ChannelType):
A Play Mobile channel (http://playmobile.uz/)
"""

CONFIG_PHONE_SENDER = "phone_sender"
CONFIG_AUTH_USERNAME = "auth_basic_username"
CONFIG_AUTH_PASSWORD = "auth_basic_password"
CONFIG_SHORTCODE = "shortcode"
CONFIG_USERNAME = "username"
CONFIG_PASSWORD = "password"

courier_url = r"^pm/(?P<uuid>[a-z0-9\-]+)/(?P<action>receive)$"

Expand Down
10 changes: 5 additions & 5 deletions temba/channels/types/playmobile/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class ClaimView(ClaimViewMixin, SmartFormView):
class PMClaimForm(ClaimViewMixin.Form):
phone_sender = forms.CharField(max_length=15, min_length=1, help_text=_("The Phone Number Sender"))
shortcode = forms.CharField(max_length=15, min_length=1, help_text=_("The short code you are connecting"))
username = forms.CharField(label=_("Username"), help_text=_("The username for your API account"))
password = forms.CharField(label=_("Password"), help_text=_("The password for your API account"))

Expand All @@ -27,13 +27,13 @@ def form_valid(self, form):
from .type import PlayMobileType

config = {
PlayMobileType.CONFIG_PHONE_SENDER: data["phone_sender"],
PlayMobileType.CONFIG_AUTH_USERNAME: data["username"],
PlayMobileType.CONFIG_AUTH_PASSWORD: data["password"],
PlayMobileType.CONFIG_SHORTCODE: data["shortcode"],
PlayMobileType.CONFIG_USERNAME: data["username"],
PlayMobileType.CONFIG_PASSWORD: data["password"],
}

self.object = Channel.create(
org, user, "UZ", "PM", name=data["phone_sender"], address=data["phone_sender"], config=config
org, user, "UZ", "PM", name=data["shortcode"], address=data["shortcode"], config=config
)

return super(ClaimView, self).form_valid(form)

0 comments on commit a2755a1

Please sign in to comment.