[IMP] payment_asiapay: update api_url based on country
Issue: Merchant account created inside Philippine will use PesoPay, created inside Thailand will use SiamPay, and created inside Indonesia will use BimoPay. Currently. only PayDollar is available. Cause: Missing PesoPay, SiamPay and BimoPay. Solution: Add a brand setting on payment provider to allow user to select which branch will be used. More: - What is PayDollar, PesoPay, etc. to AsiaPay? PayDollar, PesoPay, SiamPay, BimoPay is the same system under AsiaPay but is for different countries to apply. PesoPay is for the PH market SiamPay is for the TH market BimoPay is for the ID market while PayDollar is for all other market likes HK, CN, MO, TW, SG, MY, IN, VN, NZ and AU - Why are there multiple endpoints for a given API? Below reasons are from AsiaPay side Local regulators requirements for BimoPay Branding purposes to localize for the users for PesoPay and SiamPay. - Why didn't we integrate all these endpoints in the first version of our AsiaPay implementation? We got in touch with AsiaPay after our first integration. Therefore after partnership established with AsiaPay, they provide more integration guides on the whole development - If many customers ask for these endpoints? Right now, there is no customers asking for these endpoints. However if they register AsiaPay under certain countries, they have to use the other endpoints otherwise they will not able to use AsiaPay on Odoo at all. task-3073748 closes odoo/odoo#110357 Related: odoo/documentation#3423 Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
This commit is contained in:
@@ -1,5 +1,19 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
API_URLS = {
|
||||
'production': {
|
||||
'pesopay': 'https://www.pesopay.com/b2c2/eng/payment/payForm.jsp',
|
||||
'siampay': 'https://www.siampay.com/b2c2/eng/payment/payForm.jsp',
|
||||
'bimopay': 'https://www.bimopay.com/b2c2/eng/payment/payForm.jsp',
|
||||
'paydollar': 'https://www.paydollar.com/b2c2/eng/payment/payForm.jsp',
|
||||
},
|
||||
'test': {
|
||||
'pesopay': 'https://test.pesopay.com/b2cDemo/eng/payment/payForm.jsp',
|
||||
'siampay': 'https://test.siampay.com/b2cDemo/eng/payment/payForm.jsp',
|
||||
'paydollar': 'https://test.paydollar.com/b2cDemo/eng/payment/payForm.jsp',
|
||||
}
|
||||
}
|
||||
|
||||
# Mapping of currency ISO 4217 codes AsiaPay's currency codes.
|
||||
# See https://www.paydollar.com/pdf/op/enpdintguide.pdf for the list of currency codes.
|
||||
CURRENCY_MAPPING = {
|
||||
|
||||
@@ -14,6 +14,14 @@ class PaymentProvider(models.Model):
|
||||
code = fields.Selection(
|
||||
selection_add=[('asiapay', "AsiaPay")], ondelete={'asiapay': 'set default'}
|
||||
)
|
||||
asiapay_brand = fields.Selection(
|
||||
string="Asiapay Brand",
|
||||
help="The brand associated to your AsiaPay account.",
|
||||
selection=[("paydollar", "PayDollar"), ("pesopay", "PesoPay"),
|
||||
("siampay", "SiamPay"), ("bimopay", "BimoPay")],
|
||||
default='paydollar',
|
||||
required_if_provider='asiapay',
|
||||
)
|
||||
asiapay_merchant_id = fields.Char(
|
||||
string="AsiaPay Merchant ID",
|
||||
help="The Merchant ID solely used to identify your AsiaPay account.",
|
||||
@@ -50,10 +58,9 @@ class PaymentProvider(models.Model):
|
||||
"""
|
||||
self.ensure_one()
|
||||
|
||||
if self.state == 'enabled':
|
||||
return 'https://www.paydollar.com/b2c2/eng/payment/payForm.jsp'
|
||||
else: # 'test'
|
||||
return 'https://test.paydollar.com/b2cDemo/eng/payment/payForm.jsp'
|
||||
environment = 'production' if self.state == 'enabled' else 'test'
|
||||
api_urls = const.API_URLS[environment]
|
||||
return api_urls.get(self.asiapay_brand, api_urls['paydollar'])
|
||||
|
||||
def _asiapay_calculate_signature(self, data, incoming=True):
|
||||
""" Compute the signature for the provided data according to the AsiaPay documentation.
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
<field name="arch" type="xml">
|
||||
<group name="provider_credentials" position='inside'>
|
||||
<group attrs="{'invisible': [('code', '!=', 'asiapay')]}">
|
||||
<field name="asiapay_brand"
|
||||
string="Brand"
|
||||
attrs="{'required': [('code', '=', 'asiapay'), ('state', '!=', 'disabled')]}"/>
|
||||
<field name="asiapay_merchant_id"
|
||||
string="Merchant ID"
|
||||
attrs="{'required': [('code', '=', 'asiapay'), ('state', '!=', 'disabled')]}"/>
|
||||
|
||||
Reference in New Issue
Block a user