solidusio / solidus_bolt

BSD 3-Clause "New" or "Revised" License
1 stars 2 forks source link

Allow multiple partial capture for one payment #119

Open DanielePalombo opened 2 years ago

DanielePalombo commented 2 years ago

With Adyen Payment is possible to make multiple partial capture of one transaction.

Bolt doesn't create multiple transactions, so we should update the amount of the captured payment. The payload is the following:

{
    "type": "capture",
    "object": "transaction",
    "data": {
        "id": "TAgkymAmUwoaC",
        "type": "cc_payment",
        "processor": "adyen_gateway",
        "date": 1657746137355,
        "reference": "W6GD-Q4JX-LWRM",
        "status": "authorized",
        "from_user": {
            "id": "CA3oTX52EzRGi",
            "first_name": "Daniel",
            "last_name": "Palombo",
            "phones": [
                {
                    "number": "3332334456",
                    "country_code": "1"
                }
            ],
            "emails": [
                {
                    "address": "admin@example.com"
                }
            ]
        },
        "from_credit_card": {
            "id": "CAgFHHvPrBNUy",
            "last4": "0002",
            "bin": "370000",
            "expiration": 1898553600000,
            "network": "American Express",
            "display_network": "American Express",
            "token_type": "bolt",
            "status": "active"
        },
        "amount": {
            "amount": 3359,
            "currency": "USD",
            "currency_symbol": "$"
        },
        "order": {
            "cart": {
                "order_reference": "R857678313",
                "display_id": "R857678313",
                "total_amount": {
                    "amount": 3359,
                    "currency": "USD",
                    "currency_symbol": "$"
                },
                "items": [
                    {
                        "reference": "",
                        "name": "Developers Cap",
                        "total_amount": {
                            "amount": 0,
                            "currency": "USD",
                            "currency_symbol": "$"
                        },
                        "unit_price": {
                            "amount": 2699,
                            "currency": "USD",
                            "currency_symbol": "$"
                        },
                        "tax_amount": {
                            "amount": 0,
                            "currency": "USD",
                            "currency_symbol": "$"
                        },
                        "quantity": 1,
                        "sku": "RUB-SNC02",
                        "properties": [],
                        "taxable": true,
                        "type": "physical"
                    }
                ],
                "shipments": [
                    {
                        "shipping_address": {
                            "id": "AA5K48SFUvF7j",
                            "street_address1": "380 Degraw Street",
                            "locality": "Brooklyn",
                            "region": "NM",
                            "region_code": "NM",
                            "postal_code": "11231",
                            "country_code": "US",
                            "name": "Daniel Palombo",
                            "first_name": "Daniel",
                            "last_name": "Palombo",
                            "phone_number": "3332334456",
                            "email_address": "admin@example.com"
                        },
                        "shipping_method": "unknown",
                        "cost": {
                            "amount": 0,
                            "currency": "USD",
                            "currency_symbol": "$"
                        },
                        "tax_amount": {
                            "amount": 0,
                            "currency": "USD",
                            "currency_symbol": "$"
                        }
                    }
                ],
                "subtotal_amount": {
                    "amount": 0,
                    "currency": "USD",
                    "currency_symbol": "$"
                },
                "shipping_amount": {
                    "amount": 0,
                    "currency": "USD",
                    "currency_symbol": "$"
                },
                "discount_amount": {
                    "amount": 0,
                    "currency": "USD",
                    "currency_symbol": "$"
                }
            }
        },
        "authorization": {
            "auth": "X5MZPHHC63RZNN82",
            "metadata": {
                "processor_card_token": "GPS6FQDMX2M84H82",
                "processor_shopperReference": "R857678313",
                "processor_token_alias": ""
            },
            "reason": "none",
            "status": "succeeded"
        },
        "captures": [
            {
                "id": "CAica3zcaKCbJ",
                "status": "succeeded",
                "amount": {
                    "amount": 1000,
                    "currency": "USD",
                    "currency_symbol": "$"
                }
            },
            {
                "id": "CA79iG9PZSx3N",
                "status": "succeeded",
                "amount": {
                    "amount": 500,
                    "currency": "USD",
                    "currency_symbol": "$"
                }
            },
            {
                "id": "CAmeiPjzC5B5H",
                "status": "succeeded",
                "amount": {
                    "amount": 300,
                    "currency": "USD",
                    "currency_symbol": "$"
                }
            }
        ],
        "refund_transactions": [],
        "risk_signals": {
            "ip_address": "18.207.136.103",
            "time_on_site": "00:00:00",
            "http_headers": {
                "accept": "*/*",
                "accept_encoding": "gzip;q=1.0,deflate;q=0.6,identity;q=0.3",
                "accept_language": "",
                "connection": "",
                "host": "api-sandbox.bolt.com",
                "referer": "",
                "user_agent": "Ruby"
            }
        },
        "capture_type": "manual"
    }
}

Question for Bolt:

1) Is Adyen the only PSP that supports multiple partial captures? 2) Is possible that captures will be in different currencies?

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It might be closed if no further activity occurs. Thank you for your contributions.