coinbase / coinbase/coinbase-commerce-php

Can only resolve an UNRESOLVED charge

Open
#28 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
149
Forks
157
PR merge metrics
No merged PRs in 30d

Description

I am trying to sniff out OVERPAID charges and auto-resolve them.

I do a `Charge::retrieve()` and then find the last item of the timeline `$timeline = (array) $charge->timeline;`

This works and I get this last item:

```
=> [
"status" => "UNRESOLVED",
"context" => "OVERPAID",
"time" => "2020-05-31T20:43:00Z",
"payment" => [
"network" => "ethereum",
"transaction_id" => "REMOVED",
"value" => [
"amount" => "0.047840500",
"currency" => "ETH",
],
],
]
```

So the status is UNRESOLVED and the context is OVERPAID. Great. So I run:

```php
if ($last['status'] == 'UNRESOLVED' && $last['context'] == 'OVERPAID') {
$charge->resolve();
}
```

Which throws this error:
`CoinbaseCommerce/Exceptions/InvalidRequestException with message 'can only resolve an UNRESOLVED charge'`

This IMHO doesn't make any sense as the charge is UNRESOLVED. And in the CB dashboard I can actually resolve the charge by clicking a button.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.