Skip to content

Commit 634b9ba

Browse files
author
japatel
committed
Payouts API Support
- Added more tests
1 parent 6523ff4 commit 634b9ba

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed

.rspec

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
--color
2+
--require spec_helper
3+
--tty
4+
--format documentation

spec/config/paypal.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
test: &default
2-
client_id: EBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM
3-
client_secret: EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM
2+
client_id: AYSq3RDGsmBLJE-otTkBtM-jBRd1TCQwFf9RGfwddNXWz0uFU9ztymylOhRS
3+
client_secret: EGnHDxD_qRPdaLdZz8iCr8N7_MzF-YHPTkjs6NKYQvQSBngp4PTTVWkPZRbL
44
username: jb-us-seller_api1.paypal.com
55
password: WX4WTU3S8MY44S7F
66
signature: AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy
@@ -14,8 +14,8 @@ development:
1414

1515
with_authentication:
1616
<<: *default
17-
client_id: EBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM
18-
client_secret: EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM
17+
client_id: AYSq3RDGsmBLJE-otTkBtM-jBRd1TCQwFf9RGfwddNXWz0uFU9ztymylOhRS
18+
client_secret: EGnHDxD_qRPdaLdZz8iCr8N7_MzF-YHPTkjs6NKYQvQSBngp4PTTVWkPZRbL
1919

2020
with_certificate:
2121
<<: *default

spec/payouts_examples_spec.rb

+23-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,28 @@
2222
}
2323

2424
it "create payout sync" do
25-
payout = PayPal::SDK::REST::Payout.new(PayoutAttributes)
26-
expect(payout.create).to be_truthy
25+
$payout = PayPal::SDK::REST::Payout.new(PayoutAttributes)
26+
$payout_batch = $payout.create(true)
27+
expect($payout_batch).to be_truthy
2728
end
29+
30+
it "get payout batch status" do
31+
$result = PayPal::SDK::REST::Payout.get($payout_batch.batch_header.payout_batch_id)
32+
expect($result).to be_a PayPal::SDK::REST::PayoutBatch
33+
expect($payout_batch.batch_header.payout_batch_id).to eql $result.batch_header.payout_batch_id
34+
end
35+
36+
it "get payout item status" do
37+
$payout_item_details= PayoutItem.get($payout_batch.items[0].payout_item_id)
38+
expect($payout_item_details).to be_a PayPal::SDK::REST::PayoutItemDetails
39+
expect($payout_item_details.payout_item_id).to eql $payout_batch.items[0].payout_item_id
40+
end
41+
42+
it "cancel unclaimed payouts" do
43+
$payout_item_details= PayoutItem.cancel($payout_batch.items[0].payout_item_id)
44+
expect($payout_item_details).to be_a PayPal::SDK::REST::PayoutItemDetails
45+
expect($payout_item_details.payout_item_id).to eql $payout_batch.items[0].payout_item_id
46+
expect($payout_item_details.transaction_status).to eql 'RETURNED'
47+
end
48+
2849
end

0 commit comments

Comments
 (0)