1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Srmklive\PayPal\Traits\PayPalAPI; |
4
|
|
|
|
5
|
|
|
trait DisputesActions |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* Accept customer dispute claim. |
9
|
|
|
* |
10
|
|
|
* @param string $dispute_id |
11
|
|
|
* @param string $dispute_note |
12
|
|
|
* @param array $data |
13
|
|
|
* |
14
|
|
|
* @throws \Throwable |
15
|
|
|
* |
16
|
|
|
* @return array|\Psr\Http\Message\StreamInterface|string |
17
|
|
|
* |
18
|
|
|
* @see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes-actions_accept-claim |
19
|
|
|
*/ |
20
|
|
|
public function acceptDisputeClaim($dispute_id, $dispute_note, array $data = []) |
21
|
|
|
{ |
22
|
|
|
$this->apiEndPoint = "v1/customer/disputes/{$dispute_id}/accept-claim"; |
|
|
|
|
23
|
|
|
$this->apiUrl = collect([$this->apiUrl, $this->apiEndPoint])->implode('/'); |
|
|
|
|
24
|
|
|
|
25
|
|
|
$data["note"] = $dispute_note; |
26
|
|
|
$data["accept_claim_type"] = "REFUND"; |
27
|
|
|
|
28
|
|
|
$this->options['json'] = $data; |
|
|
|
|
29
|
|
|
|
30
|
|
|
$this->verb = 'post'; |
|
|
|
|
31
|
|
|
|
32
|
|
|
return $this->doPayPalRequest(); |
|
|
|
|
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Accept offer to resolve dispute. |
37
|
|
|
* |
38
|
|
|
* @param string $dispute_id |
39
|
|
|
* @param string $dispute_note |
40
|
|
|
* |
41
|
|
|
* @throws \Throwable |
42
|
|
|
* |
43
|
|
|
* @return array|\Psr\Http\Message\StreamInterface|string |
44
|
|
|
* |
45
|
|
|
* @see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes-actions_accept-offer |
46
|
|
|
*/ |
47
|
|
|
public function acceptDisputeOfferResolution($dispute_id, $dispute_note) |
48
|
|
|
{ |
49
|
|
|
$this->apiEndPoint = "v1/customer/disputes/{$dispute_id}/accept-offer"; |
|
|
|
|
50
|
|
|
$this->apiUrl = collect([$this->apiUrl, $this->apiEndPoint])->implode('/'); |
|
|
|
|
51
|
|
|
|
52
|
|
|
$this->options['json'] = [ |
|
|
|
|
53
|
|
|
"note" => $dispute_note, |
54
|
|
|
]; |
55
|
|
|
|
56
|
|
|
$this->verb = 'post'; |
|
|
|
|
57
|
|
|
|
58
|
|
|
return $this->doPayPalRequest(); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Acknowledge item has been returned. |
63
|
|
|
* |
64
|
|
|
* @param string $dispute_id |
65
|
|
|
* @param string $dispute_note |
66
|
|
|
* @param string $acknowledgement_type |
67
|
|
|
* |
68
|
|
|
* @throws \Throwable |
69
|
|
|
* |
70
|
|
|
* @return array|\Psr\Http\Message\StreamInterface|string |
71
|
|
|
* |
72
|
|
|
* @see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes-actions_acknowledge-return-item |
73
|
|
|
*/ |
74
|
|
|
public function acknowledgeItemReturned($dispute_id, $dispute_note, $acknowledgement_type) |
75
|
|
|
{ |
76
|
|
|
$this->apiEndPoint = "v1/customer/disputes/{$dispute_id}/acknowledge-return-item"; |
|
|
|
|
77
|
|
|
$this->apiUrl = collect([$this->apiUrl, $this->apiEndPoint])->implode('/'); |
|
|
|
|
78
|
|
|
|
79
|
|
|
$this->options['json'] = [ |
|
|
|
|
80
|
|
|
"note" => $dispute_note, |
81
|
|
|
"acknowledgement_type" => $acknowledgement_type |
82
|
|
|
]; |
83
|
|
|
|
84
|
|
|
$this->verb = 'post'; |
|
|
|
|
85
|
|
|
|
86
|
|
|
return $this->doPayPalRequest(); |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
|