|
13 | 13 | BankCard, |
14 | 14 | PrepaidCard, |
15 | 15 | PaperCheck, |
| 16 | + Transfer, |
| 17 | + PayPalAccount, |
16 | 18 | Payment, |
17 | 19 | Balance, |
18 | 20 | Receipt, |
@@ -1453,6 +1455,205 @@ def deactivatePaperCheck(self, |
1453 | 1455 |
|
1454 | 1456 | ''' |
1455 | 1457 |
|
| 1458 | + Transfers |
| 1459 | + https://portal.hyperwallet.com/docs/api/v3/resources/transfers |
| 1460 | +
|
| 1461 | + ''' |
| 1462 | + |
| 1463 | + def createTransfer(self, |
| 1464 | + data=None): |
| 1465 | + ''' |
| 1466 | + Create a Transfer. |
| 1467 | + :param data: |
| 1468 | + A dictionary containing Transfer information. **REQUIRED** |
| 1469 | + :returns: |
| 1470 | + A Transfer. |
| 1471 | + ''' |
| 1472 | + |
| 1473 | + if not data: |
| 1474 | + raise HyperwalletException('data is required') |
| 1475 | + |
| 1476 | + if not('sourceToken' in data) or not(data['sourceToken']): |
| 1477 | + raise HyperwalletException('sourceToken is required') |
| 1478 | + |
| 1479 | + if not('destinationToken' in data) or not(data['destinationToken']): |
| 1480 | + raise HyperwalletException('destinationToken is required') |
| 1481 | + |
| 1482 | + if not('clientTransferId' in data) or not(data['clientTransferId']): |
| 1483 | + raise HyperwalletException('clientTransferId is required') |
| 1484 | + |
| 1485 | + response = self.apiClient.doPost( |
| 1486 | + os.path.join('transfers'), |
| 1487 | + data |
| 1488 | + ) |
| 1489 | + |
| 1490 | + return Transfer(response) |
| 1491 | + |
| 1492 | + def getTransfer(self, |
| 1493 | + transferToken=None): |
| 1494 | + ''' |
| 1495 | + Retrieve a Transfer. |
| 1496 | + :param transferToken: |
| 1497 | + A token identifying the Transfer. **REQUIRED** |
| 1498 | + :returns: |
| 1499 | + A Transfer. |
| 1500 | + ''' |
| 1501 | + |
| 1502 | + if not transferToken: |
| 1503 | + raise HyperwalletException('transferToken is required') |
| 1504 | + |
| 1505 | + response = self.apiClient.doGet( |
| 1506 | + os.path.join( |
| 1507 | + 'transfers', |
| 1508 | + transferToken |
| 1509 | + ) |
| 1510 | + ) |
| 1511 | + |
| 1512 | + return Transfer(response) |
| 1513 | + |
| 1514 | + def listTransfers(self, |
| 1515 | + params=None): |
| 1516 | + ''' |
| 1517 | + List Transfers. |
| 1518 | + :param params: |
| 1519 | + A dictionary containing query parameters. |
| 1520 | + :returns: |
| 1521 | + An array of Transfers. |
| 1522 | + ''' |
| 1523 | + |
| 1524 | + response = self.apiClient.doGet( |
| 1525 | + os.path.join('transfers'), |
| 1526 | + params |
| 1527 | + ) |
| 1528 | + |
| 1529 | + return [Transfer(x) for x in response.get('data', [])] |
| 1530 | + |
| 1531 | + def createTransferStatusTransition(self, |
| 1532 | + transferToken=None, |
| 1533 | + data=None): |
| 1534 | + ''' |
| 1535 | + Create a Transfer Status Transition. |
| 1536 | + :param transferToken: |
| 1537 | + A token identifying the Transfer. **REQUIRED** |
| 1538 | + :param data: |
| 1539 | + A dictionary containing Transfer Status Transition information. **REQUIRED** |
| 1540 | + :returns: |
| 1541 | + A Transfer Status Transition. |
| 1542 | + ''' |
| 1543 | + |
| 1544 | + if not transferToken: |
| 1545 | + raise HyperwalletException('transferToken is required') |
| 1546 | + |
| 1547 | + if not data: |
| 1548 | + raise HyperwalletException('data is required') |
| 1549 | + |
| 1550 | + response = self.apiClient.doPost( |
| 1551 | + os.path.join( |
| 1552 | + 'transfers', |
| 1553 | + transferToken, |
| 1554 | + 'status-transitions' |
| 1555 | + ), |
| 1556 | + data |
| 1557 | + ) |
| 1558 | + |
| 1559 | + return StatusTransition(response) |
| 1560 | + |
| 1561 | + ''' |
| 1562 | +
|
| 1563 | + PayPal Accounts |
| 1564 | +
|
| 1565 | + ''' |
| 1566 | + |
| 1567 | + def createPayPalAccount(self, |
| 1568 | + userToken=None, |
| 1569 | + data=None): |
| 1570 | + ''' |
| 1571 | + Create a PayPal Account. |
| 1572 | + :param userToken: |
| 1573 | + A token identifying the User. **REQUIRED** |
| 1574 | + :param data: |
| 1575 | + A dictionary containing PayPal Account information. **REQUIRED** |
| 1576 | + :returns: |
| 1577 | + A PayPal Account. |
| 1578 | + ''' |
| 1579 | + |
| 1580 | + if not userToken: |
| 1581 | + raise HyperwalletException('userToken is required') |
| 1582 | + |
| 1583 | + if not data: |
| 1584 | + raise HyperwalletException('data is required') |
| 1585 | + |
| 1586 | + if not('transferMethodCountry' in data) or not(data['transferMethodCountry']): |
| 1587 | + raise HyperwalletException('transferMethodCountry is required') |
| 1588 | + |
| 1589 | + if not('transferMethodCurrency' in data) or not(data['transferMethodCurrency']): |
| 1590 | + raise HyperwalletException('transferMethodCurrency is required') |
| 1591 | + |
| 1592 | + if not('email' in data) or not(data['email']): |
| 1593 | + raise HyperwalletException('email is required') |
| 1594 | + |
| 1595 | + response = self.apiClient.doPost( |
| 1596 | + os.path.join('users', userToken, 'paypal-accounts'), |
| 1597 | + data |
| 1598 | + ) |
| 1599 | + |
| 1600 | + return PayPalAccount(response) |
| 1601 | + |
| 1602 | + def getPayPalAccount(self, |
| 1603 | + userToken=None, |
| 1604 | + payPalAccountToken=None): |
| 1605 | + ''' |
| 1606 | + Retrieve a PayPal Account. |
| 1607 | + :param userToken: |
| 1608 | + A token identifying the User. **REQUIRED** |
| 1609 | + :param payPalAccountToken: |
| 1610 | + A token identifying the PayPal Account. **REQUIRED** |
| 1611 | + :returns: |
| 1612 | + A PayPal Account. |
| 1613 | + ''' |
| 1614 | + |
| 1615 | + if not userToken: |
| 1616 | + raise HyperwalletException('userToken is required') |
| 1617 | + |
| 1618 | + if not payPalAccountToken: |
| 1619 | + raise HyperwalletException('payPalAccountToken is required') |
| 1620 | + |
| 1621 | + response = self.apiClient.doGet( |
| 1622 | + os.path.join( |
| 1623 | + 'users', |
| 1624 | + userToken, |
| 1625 | + 'paypal-accounts', |
| 1626 | + payPalAccountToken |
| 1627 | + ) |
| 1628 | + ) |
| 1629 | + |
| 1630 | + return PayPalAccount(response) |
| 1631 | + |
| 1632 | + def listPayPalAccounts(self, |
| 1633 | + userToken=None, |
| 1634 | + params=None): |
| 1635 | + ''' |
| 1636 | + List PayPal Accounts. |
| 1637 | + :param userToken: |
| 1638 | + A token identifying the User. **REQUIRED** |
| 1639 | + :param params: |
| 1640 | + A dictionary containing query parameters. |
| 1641 | + :returns: |
| 1642 | + An array of PayPal Accounts. |
| 1643 | + ''' |
| 1644 | + |
| 1645 | + if not userToken: |
| 1646 | + raise HyperwalletException('userToken is required') |
| 1647 | + |
| 1648 | + response = self.apiClient.doGet( |
| 1649 | + os.path.join('users', userToken, 'paypal-accounts'), |
| 1650 | + params |
| 1651 | + ) |
| 1652 | + |
| 1653 | + return [PayPalAccount(x) for x in response.get('data', [])] |
| 1654 | + |
| 1655 | + ''' |
| 1656 | +
|
1456 | 1657 | Payments |
1457 | 1658 | https://portal.hyperwallet.com/docs/api/v3/resources/payments |
1458 | 1659 |
|
|
0 commit comments