Skip to content

Commit

Permalink
Merge remote-tracking branch 'mangopay/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
thoas committed Jan 18, 2024
2 parents 67c8be6 + d51c6b6 commit 3852ffd
Show file tree
Hide file tree
Showing 12 changed files with 1,471 additions and 112 deletions.
52 changes: 52 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,55 @@
## [3.31.0] - 2023-12-22
### Added

- New `CardInfo` parameter returned on card transactions. More information [here](https://mangopay.com/docs/release-notes/chilka).
- The IDEAL legacy implementation has been enhanced. You can now pass the `Bic`., and if provided, the API response will include the `BankName` parameter. More information [here](https://mangopay.com/docs/endpoints/web-card-payins#create-web-card-payin).

## [3.30.1] - 2023-11-09
### Added

It's now possible to specify an amount for DebitedFunds and Fees when you create a refund with `PayInRefund()`.

## [3.30.0] - 2023-11-02
### Updated
- Giropay and Ideal integrations with Mangopay have been improved.
- Klarna param "MerchantOrderId" has been renamed to "Reference"

### Added
- New Reference parameter for the new Paypal implementation.

## [3.29.0] - 2023-09-29
### Added
- Instantly convert funds between 2 wallets of different currencies owned by the same user with the new SPOT FX endpoints

## [3.28.0] - 2023-09-18
### Added

- Multibanco, Satispay, Blik, Klarna are now available as a payment method with Mangopay. This payment method is in private beta. Please contact support if you have any questions.
- Card validation endpoint is now available (Private beta)

### Updated

- Google Pay integration & Paypal with Mangopay have been improved. These payment methods are in private beta. Please contact support if you have any questions.

### Fixed

- MBWay & PayPal are now using Web Execution Type.

## [3.27.2] - 2023-07-28
### Fixed

CIT/MIT should not set secure_mode #332

## [3.27.1] - 2023-06-21
### Fixed

- `Phone` parameter instead of `PhoneNumber` for MBWay

## [3.27.0] - 2023-06-21
### Added

- MB WAY is now available as a payment method with Mangopay. This payment method is in private beta. Please contact support if you have any questions.

## [3.26.0] - 2023-03-17
### Added

Expand Down
70 changes: 62 additions & 8 deletions mangopay/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
TRANSACTION_TYPE_CHOICES = Choices(
('PAYIN', 'payin', 'Pay In'),
('PAYOUT', 'payout', 'Pay out'),
('TRANSFER', 'transfer', 'Transfer')
('TRANSFER', 'transfer', 'Transfer'),
('CARD_VALIDATION', 'card_validation', 'Card validation')
)

NATURE_CHOICES = Choices(
Expand Down Expand Up @@ -172,11 +173,20 @@

('DEPOSIT_PREAUTHORIZATION_CREATED', 'deposit_preauthorization_created', 'Deposit Preauthorization Created'),
('DEPOSIT_PREAUTHORIZATION_FAILED', 'deposit_preauthorization_failed', 'Deposit Preauthorization Failed'),
('DEPOSIT_PREAUTHORIZATION_PAYMENT_WAITING', 'deposit_preauthorization_payment_waiting', 'Deposit Preauthorization Payment Waiting'),
('DEPOSIT_PREAUTHORIZATION_PAYMENT_EXPIRED', 'deposit_preauthorization_payment_expired', 'Deposit Preauthorization Payment Expired'),
('DEPOSIT_PREAUTHORIZATION_PAYMENT_CANCEL_REQUESTED', 'deposit_preauthorization_payment_cancel_requested', 'Deposit Preauthorization Payment Cancel Requested'),
('DEPOSIT_PREAUTHORIZATION_PAYMENT_CANCELED', 'deposit_preauthorization_payment_canceled', 'Deposit Preauthorization Payment Canceled'),
('DEPOSIT_PREAUTHORIZATION_PAYMENT_VALIDATED', 'deposit_preauthorization_payment_validated', 'Deposit Preauthorization Payment Validated')
('DEPOSIT_PREAUTHORIZATION_PAYMENT_WAITING', 'deposit_preauthorization_payment_waiting',
'Deposit Preauthorization Payment Waiting'),
('DEPOSIT_PREAUTHORIZATION_PAYMENT_EXPIRED', 'deposit_preauthorization_payment_expired',
'Deposit Preauthorization Payment Expired'),
('DEPOSIT_PREAUTHORIZATION_PAYMENT_CANCEL_REQUESTED', 'deposit_preauthorization_payment_cancel_requested',
'Deposit Preauthorization Payment Cancel Requested'),
('DEPOSIT_PREAUTHORIZATION_PAYMENT_CANCELED', 'deposit_preauthorization_payment_canceled',
'Deposit Preauthorization Payment Canceled'),
('DEPOSIT_PREAUTHORIZATION_PAYMENT_VALIDATED', 'deposit_preauthorization_payment_validated',
'Deposit Preauthorization Payment Validated'),

('CARD_VALIDATION_CREATED', 'card_validation_created', 'Card Validation Created'),
('CARD_VALIDATION_FAILED', 'card_validation_failed', 'Card Validation Failed'),
('CARD_VALIDATION_SUCCEEDED', 'card_validation_succeeded', 'Card Validation Succeeded'),
)

NOTIFICATION_STATUS_CHOICES = Choices(
Expand Down Expand Up @@ -286,7 +296,15 @@
("PREAUTHORIZED", "preauthorized", "Preauthorized"),
("BANK_WIRE", "bank_wire", "Bank Wire"),
("APPLEPAY", "applepay", "Applepay"),
("GOOGLEPAY", "googlepay", "Googlepay")
("GOOGLEPAY", "googlepay", "Googlepay"),
("GOOGLE_PAY", "google_pay", "Google Pay"),
("MBWAY", "mbway", "Mbway"),
("PAYPAL", "paypal", "PayPal"),
("MULTIBANCO", "multibanco", "Multibanco"),
("SATISPAY", "satispay", "Satispay"),
("BLIK", "blik", "Blik"),
("IDEAL", "ideal", "Ideal"),
("GIROPAY", "giropay", "Giropay")
)

CARD_STATUS_CHOICES = Choices(
Expand Down Expand Up @@ -337,4 +355,40 @@
('CREATED', 'created', 'Created'),
('SUCCEEDED', 'succeeded', 'Succeeded'),
('FAILED', 'failed', 'Failed')
)
)

SHIPPING_PREFERENCE_CHOICES = Choices(
('SET_PROVIDED_ADDRESS', 'set_provided_address', 'Set Provided Address'),
('GET_FROM_FILE', 'get_from_file', 'Get From File'),
('NO_SHIPPING', 'no_shipping', 'No Shipping')
)

BIC_CHOICES = Choices(
('RABONL2U'),
('ABNANL2A'),
('FVLBNL22'),
('TRIONL2U'),
('INGBNL2A'),
('SNSBNL2A'),
('ASNBNL21'),
('RBRBNL21'),
('KNABNL2H'),
('BUNQNL2A'),
('REVOLT21'),
('BITSNL2A')
)

BANK_NAME_CHOICES = Choices(
('Rabobank'),
('ABN AMRO'),
('Van Lanschot Baniers'),
('Triodos Bank'),
('ING Bank'),
('SNS Bank'),
('ASN'),
('RegioBank'),
('Knab'),
('Bunq'),
('Revolut'),
('Yoursafe')
)
50 changes: 48 additions & 2 deletions mangopay/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Reason, ReportTransactionsFilters, ReportWalletsFilters, \
PlatformCategorization, Billing, SecurityInfo, Birthplace, ApplepayPaymentData, GooglepayPaymentData, \
ScopeBlocked, BrowserInfo, Shipping, CurrentState, FallbackReason, InstantPayout, CountryAuthorizationData, \
PayinsLinked
PayinsLinked, ConversionRate, CardInfo


class FieldDescriptor(object):
Expand Down Expand Up @@ -858,7 +858,8 @@ def api_value(self, value):
class PayinsLinkedField(Field):
def python_value(self, value):
if value is not None:
return PayinsLinked(payin_capture_id=value['PayinCaptureId'], payin_complement_id=value['PayinComplementId'])
return PayinsLinked(payin_capture_id=value['PayinCaptureId'],
payin_complement_id=value['PayinComplementId'])
return value

def api_value(self, value):
Expand All @@ -871,3 +872,48 @@ def api_value(self, value):
}

return value

class ConversionRateField(Field):
def python_value(self, value):
if value is not None:
return ConversionRate(client_rate=value['ClientRate'], market_rate=value['MarketRate'])
return value

def api_value(self, value):
value = super(ConversionRateField, self).api_value(value)

if isinstance(value, ConversionRate):
value = {
'ClientRate': value.client_rate,
'MarketRate': value.market_rate
}

return value


class CardInfoField(Field):
def python_value(self, value):
if value is not None:
return CardInfo(
bin=value['BIN'],
issuing_bank=value['IssuingBank'],
issuer_country_code=value['IssuerCountryCode'],
type=value['Type'],
brand=value['Brand'],
sub_type=value['SubType'])
return value

def api_value(self, value):
value = super(CardInfoField, self).api_value(value)

if isinstance(value, CardInfo):
value = {
'BIN': value.bin,
'IssuingBank': value.issuing_bank,
'IssuerCountryCode': value.issuer_country_code,
'Type': value.type,
'Brand': value.brand,
'SubType': value.sub_type,
}

return value
Loading

0 comments on commit 3852ffd

Please sign in to comment.