-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsnipets.txt
352 lines (264 loc) · 11.9 KB
/
snipets.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
- Authentication
PaymillContext paymillContext = new PaymillContext("8ff0a7e854a6ba29518962b29654a395");
ClientService clientService = paymillContext.getClientService();
---------------------Payments----------------------
-Create new Credit Card Payment with TOKEN
PaymentService paymentService = paymillContext.PaymentService;
Payment payment = paymentService.CreateWithTokenAsync("098f6bcd4621d373cade4e832627b4f6").Result;
-Create new Credit Card Payment with TOKEN & CLIENT
PaymentService paymentService = paymillContext.PaymentService;
Payment payment = paymentService.CreateWithTokenAndClientAsync(
"098f6bcd4621d373cade4e832627b4f6",
"client_88a388d9dd48f86c3136"
).Result;
-Create new Debit Payment with ...TOKEN
PaymentService paymentService = paymillContext.PaymentService;
Payment payment = paymentService.CreateWithTokenAsync(
"098f6bcd4621d373cade4e832627b4f6"
).Result;
-Create new Debit Payment with ...TOKEN & CLIENT
PaymentService paymentService = paymillContext.PaymentService;
Payment payment = paymentService.CreateWithTokenAndClientAsync(
"098f6bcd4621d373cade4e832627b4f6",
"client_88a388d9dd48f86c3136"
).Result;
-Payment Details
PaymentService paymentService = paymillContext.PaymentService;
Payment payment = paymentService.GetAsync("pay_917018675b21ca03c4fb").Result;
-List Payments
PaymentService paymentService = paymillContext.PaymentService;
PaymillList<Payment> payments = paymentService.ListAsync().Result;
-Remove Payment
PaymentService paymentService = paymillContext.PaymentService;
paymentService.DeleteAsync("pay_3af44644dd6d25c820a8").Result;
---------------------Preauthorizations----------------------
--Create new Preauthorization with TOKEN
PreauthorizationService preauthorizationService = paymillContext.PreauthorizationService;
Transaction transaction = preauthorizationService.CreateWithTokenAsync(
"098f6bcd4621d373cade4e832627b4f6",
4200,
"EUR"
).Result;
--Create new Preauthorization with PAYMENT
PaymentService paymentService = paymillContext.PaymentService;
Payment payment = paymentService.CreateWithTokenAsync(
"098f6bcd4621d373cade4e832627b4f6"
).Result;
PreauthorizationService preauthorizationService = paymillContext.PreauthorizationService;
Transaction transaction = preauthorizationService.CreateWithPaymentAsync(
payment,
4200,
"EUR"
).Result;
-Preauthorization Details
PreauthorizationService preauthorizationService = paymillContext.PreauthorizationService;
Preauthorization preauthorization = preauthorizationService.GetAsync(
"preauth_31eb90495837447f76b7"
).Result;
-Remove Preauthorizations
PreauthorizationService preauthorizationService = paymillContext.PreauthorizationService;
preauthorizationService.DeleteAsync( "preauth_31eb90495837447f76b7" ).Result;
-List Preauthorizations
PreauthorizationService preauthorizationService = paymillContext.PreauthorizationService;
PaymillList<Preauthorization> preauthorizations = preauthorizationService.ListAsync().Result;
---------------------Transactions----------------------
----Create new Transaction with PAYMENT
PaymentService paymentService = paymillContext.PaymentService;
Payment payment = paymentService.CreateWithTokenAsync(
"098f6bcd4621d373cade4e832627b4f6"
).Result;
TransactionService transactionService = paymillContext.TransactionService;
Transaction transaction = transactionService.CreateWithTokenAsync(
payment,
4200,
"EUR",
"Test Transaction"
).Result;
----Create new Transaction with TOKEN
TransactionService transactionService = paymillContext.TransactionService;
Transaction transaction = transactionService.CreateWithTokenAsync(
"098f6bcd4621d373cade4e832627b4f6",
4200,
"EUR",
"Test Transaction"
).Result;
---Create new Transaction with CLIENT & PAYMENT
TransactionService transactionService = paymillContext.TransactionService;
Transaction transaction = transactionService.CreateWithPaymentAndClientAsync(
"pay_a818b847db6ce5ff636f",
"client_c781b1d2f7f0f664b4d9",
4200,
"EUR"
).Result;
--Create new Transaction with PREAUTHORIZATION
PreauthorizationService preauthorizationService = paymillContext.PreauthorizationService;
Preauthorization preauthorization = preauthorizationService.CreateWithTokenAsync(
"098f6bcd4621d373cade4e832627b4f6",
4200,
"EUR"
).Result;
TransactionService transactionService = paymillContext.TransactionService;
Transaction transaction = this.transactionService.CreateWithPreauthorizationAsync(
preauthorization,
4200,
"EUR"
).Result;
--Create new Transaction with APP FEE
Fee fee = new Fee();
fee.Amount = 420;
fee.Payment = "pay_3af44644dd6d25c820a8";
TransactionService transactionService = paymillContext.TransactionService;
Transaction transaction = transactionService.CreateWithTokenAndFeeAsync(
"098f6bcd4621d373cade4e832627b4f6",
4200,
"EUR",
fee
).Result;
-Get Transaction
TransactionService transactionService = paymillContext.TransactionService;
Transaction transaction = transactionService.GetAsync("tran_023d3b5769321c649435").Result;
-Update Transaction
TransactionService transactionService = paymillContext.TransactionService;
Transaction transaction = transactionService.GetAsync("tran_023d3b5769321c649435").Result;
transaction.Description = "My updated transaction description";
transactionService.UpdateAsync(transaction).Result;
-List Transactions
TransactionService transactionService = paymillContext.TransactionService;
PaymillList<Transaction> transactions = transactionService.ListAsync().Result;
---------------------Refunds----------------------
-Refund Transaction
TransactionService transactionService = paymillContext.TransactionService;
Transaction transaction = transactionService.CreateWithTokenAsync(
"098f6bcd4621d373cade4e832627b4f6",
4200,
"EUR",
"For refund"
).Result;
RefundService refundService = paymillContext.RefundService;
Refund refund = refundService.RefundTransactionAsync(
transaction,
1000,
"Sample Description"
).Result;
--Refund Details
RefundService refundService = paymillContext.RefundService();
Refund refund = refundService.GetAsync("refund_773ab6f9cd03428953c9").Result;
--List Refunds
RefundService refundService = paymillContext.RefundService;
PaymillList<Refund> refunds = refundService.ListAsync;
---------------------Clients----------------------
--Create new Client
ClientService clientService = paymillContext.ClientService;
Client client = clientService.CreateWithEmailAndDescriptionAsync(
"Lovely Client"
).Result;
--Client Details
ClientService clientService = paymillContext.ClientService;
Client client = clientService.GetAsync("client_88a388d9dd48f86c3136").Result;
--Update Client
ClientService clientService = paymillContext.ClientService;
Client client = clientService.GetAsync("client_88a388d9dd48f86c3136").Result;
client.Description = "My Lovely Client";
clientService.UpdateAsync( client ).Result;
--Remove Client
ClientService clientService = paymillContext.ClientService;
clientService.DeleteAsync("client_88a388d9dd48f86c3136").Result;
--List Clients
ClientService clientService = paymillContext.ClientService;
PaymillList<Client> clients = clientService.ListAsync().Result;
---------------------Offers----------------------
--Create new Offer
OfferService offerService = paymillContext.OfferService;
Offer offer = offerService.CreateAsync("4200", "EUR", "1 MONTH", "Superabo", 30).Result;
--Offer Details
OfferService offerService = paymillContext.OfferService;
Offer offer = offerService.GetAsync("offer_40237e20a7d5a231d99b").Result;
--Update Offer
OfferService offerService = paymillContext.OfferService;
Offer offer = offerService.GetAsync("offer_40237e20a7d5a231d99b").Result;
offer.Name = "Extended Test Offer";
offerService.UpdateAsync( offer ).Result;
--Remove Offer
OfferService offerService = paymillContext.OfferService;
offerService.DeleteAsync("offer_40237e20a7d5a231d99b").Result;
--List Offer
OfferService offerService = paymillContext.OfferService;
PaymillList<Offer> offers = offerService.ListAsync().Result;
---------------------Subscriptions----------------------
--Create new Subscription
Payment payment = _paymill.PaymentService.CreateWithTokenAsync(testToken).Result;
Offer offer = _paymill.OfferService.CreateAsync(2223, "EUR", Interval.period(1, Interval.TypeUnit.WEEK), "Offer No Trial").Result;
Subscription subscription = _paymill.SubscriptionService.CreateAsync(Subscription.Create(payment, offer)).Result;
--Subscription Details
SubscriptionService subscriptionService = paymillContext.SubscriptionService;
Subscription subscription = subscriptionService.GetAsync("sub_dc180b755d10da324864").Result;
--Pause Subscription
subscription = _paymill.SubscriptionService.PauseAsync(subscription).Result;
--Unpause Subscription
subscription = _paymill.SubscriptionService.UnpauseAsync(subscription).Result;
-- Change Amount
subscription = _paymill.SubscriptionService.ChangeAmountAsync(subscription, 2000).Result;
-- Change Temp Amount
subscription = _paymill.SubscriptionService.ChangeAmountTemporaryAsync(subscription, 2000).Result;
-- Change Offer Keep Capture Date No Refund
subscription = _paymill.SubscriptionService.ChangeOfferKeepCaptureDateNoRefundAsync(subscription, newOffer ).Result;
-- Change Offer Keep Next Capture And Refund
subscription = _paymill.SubscriptionService.ChangeOfferKeepCaptureDateAndRefundAsync(subscription, newOffer).Result;
-- End Trial
subscription = _paymill.SubscriptionService.EndTrialAsync( subscription ).Result;
-- Change Period Limited Validity
subscription = _paymill.SubscriptionService.LimitValidityAsync(subscription, "2 MONTH").Result;
-- Change Period Un Limited Validity
subscription = _paymill.SubscriptionService.UnlimitValidityAsync(subscription).Result;
-- Cancel
subscription = _paymill.SubscriptionService.CancelAsync(subscription).Result;
-- Update
subscription = _paymill.SubscriptionService.UpdateAsync(subscription).Result;
-- Update Offer Only
Subscription subscription = _paymill.SubscriptionService.CreateAsync(Subscription.Create(this.payment, 2000, "EUR", "1 WEEK").WithName("test1")).Result;
subscription.Currency = null;// Do not update Currency
subscription.Interval = null;// Do not update Interval
subscription.Name = null;// Do not update Name
subscription.Offer = this.offer1;
subscription = _paymill.SubscriptionService.UpdateAsync(subscription).Result;
--Delete Subscription
subscription = _paymill.SubscriptionService.DeleteAsync(subscription).Result;
--List Subscriptions
SubscriptionService subscriptionService = paymillContext.SubscriptionService;
PaymillList<Subscription> subscriptions = subscriptionService.ListAsync().Result;
-------------------------Webhooks----------------------------------------------
--Create new URL Webhook
WebhookService webhookService = paymillContext.WebhookService;
EventType[] eventTypes = new EventType[] {
EventType.CLIENT_UPDATED,
EventType.TRANSACTION_SUCCEEDED
}.Result;
Webhook webhook = webhookService.CreateUrlWebhookAsync(
"<your-webhook-url>",
eventTypes
).Result;
--Create new E-Mail Webhook
WebhookService webhookService = paymillContext.WebhookService;
EventType[] eventTypes = new EventType[] {
EventType.CLIENT_UPDATED,
EventType.TRANSACTION_SUCCEEDED
};
Webhook webhook = webhookService.CreateEmailWebhookAsync(
"<your-webhook-email>",
eventTypes
).Result;
--Webhook Details
WebhookService webhookService = paymillContext.WebhookService;
Webhook webhook = webhookService.GetAsync("hook_40237e20a7d5a231d99b").Result;
--Update Webhook
WebhookService webhookService = paymillContext.WebhookService;
Webhook webhook = webhookService.GetAsync("hook_40237e20a7d5a231d99b").Result;
webhook.Email = "[email protected]";
webhookService.UpdateAsync( webhook ).Wait();
--Remove Webhook
WebhookService webhookService = paymillContext.WebhookService;
Webhook webhook = webhookService.DeleteAsync("hook_40237e20a7d5a231d99b").Result;
--List Webhooks
WebhookService webhookService = paymillContext.WebhookService;
PaymillList<Webhook> webhooks = webhookService.ListAsync();